1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file cfNewtonPolygon.h |
---|
5 | * |
---|
6 | * This file provides functions to compute the Newton polygon of a bivariate |
---|
7 | * polynomial |
---|
8 | * |
---|
9 | * @author Martin Lee |
---|
10 | * |
---|
11 | * @internal |
---|
12 | * @version \$Id$ |
---|
13 | * |
---|
14 | **/ |
---|
15 | /*****************************************************************************/ |
---|
16 | |
---|
17 | #ifndef CF_NEWTON_POLYGON_H |
---|
18 | #define CF_NEWTON_POLYGON_H |
---|
19 | |
---|
20 | // #include "config.h" |
---|
21 | |
---|
22 | #ifdef HAVE_NTL |
---|
23 | #include "NTLconvert.h" |
---|
24 | #endif |
---|
25 | |
---|
26 | /// compute a polygon |
---|
27 | /// |
---|
28 | /// @return an integer n such that the first n entries of @a points are the |
---|
29 | /// vertices of the convex hull of @a points |
---|
30 | int polygon (int** points, ///< [in,out] an array of points in the plane |
---|
31 | int sizePoints///< [in] number of elements in @a points |
---|
32 | ); |
---|
33 | |
---|
34 | /// compute the Newton polygon of a bivariate polynomial |
---|
35 | /// |
---|
36 | /// @return an array of points in the plane which are the vertices of the Newton |
---|
37 | /// polygon of F |
---|
38 | int ** newtonPolygon (const CanonicalForm& F,///< [in] a bivariate polynomial |
---|
39 | int& sizeOfNewtonPoly ///< [in, out] size of the result |
---|
40 | ); |
---|
41 | |
---|
42 | /// compute the convex hull of the support of two bivariate polynomials |
---|
43 | /// |
---|
44 | /// @return an array of points in the plane which are the vertices of the convex |
---|
45 | /// hull of the support of F and G |
---|
46 | int ** newtonPolygon (const CanonicalForm& F,///< [in] a bivariate polynomial |
---|
47 | const CanonicalForm& G,///< [in] a bivariate polynomial |
---|
48 | int& sizeOfNewtonPoly ///< [in, out] size of the result |
---|
49 | ); |
---|
50 | |
---|
51 | /// check if @a point is inside a polygon described by points |
---|
52 | /// |
---|
53 | /// @return true if @a point is inside a polygon described by points |
---|
54 | bool isInPolygon (int ** points, ///< [in] an array of points in the |
---|
55 | ///< plane describing a polygon |
---|
56 | int sizePoints,///< [in] size of @a points |
---|
57 | int* point ///< [in] a point in the plane |
---|
58 | ); |
---|
59 | |
---|
60 | /// get the y-direction slopes of all edges with positive slope in y-direction |
---|
61 | /// of a convex polygon with at least one point of the polygon lying on the |
---|
62 | /// x-axis and one lying on the y-axis |
---|
63 | /// |
---|
64 | /// @return an array containing the slopes as described above |
---|
65 | int* getRightSide (int** polygon, ///<[in] vertices of a polygon |
---|
66 | int sizeOfPolygon, ///<[in] number of vertices |
---|
67 | int& sizeOfOutput ///<[in,out] size of the output |
---|
68 | ); |
---|
69 | |
---|
70 | #ifdef HAVE_NTL |
---|
71 | /// Algorithm 5 as described in Convex-Dense Bivariate Polynomial Factorization |
---|
72 | /// by Berthomieu, Lecerf |
---|
73 | void convexDense (int** points, ///< [in, out] a set of points in Z^2, returns |
---|
74 | ///< M (points)+A |
---|
75 | int sizePoints,///< [in] size of points |
---|
76 | mat_ZZ& M, ///< [in,out] returns an invertible matrix |
---|
77 | vec_ZZ& A ///< [in,out] returns translation |
---|
78 | ); |
---|
79 | |
---|
80 | /// compress a bivariate poly |
---|
81 | /// |
---|
82 | /// @return @a compress returns a compressed bivariate poly |
---|
83 | /// @sa convexDense, decompress |
---|
84 | CanonicalForm |
---|
85 | compress (const CanonicalForm& F, ///< [in] compressed, i.e. F.level()==2, |
---|
86 | ///< bivariate poly |
---|
87 | mat_ZZ& inverseM, ///< [in,out] returns the inverse of M, |
---|
88 | ///< if computeMA==true, M otherwise |
---|
89 | vec_ZZ& A, ///< [in,out] returns translation |
---|
90 | bool computeMA= true ///< [in] whether to compute M and A |
---|
91 | ); |
---|
92 | |
---|
93 | /// decompress a bivariate poly |
---|
94 | /// |
---|
95 | /// @return @a decompress returns a decompressed bivariate poly |
---|
96 | /// @sa convexDense, decompress |
---|
97 | CanonicalForm |
---|
98 | decompress (const CanonicalForm& F,///< [in] compressed, i.e. F.level()<= 2, |
---|
99 | ///< uni- or bivariate poly |
---|
100 | const mat_ZZ& M, ///< [in] matrix M obtained from compress |
---|
101 | const vec_ZZ& A ///< [in] vector A obtained from compress |
---|
102 | ); |
---|
103 | #endif |
---|
104 | |
---|
105 | #endif |
---|
106 | |
---|