1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facHensel.h |
---|
5 | * |
---|
6 | * This file defines functions for Hensel lifting. |
---|
7 | * |
---|
8 | * ABSTRACT: function are used for bi- and multivariate factorization over |
---|
9 | * finite fields |
---|
10 | * |
---|
11 | * @author Martin Lee |
---|
12 | * |
---|
13 | * @internal @version \$Id$ |
---|
14 | * |
---|
15 | **/ |
---|
16 | /*****************************************************************************/ |
---|
17 | |
---|
18 | #ifndef FAC_HENSEL_H |
---|
19 | #define FAC_HENSEL_H |
---|
20 | |
---|
21 | // #include "config.h" |
---|
22 | #include "cf_assert.h" |
---|
23 | #include "debug.h" |
---|
24 | #include "timing.h" |
---|
25 | |
---|
26 | #include "canonicalform.h" |
---|
27 | #include "cf_iter.h" |
---|
28 | #include "templates/ftmpl_functions.h" |
---|
29 | #include "algext.h" |
---|
30 | |
---|
31 | #ifdef HAVE_NTL |
---|
32 | /// sort a list of polynomials by their degree in @a x. |
---|
33 | /// |
---|
34 | void sortList (CFList& list, ///< [in, out] list of polys, sorted list |
---|
35 | const Variable& x ///< [in] some Variable |
---|
36 | ); |
---|
37 | |
---|
38 | /// Hensel lift from univariate to bivariate. |
---|
39 | /// |
---|
40 | /// @sa henselLiftResume12(), henselLift23(), henselLiftResume(), henselLift() |
---|
41 | void |
---|
42 | henselLift12 (const CanonicalForm& F, ///< [in] compressed, bivariate poly |
---|
43 | CFList& factors, ///< [in, out] monic univariate factors of |
---|
44 | ///< F, including leading coefficient as |
---|
45 | ///< first element. Returns monic lifted |
---|
46 | ///< factors without the leading |
---|
47 | ///< coefficient |
---|
48 | int l, ///< [in] lifting precision |
---|
49 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
50 | CFList& diophant, ///< [in,out] result of diophantine() |
---|
51 | CFMatrix& M, ///< [in,out] stores intermediate results |
---|
52 | bool sort= true ///< [in] sort factors by degree in |
---|
53 | ///< Variable(1) |
---|
54 | ); |
---|
55 | |
---|
56 | /// resume Hensel lift from univariate to bivariate. Assumes factors are lifted |
---|
57 | /// to precision Variable (2)^start and lifts them to precision Variable (2)^end |
---|
58 | /// |
---|
59 | /// @sa henselLift12(), henselLift23(), henselLiftResume(), henselLift() |
---|
60 | void |
---|
61 | henselLiftResume12 (const CanonicalForm& F, ///< [in] compressed, bivariate poly |
---|
62 | CFList& factors, ///< [in,out] monic factors of F, |
---|
63 | ///< lifted to precision start, |
---|
64 | ///< including leading coefficient |
---|
65 | ///< as first element. Returns monic |
---|
66 | ///< lifted factors without the |
---|
67 | ///< leading coefficient |
---|
68 | int start, ///< [in] starting precision |
---|
69 | int end, ///< [in] end precision |
---|
70 | CFArray& Pi, ///< [in,out] stores intermediate |
---|
71 | ///< results |
---|
72 | const CFList& diophant, ///< [in] result of diophantine |
---|
73 | CFMatrix& M ///< [in,out] stores intermediate |
---|
74 | ///< results |
---|
75 | ); |
---|
76 | |
---|
77 | /// Hensel lifting from bivariate to trivariate. |
---|
78 | /// |
---|
79 | /// @return @a henselLift23 returns a list of polynomials lifted to precision |
---|
80 | /// Variable (3)^l[1] |
---|
81 | /// @sa henselLift12(), henselLiftResume12(), henselLiftResume(), henselLift() |
---|
82 | CFList |
---|
83 | henselLift23 (const CFList& eval, ///< [in] contains compressed, bivariate |
---|
84 | ///< as first element and trivariate one as |
---|
85 | ///< second element |
---|
86 | const CFList& factors, ///< [in] monic bivariate factors, |
---|
87 | ///< including leading coefficient |
---|
88 | ///< as first element. |
---|
89 | const int* l, ///< [in] l[0]: precision of bivariate |
---|
90 | ///< lifting, l[1] as above |
---|
91 | CFList& diophant, ///< [in,out] returns the result of |
---|
92 | ///< biDiophantine() |
---|
93 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
94 | CFMatrix& M ///< [in,out] stores intermediate results |
---|
95 | ); |
---|
96 | |
---|
97 | /// resume Hensel lifting. |
---|
98 | /// |
---|
99 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLift() |
---|
100 | void |
---|
101 | henselLiftResume ( |
---|
102 | const CanonicalForm& F, ///< [in] compressed, multivariate poly |
---|
103 | CFList& factors, ///< [in,out] monic multivariate factors |
---|
104 | ///< lifted to precision F.mvar()^start, |
---|
105 | ///< including leading coefficient |
---|
106 | ///< as first element. Returns factors |
---|
107 | ///< lifted to precision F.mvar()^end |
---|
108 | int start, ///< [in] starting precision |
---|
109 | int end, ///< [in] end precision |
---|
110 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
111 | const CFList& diophant, ///< [in] result of multiRecDiophantine() |
---|
112 | CFMatrix& M, ///< [in, out] stores intermediate results |
---|
113 | const CFList& MOD ///< [in] a list of powers of Variables |
---|
114 | ///< of level higher than 1 |
---|
115 | ); |
---|
116 | |
---|
117 | /// Hensel lifting |
---|
118 | /// |
---|
119 | /// @return @a henselLift returns a list of polynomials lifted to |
---|
120 | /// precision F.getLast().mvar()^l_new |
---|
121 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLiftResume() |
---|
122 | CFList |
---|
123 | henselLift (const CFList& F, ///< [in] two compressed, multivariate |
---|
124 | ///< polys F and G |
---|
125 | const CFList& factors, ///< [in] monic multivariate factors |
---|
126 | ///< including leading coefficient |
---|
127 | ///< as first element. |
---|
128 | const CFList& MOD, ///< [in] a list of powers of Variables |
---|
129 | ///< of level higher than 1 |
---|
130 | CFList& diophant, ///< [in,out] result of multiRecDiophantine() |
---|
131 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
132 | CFMatrix& M, ///< [in,out] stores intermediate results |
---|
133 | const int lOld, ///< [in] lifting precision of F.mvar() |
---|
134 | const int lNew ///< [in] lifting precision of G.mvar() |
---|
135 | ); |
---|
136 | |
---|
137 | /// Hensel lifting from bivariate to multivariate |
---|
138 | /// |
---|
139 | /// @return @a henselLift returns a list of lifted factors |
---|
140 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLiftResume() |
---|
141 | CFList |
---|
142 | henselLift (const CFList& eval, ///< [in] a list of polynomials the last |
---|
143 | ///< element is a compressed multivariate |
---|
144 | ///< poly, last but one element equals the |
---|
145 | ///< last elements modulo its main variable |
---|
146 | ///< and so on. The first element is a |
---|
147 | ///< compressed bivariate poly. |
---|
148 | const CFList& factors, ///< [in] bivariate factors, including |
---|
149 | ///< leading coefficient |
---|
150 | const int* l, ///< [in] lifting bounds |
---|
151 | const int lLength, ///< [in] length of l |
---|
152 | bool sort= true ///< [in] sort factors by degree in |
---|
153 | ///< Variable(1) |
---|
154 | ); |
---|
155 | |
---|
156 | /// two factor Hensel lifting from univariate to bivariate, factors need not to |
---|
157 | /// be monic |
---|
158 | void |
---|
159 | henselLift122 (const CanonicalForm& F,///< [in] a bivariate poly |
---|
160 | CFList& factors, ///< [in, out] a list of univariate polys |
---|
161 | ///< lifted factors |
---|
162 | int l, ///< [in] lift bound |
---|
163 | CFArray& Pi, ///< [in, out] stores intermediate results |
---|
164 | CFList& diophant, ///< [in, out] result of diophantine |
---|
165 | CFMatrix& M, ///< [in, out] stores intermediate results |
---|
166 | const CFArray& LCs, ///< [in] leading coefficients |
---|
167 | bool sort ///< [in] if true factors are sorted by |
---|
168 | ///< their degree |
---|
169 | ); |
---|
170 | |
---|
171 | /// two factor Hensel lifting from bivariate to multivariate, factors need not |
---|
172 | /// to be monic |
---|
173 | /// |
---|
174 | /// @return @a henselLift122 returns a list of lifted factors |
---|
175 | CFList |
---|
176 | henselLift2 (const CFList& eval, ///< [in] a list of polynomials the last |
---|
177 | ///< element is a compressed multivariate |
---|
178 | ///< poly, last but one element equals the |
---|
179 | ///< last elements modulo its main variable |
---|
180 | ///< and so on. The first element is a |
---|
181 | ///< compressed bivariate poly. |
---|
182 | const CFList& factors,///< [in] bivariate factors |
---|
183 | int* l, ///< [in] lift bounds |
---|
184 | const int lLength, ///< [in] length of l |
---|
185 | bool sort, ///< [in] if true factors are sorted by |
---|
186 | ///< their degree in Variable(1) |
---|
187 | const CFList& LCs1, ///< [in] a list of evaluated LC of first |
---|
188 | ///< factor |
---|
189 | const CFList& LCs2, ///< [in] a list of evaluated LC of second |
---|
190 | ///< factor |
---|
191 | const CFArray& Pi, ///< [in] intermediate result |
---|
192 | const CFList& diophant,///< [in] result of diophantine |
---|
193 | bool& noOneToOne ///< [in,out] check for one to one |
---|
194 | ///< correspondence |
---|
195 | ); |
---|
196 | |
---|
197 | /// Hensel lifting of non monic factors, needs correct leading coefficients of |
---|
198 | /// factors and a one to one corresponds between bivariate and multivariate |
---|
199 | /// factors to succeed |
---|
200 | /// |
---|
201 | /// @return @a nonMonicHenselLift returns a list of lifted factors |
---|
202 | /// such that prod (factors) == eval.getLast() if there is a one to one |
---|
203 | /// correspondence |
---|
204 | CFList |
---|
205 | nonMonicHenselLift (const CFList& eval, ///< [in] a list of polys the last |
---|
206 | ///< element is a compressed |
---|
207 | ///< multivariate poly, last but one |
---|
208 | ///< element equals the last elements |
---|
209 | ///< modulo its main variable and so |
---|
210 | ///< on. The first element is a |
---|
211 | ///< compressed poly in 3 variables |
---|
212 | const CFList& factors, ///< [in] a list of bivariate factors |
---|
213 | CFList* const& LCs, ///< [in] leading coefficients, |
---|
214 | ///< evaluated in the same way as |
---|
215 | ///< eval |
---|
216 | CFList& diophant, ///< [in, out] solution of univariate |
---|
217 | ///< diophantine equation |
---|
218 | CFArray& Pi, ///< [in, out] buffer intermediate |
---|
219 | ///< results |
---|
220 | int* liftBound, ///< [in] lifting bounds |
---|
221 | int length, ///< [in] length of lifting bounds |
---|
222 | bool& noOneToOne ///< [in, out] check for one to one |
---|
223 | ///< correspondence |
---|
224 | ); |
---|
225 | #endif /* HAVE_NTL */ |
---|
226 | #endif |
---|
227 | /* FAC_HENSEL_H */ |
---|
228 | |
---|