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