1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facFqFactorize.h |
---|
5 | * |
---|
6 | * This file provides functions for factorizing a multivariate polynomial over |
---|
7 | * \f$ F_{p} \f$ , \f$ F_{p}(\alpha ) \f$ or GF. |
---|
8 | * |
---|
9 | * @author Martin Lee |
---|
10 | * |
---|
11 | **/ |
---|
12 | /*****************************************************************************/ |
---|
13 | |
---|
14 | #ifndef FAC_FQ_FACTORIZE_H |
---|
15 | #define FAC_FQ_FACTORIZE_H |
---|
16 | |
---|
17 | // #include "config.h" |
---|
18 | |
---|
19 | #include "facFqBivar.h" |
---|
20 | #include "DegreePattern.h" |
---|
21 | #include "ExtensionInfo.h" |
---|
22 | #include "cf_util.h" |
---|
23 | #include "facFqSquarefree.h" |
---|
24 | #include "facFqBivarUtil.h" |
---|
25 | |
---|
26 | /// Factorization over a finite field |
---|
27 | /// |
---|
28 | /// @return @a multiFactorize returns a factorization of F |
---|
29 | /// @sa biFactorize(), extFactorize() |
---|
30 | CFList |
---|
31 | multiFactorize (const CanonicalForm& F, ///< [in] poly to be factored |
---|
32 | const ExtensionInfo& info ///< [in] info about extension |
---|
33 | ); |
---|
34 | |
---|
35 | /// factorize a squarefree multivariate polynomial over \f$ F_{p} \f$ |
---|
36 | /// |
---|
37 | /// @return @a FpSqrfFactorize returns a list of monic factors, the first |
---|
38 | /// element is the leading coefficient. |
---|
39 | /// @sa FqSqrfFactorize(), GFSqrfFactorize() |
---|
40 | #ifdef HAVE_NTL |
---|
41 | inline |
---|
42 | CFList FpSqrfFactorize (const CanonicalForm & F ///< [in] a multivariate poly |
---|
43 | ) |
---|
44 | { |
---|
45 | if (getNumVars (F) == 2) |
---|
46 | return FpBiSqrfFactorize (F); |
---|
47 | ExtensionInfo info= ExtensionInfo (false); |
---|
48 | CFList result= multiFactorize (F, info); |
---|
49 | result.insert (Lc(F)); |
---|
50 | return result; |
---|
51 | } |
---|
52 | |
---|
53 | /// factorize a squarefree multivariate polynomial over \f$ F_{p} (\alpha ) \f$ |
---|
54 | /// |
---|
55 | /// @return @a FqSqrfFactorize returns a list of monic factors, the first |
---|
56 | /// element is the leading coefficient. |
---|
57 | /// @sa FpSqrfFactorize(), GFSqrfFactorize() |
---|
58 | inline |
---|
59 | CFList FqSqrfFactorize (const CanonicalForm & F, ///< [in] a multivariate poly |
---|
60 | const Variable& alpha ///< [in] algebraic variable |
---|
61 | ) |
---|
62 | { |
---|
63 | if (getNumVars (F) == 2) |
---|
64 | return FqBiSqrfFactorize (F, alpha); |
---|
65 | ExtensionInfo info= ExtensionInfo (alpha, false); |
---|
66 | CFList result= multiFactorize (F, info); |
---|
67 | result.insert (Lc(F)); |
---|
68 | return result; |
---|
69 | } |
---|
70 | |
---|
71 | /// factorize a squarefree multivariate polynomial over GF |
---|
72 | /// |
---|
73 | /// @return @a GFSqrfFactorize returns a list of monic factors, the first |
---|
74 | /// element is the leading coefficient. |
---|
75 | /// @sa FpSqrfFactorize(), FqSqrfFactorize() |
---|
76 | inline |
---|
77 | CFList GFSqrfFactorize (const CanonicalForm & F ///< [in] a multivariate poly |
---|
78 | ) |
---|
79 | { |
---|
80 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
81 | "GF as base field expected"); |
---|
82 | if (getNumVars (F) == 2) |
---|
83 | return GFBiSqrfFactorize (F); |
---|
84 | ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false); |
---|
85 | CFList result= multiFactorize (F, info); |
---|
86 | result.insert (Lc(F)); |
---|
87 | return result; |
---|
88 | } |
---|
89 | |
---|
90 | /// factorize a multivariate polynomial over \f$ F_{p} \f$ |
---|
91 | /// |
---|
92 | /// @return @a FpFactorize returns a list of monic factors with |
---|
93 | /// multiplicity, the first element is the leading coefficient. |
---|
94 | /// @sa FqFactorize(), GFFactorize() |
---|
95 | inline |
---|
96 | CFFList FpFactorize (const CanonicalForm& G,///< [in] a multivariate poly |
---|
97 | bool substCheck= true ///< [in] enables substitute check |
---|
98 | ) |
---|
99 | { |
---|
100 | if (getNumVars (G) == 2) |
---|
101 | return FpBiFactorize (G, substCheck); |
---|
102 | |
---|
103 | CanonicalForm F= G; |
---|
104 | if (substCheck) |
---|
105 | { |
---|
106 | bool foundOne= false; |
---|
107 | int * substDegree= new int [F.level()]; |
---|
108 | for (int i= 1; i <= F.level(); i++) |
---|
109 | { |
---|
110 | if (degree (F, i) > 0) |
---|
111 | { |
---|
112 | substDegree[i-1]= substituteCheck (F, Variable (i)); |
---|
113 | if (substDegree [i-1] > 1) |
---|
114 | { |
---|
115 | foundOne= true; |
---|
116 | subst (F, F, substDegree[i-1], Variable (i)); |
---|
117 | } |
---|
118 | } |
---|
119 | else |
---|
120 | substDegree[i-1]= -1; |
---|
121 | } |
---|
122 | if (foundOne) |
---|
123 | { |
---|
124 | CFFList result= FpFactorize (F, false); |
---|
125 | CFFList newResult, tmp; |
---|
126 | CanonicalForm tmp2; |
---|
127 | newResult.insert (result.getFirst()); |
---|
128 | result.removeFirst(); |
---|
129 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
130 | { |
---|
131 | tmp2= i.getItem().factor(); |
---|
132 | for (int j= 1; j <= G.level(); j++) |
---|
133 | { |
---|
134 | if (substDegree[j-1] > 1) |
---|
135 | tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); |
---|
136 | } |
---|
137 | tmp= FpFactorize (tmp2, false); |
---|
138 | tmp.removeFirst(); |
---|
139 | for (CFFListIterator j= tmp; j.hasItem(); j++) |
---|
140 | newResult.append (CFFactor (j.getItem().factor(), |
---|
141 | j.getItem().exp()*i.getItem().exp())); |
---|
142 | } |
---|
143 | delete [] substDegree; |
---|
144 | return newResult; |
---|
145 | } |
---|
146 | delete [] substDegree; |
---|
147 | } |
---|
148 | |
---|
149 | ExtensionInfo info= ExtensionInfo (false); |
---|
150 | Variable a= Variable (1); |
---|
151 | CanonicalForm LcF= Lc (F); |
---|
152 | CFFList sqrf= FpSqrf (F, false); |
---|
153 | CFFList result; |
---|
154 | CFList bufResult; |
---|
155 | sqrf.removeFirst(); |
---|
156 | CFListIterator i; |
---|
157 | for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) |
---|
158 | { |
---|
159 | bufResult= multiFactorize (iter.getItem().factor(), info); |
---|
160 | for (i= bufResult; i.hasItem(); i++) |
---|
161 | result.append (CFFactor (i.getItem(), iter.getItem().exp())); |
---|
162 | } |
---|
163 | result.insert (CFFactor (LcF, 1)); |
---|
164 | return result; |
---|
165 | } |
---|
166 | |
---|
167 | /// factorize a multivariate polynomial over \f$ F_{p} (\alpha ) \f$ |
---|
168 | /// |
---|
169 | /// @return @a FqFactorize returns a list of monic factors with |
---|
170 | /// multiplicity, the first element is the leading coefficient. |
---|
171 | /// @sa FpFactorize(), GFFactorize() |
---|
172 | inline |
---|
173 | CFFList FqFactorize (const CanonicalForm& G, ///< [in] a multivariate poly |
---|
174 | const Variable& alpha, ///< [in] algebraic variable |
---|
175 | bool substCheck= true ///< [in] enables substitute check |
---|
176 | ) |
---|
177 | { |
---|
178 | if (getNumVars (G) == 2) |
---|
179 | return FqBiFactorize (G, alpha, substCheck); |
---|
180 | |
---|
181 | CanonicalForm F= G; |
---|
182 | if (substCheck) |
---|
183 | { |
---|
184 | bool foundOne= false; |
---|
185 | int * substDegree= new int [F.level()]; |
---|
186 | for (int i= 1; i <= F.level(); i++) |
---|
187 | { |
---|
188 | if (degree (F, i) > 0) |
---|
189 | { |
---|
190 | substDegree[i-1]= substituteCheck (F, Variable (i)); |
---|
191 | if (substDegree [i-1] > 1) |
---|
192 | { |
---|
193 | foundOne= true; |
---|
194 | subst (F, F, substDegree[i-1], Variable (i)); |
---|
195 | } |
---|
196 | } |
---|
197 | else |
---|
198 | substDegree[i-1]= -1; |
---|
199 | } |
---|
200 | if (foundOne) |
---|
201 | { |
---|
202 | CFFList result= FqFactorize (F, alpha, false); |
---|
203 | CFFList newResult, tmp; |
---|
204 | CanonicalForm tmp2; |
---|
205 | newResult.insert (result.getFirst()); |
---|
206 | result.removeFirst(); |
---|
207 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
208 | { |
---|
209 | tmp2= i.getItem().factor(); |
---|
210 | for (int j= 1; j <= G.level(); j++) |
---|
211 | { |
---|
212 | if (substDegree[j-1] > 1) |
---|
213 | tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); |
---|
214 | } |
---|
215 | tmp= FqFactorize (tmp2, alpha, false); |
---|
216 | tmp.removeFirst(); |
---|
217 | for (CFFListIterator j= tmp; j.hasItem(); j++) |
---|
218 | newResult.append (CFFactor (j.getItem().factor(), |
---|
219 | j.getItem().exp()*i.getItem().exp())); |
---|
220 | } |
---|
221 | delete [] substDegree; |
---|
222 | return newResult; |
---|
223 | } |
---|
224 | delete [] substDegree; |
---|
225 | } |
---|
226 | |
---|
227 | ExtensionInfo info= ExtensionInfo (alpha, false); |
---|
228 | CanonicalForm LcF= Lc (F); |
---|
229 | CFFList sqrf= FqSqrf (F, alpha, false); |
---|
230 | CFFList result; |
---|
231 | CFList bufResult; |
---|
232 | sqrf.removeFirst(); |
---|
233 | CFListIterator i; |
---|
234 | for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) |
---|
235 | { |
---|
236 | bufResult= multiFactorize (iter.getItem().factor(), info); |
---|
237 | for (i= bufResult; i.hasItem(); i++) |
---|
238 | result.append (CFFactor (i.getItem(), iter.getItem().exp())); |
---|
239 | } |
---|
240 | result.insert (CFFactor (LcF, 1)); |
---|
241 | return result; |
---|
242 | } |
---|
243 | |
---|
244 | /// factorize a multivariate polynomial over GF |
---|
245 | /// |
---|
246 | /// @return @a GFFactorize returns a list of monic factors with |
---|
247 | /// multiplicity, the first element is the leading coefficient. |
---|
248 | /// @sa FpFactorize(), FqFactorize() |
---|
249 | inline |
---|
250 | CFFList GFFactorize (const CanonicalForm& G, ///< [in] a multivariate poly |
---|
251 | bool substCheck= true ///< [in] enables substitute check |
---|
252 | ) |
---|
253 | { |
---|
254 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
255 | "GF as base field expected"); |
---|
256 | if (getNumVars (G) == 2) |
---|
257 | return GFBiFactorize (G, substCheck); |
---|
258 | |
---|
259 | CanonicalForm F= G; |
---|
260 | if (substCheck) |
---|
261 | { |
---|
262 | bool foundOne= false; |
---|
263 | int * substDegree= new int [F.level()]; |
---|
264 | for (int i= 1; i <= F.level(); i++) |
---|
265 | { |
---|
266 | if (degree (F, i) > 0) |
---|
267 | { |
---|
268 | substDegree[i-1]= substituteCheck (F, Variable (i)); |
---|
269 | if (substDegree [i-1] > 1) |
---|
270 | { |
---|
271 | foundOne= true; |
---|
272 | subst (F, F, substDegree[i-1], Variable (i)); |
---|
273 | } |
---|
274 | } |
---|
275 | else |
---|
276 | substDegree[i-1]= -1; |
---|
277 | } |
---|
278 | if (foundOne) |
---|
279 | { |
---|
280 | CFFList result= GFFactorize (F, false); |
---|
281 | CFFList newResult, tmp; |
---|
282 | CanonicalForm tmp2; |
---|
283 | newResult.insert (result.getFirst()); |
---|
284 | result.removeFirst(); |
---|
285 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
286 | { |
---|
287 | tmp2= i.getItem().factor(); |
---|
288 | for (int j= 1; j <= G.level(); j++) |
---|
289 | { |
---|
290 | if (substDegree[j-1] > 1) |
---|
291 | tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); |
---|
292 | } |
---|
293 | tmp= GFFactorize (tmp2, false); |
---|
294 | tmp.removeFirst(); |
---|
295 | for (CFFListIterator j= tmp; j.hasItem(); j++) |
---|
296 | newResult.append (CFFactor (j.getItem().factor(), |
---|
297 | j.getItem().exp()*i.getItem().exp())); |
---|
298 | } |
---|
299 | delete [] substDegree; |
---|
300 | return newResult; |
---|
301 | } |
---|
302 | delete [] substDegree; |
---|
303 | } |
---|
304 | |
---|
305 | Variable a= Variable (1); |
---|
306 | ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false); |
---|
307 | CanonicalForm LcF= Lc (F); |
---|
308 | CFFList sqrf= GFSqrf (F, false); |
---|
309 | CFFList result; |
---|
310 | CFList bufResult; |
---|
311 | sqrf.removeFirst(); |
---|
312 | CFListIterator i; |
---|
313 | for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) |
---|
314 | { |
---|
315 | bufResult= multiFactorize (iter.getItem().factor(), info); |
---|
316 | for (i= bufResult; i.hasItem(); i++) |
---|
317 | result.append (CFFactor (i.getItem(), iter.getItem().exp())); |
---|
318 | } |
---|
319 | result.insert (CFFactor (LcF, 1)); |
---|
320 | return result; |
---|
321 | } |
---|
322 | |
---|
323 | #endif |
---|
324 | |
---|
325 | /// Naive factor recombination for multivariate factorization over an extension |
---|
326 | /// of the initial field. No precomputed is used to exclude combinations. |
---|
327 | /// |
---|
328 | /// @return @a extFactorRecombination returns a list of factors of @a F, whose |
---|
329 | /// shift to zero is reversed. |
---|
330 | /// @sa factorRecombination() |
---|
331 | CFList |
---|
332 | extFactorRecombination ( |
---|
333 | const CFList& factors, ///< [in] list of lifted factors |
---|
334 | ///< that are monic wrt Variable (1) |
---|
335 | const CanonicalForm& F, ///< [in] poly to be factored |
---|
336 | const CFList& M, ///< [in] a list of powers of |
---|
337 | ///< Variables |
---|
338 | const ExtensionInfo& info, ///< [in] info about extension |
---|
339 | const CFList& evaluation ///< [in] evaluation point |
---|
340 | ); |
---|
341 | |
---|
342 | /// Naive factor recombination for multivariate factorization. |
---|
343 | /// No precomputed is used to exclude combinations. |
---|
344 | /// |
---|
345 | /// @return @a factorRecombination returns a list of factors of @a F |
---|
346 | /// @sa extFactorRecombination() |
---|
347 | CFList |
---|
348 | factorRecombination (const CanonicalForm& F,///< [in] poly to be factored |
---|
349 | const CFList& factors, ///< [in] list of lifted factors |
---|
350 | ///< that are monic wrt Variable (1) |
---|
351 | const CFList& M ///< [in] a list of powers of |
---|
352 | ///< Variables |
---|
353 | ); |
---|
354 | |
---|
355 | /// recombination of bivariate factors @a factors1 s. t. the result evaluated |
---|
356 | /// at @a evalPoint coincides with @a factors2 |
---|
357 | CFList |
---|
358 | recombination (const CFList& factors1, ///<[in] list of bivariate factors |
---|
359 | const CFList& factors2, ///<[in] list univariate factors |
---|
360 | int s, ///<[in] algorithm starts checking |
---|
361 | ///< subsets of size s |
---|
362 | int thres, ///<[in] threshold for the size of |
---|
363 | ///< subsets which are checked |
---|
364 | const CanonicalForm& evalPoint,///<[in] evaluation point |
---|
365 | const Variable& x ///<[in] second variable of |
---|
366 | ///< bivariate factors |
---|
367 | ); |
---|
368 | |
---|
369 | /// Lift bound adaption. Essentially an early factor detection but only the lift |
---|
370 | /// bound is adapted. |
---|
371 | /// |
---|
372 | /// @return @a liftBoundAdaption returns an adapted lift bound. |
---|
373 | /// @sa earlyFactorDetect(), earlyFactorDetection() |
---|
374 | int |
---|
375 | liftBoundAdaption (const CanonicalForm& F, ///< [in] a poly |
---|
376 | const CFList& factors, ///< [in] list of list of lifted |
---|
377 | ///< factors that are monic wrt |
---|
378 | ///< Variable (1) |
---|
379 | bool& success, ///< [in,out] indicates that no |
---|
380 | ///< further lifting is necessary |
---|
381 | const int deg, ///< [in] stage of Hensel lifting |
---|
382 | const CFList& MOD, ///< [in] a list of powers of |
---|
383 | ///< Variables |
---|
384 | const int bound ///< [in] initial lift bound |
---|
385 | ); |
---|
386 | |
---|
387 | /// Lift bound adaption over an extension of the initial field. Essentially an |
---|
388 | ///early factor detection but only the lift bound is adapted. |
---|
389 | /// |
---|
390 | /// @return @a liftBoundAdaption returns an adapted lift bound. |
---|
391 | /// @sa earlyFactorDetect(), earlyFactorDetection() |
---|
392 | int |
---|
393 | extLiftBoundAdaption ( |
---|
394 | const CanonicalForm& F, ///< [in] a poly |
---|
395 | const CFList& factors, ///< [in] list of list of lifted |
---|
396 | ///< factors that are monic wrt |
---|
397 | bool& success, ///< [in,out] indicates that no further |
---|
398 | ///< lifting is necessary |
---|
399 | const ExtensionInfo& info, ///< [in] info about extension |
---|
400 | const CFList& eval, ///< [in] evaluation point |
---|
401 | const int deg, ///< [in] stage of Hensel lifting |
---|
402 | const CFList& MOD, ///< [in] a list of powers of |
---|
403 | ///< Variables |
---|
404 | const int bound ///< [in] initial lift bound |
---|
405 | ); |
---|
406 | |
---|
407 | /// detects factors of @a F at stage @a deg of Hensel lifting. |
---|
408 | /// No combinations of more than one factor are tested. Lift bound is adapted. |
---|
409 | /// |
---|
410 | /// @return @a earlyFactorDetect returns a list of factors of F (possibly |
---|
411 | /// incomplete), in case of success. Otherwise an empty list. |
---|
412 | /// @sa factorRecombination(), extEarlyFactorDetect() |
---|
413 | CFList |
---|
414 | earlyFactorDetect ( |
---|
415 | CanonicalForm& F, ///< [in,out] poly to be factored, |
---|
416 | ///< returns poly divided by detected |
---|
417 | ///< factors in case of success |
---|
418 | CFList& factors, ///< [in,out] list of factors lifted up |
---|
419 | ///< to @a deg, returns a list of factors |
---|
420 | ///< without detected factors |
---|
421 | int& adaptedLiftBound, ///< [in,out] adapted lift bound |
---|
422 | bool& success, ///< [in,out] indicating success |
---|
423 | const int deg, ///< [in] stage of Hensel lifting |
---|
424 | const CFList& MOD, ///< [in] a list of powers of |
---|
425 | ///< Variables |
---|
426 | const int bound ///< [in] initial lift bound |
---|
427 | ); |
---|
428 | |
---|
429 | /// detects factors of @a F at stage @a deg of Hensel lifting. |
---|
430 | /// No combinations of more than one factor are tested. Lift bound is adapted. |
---|
431 | /// |
---|
432 | /// @return @a extEarlyFactorDetect returns a list of factors of F (possibly |
---|
433 | /// incomplete), whose shift to zero is reversed, in case of success. |
---|
434 | /// Otherwise an empty list. |
---|
435 | /// @sa factorRecombination(), earlyFactorDetection() |
---|
436 | CFList |
---|
437 | extEarlyFactorDetect ( |
---|
438 | CanonicalForm& F, ///< [in,out] poly to be factored, |
---|
439 | ///< returns poly divided by detected |
---|
440 | ///< factors in case of success |
---|
441 | CFList& factors, ///< [in,out] list of factors lifted up |
---|
442 | ///< to @a deg, returns a list of factors |
---|
443 | ///< without detected factors |
---|
444 | int& adaptedLiftBound, ///< [in,out] adapted lift bound |
---|
445 | bool& success, ///< [in,out] indicating succes |
---|
446 | const ExtensionInfo& info, ///< [in] info about extension |
---|
447 | const CFList& eval, ///< [in] evaluation point |
---|
448 | const int deg, ///< [in] stage of Hensel lifting |
---|
449 | const CFList& MOD, ///< [in] a list of powers of Variables |
---|
450 | const int bound ///< [in] initial lift bound |
---|
451 | ); |
---|
452 | |
---|
453 | /// evaluation point search for multivariate factorization, |
---|
454 | /// looks for a (F.level() - 1)-tuple such that the resulting univariate |
---|
455 | /// polynomial has main variable Variable (1), is squarefree and its degree |
---|
456 | /// coincides with degree(F) and the bivariate one is primitive wrt. |
---|
457 | /// Variable(1), and successively evaluated polynomials have the same degree in |
---|
458 | /// their main variable as F has, fails if there are no valid evaluation points, |
---|
459 | /// eval contains the intermediate evaluated polynomials. |
---|
460 | /// |
---|
461 | /// @return @a evalPoints returns an evaluation point, which is valid if and |
---|
462 | /// only if fail == false. |
---|
463 | CFList |
---|
464 | evalPoints (const CanonicalForm& F, ///< [in] a compressed poly |
---|
465 | CFList & eval, ///< [in,out] an empty list, returns @a F |
---|
466 | ///< successive evaluated |
---|
467 | const Variable& alpha, ///< [in] algebraic variable |
---|
468 | CFList& list, ///< [in,out] a list of points already |
---|
469 | ///< considered, a point is encoded as a |
---|
470 | ///< poly of degree F.level()-1 in |
---|
471 | ///< Variable(1) |
---|
472 | const bool& GF, ///< [in] GF? |
---|
473 | bool& fail ///< [in,out] indicates failure |
---|
474 | ); |
---|
475 | |
---|
476 | /// hensel Lifting and early factor detection |
---|
477 | /// |
---|
478 | /// @return @a henselLiftAndEarly returns monic (wrt Variable (1)) lifted |
---|
479 | /// factors without factors which have been detected at an early stage |
---|
480 | /// of Hensel lifting |
---|
481 | /// @sa earlyFactorDetectn(), extEarlyFactorDetect() |
---|
482 | CFList |
---|
483 | henselLiftAndEarly ( |
---|
484 | CanonicalForm& A, ///< [in,out] poly to be factored, |
---|
485 | ///< returns poly divided by detected |
---|
486 | ///< factors, in case of success |
---|
487 | CFList& MOD, ///< [in,out] a list of powers of |
---|
488 | ///< Variables |
---|
489 | int*& liftBounds, ///< [in,out] initial lift bounds, returns |
---|
490 | ///< adapted lift bounds |
---|
491 | bool& earlySuccess, ///< [in,out] indicating success |
---|
492 | CFList& earlyFactors, ///< [in,out] early factors |
---|
493 | const CFList& Aeval, ///< [in] @a A successively evaluated at |
---|
494 | ///< elements of @a evaluation |
---|
495 | const CFList& biFactors, ///< [in] bivariate factors |
---|
496 | const CFList& evaluation, ///< [in] evaluation point |
---|
497 | const ExtensionInfo& info ///< [in] info about extension |
---|
498 | ); |
---|
499 | |
---|
500 | /// Factorization over an extension of initial field |
---|
501 | /// |
---|
502 | /// @return @a extFactorize returns factorization of F over initial field |
---|
503 | /// @sa extBiFactorize(), multiFactorize() |
---|
504 | CFList |
---|
505 | extFactorize (const CanonicalForm& F, ///< [in] poly to be factored |
---|
506 | const ExtensionInfo& info ///< [in] info about extension |
---|
507 | ); |
---|
508 | |
---|
509 | /// compute the LCM of the contents of @a A wrt to each variable occuring in @a |
---|
510 | /// A. |
---|
511 | /// |
---|
512 | /// @return @a lcmContent returns the LCM of the contents of @a A wrt to each |
---|
513 | /// variable occuring in @a A. |
---|
514 | CanonicalForm |
---|
515 | lcmContent (const CanonicalForm& A, ///< [in] a compressed multivariate poly |
---|
516 | CFList& contentAi ///< [in,out] an empty list, returns a list |
---|
517 | ///< of the contents of @a A wrt to each |
---|
518 | ///< variable occuring in @a A starting from |
---|
519 | ///< @a A.mvar(). |
---|
520 | ); |
---|
521 | |
---|
522 | /// compress a polynomial s.t. \f$ deg_{x_{i}} (F) >= deg_{x_{i+1}} (F) \f$ and |
---|
523 | /// no gaps between the variables occur |
---|
524 | /// |
---|
525 | /// @return a compressed poly with the above properties |
---|
526 | CanonicalForm myCompress (const CanonicalForm& F, ///< [in] a poly |
---|
527 | CFMap& N ///< [in,out] a map to |
---|
528 | ///< decompress |
---|
529 | ); |
---|
530 | |
---|
531 | /// evaluate a poly A with main variable at level 1 at an evaluation point in |
---|
532 | /// K^(n-1) wrt different second variables. If this evaluation is valid (see |
---|
533 | /// evalPoints) then Aeval contains A successively evaluated at this point, |
---|
534 | /// otherwise this entry is empty |
---|
535 | void |
---|
536 | evaluationWRTDifferentSecondVars ( |
---|
537 | CFList*& Aeval, ///<[in,out] an array of length n-2 |
---|
538 | ///< if variable at level i > 2 |
---|
539 | ///< admits a valid evaluation |
---|
540 | ///< this entry contains A |
---|
541 | ///< successively evaluated at this |
---|
542 | ///< point otherwise an empty list |
---|
543 | const CFList& evaluation,///<[in] a valid evaluation point |
---|
544 | ///< for main variable at level 1 |
---|
545 | ///< and second variable at level 2 |
---|
546 | const CanonicalForm& A ///<[in] some poly |
---|
547 | ); |
---|
548 | |
---|
549 | /// evaluate F successively n-2 at 0 |
---|
550 | /// |
---|
551 | /// @return returns a list of successive evaluations of F, ending with F |
---|
552 | CFList evaluateAtZero (const CanonicalForm& F ///< [in] some poly |
---|
553 | ); |
---|
554 | |
---|
555 | /// divides factors by their content wrt. Variable(1) and checks if these polys |
---|
556 | /// divide F |
---|
557 | /// |
---|
558 | /// @return returns factors of F |
---|
559 | CFList recoverFactors (const CanonicalForm& F, ///< [in] some poly F |
---|
560 | const CFList& factors ///< [in] some list of |
---|
561 | ///< factor candidates |
---|
562 | ); |
---|
563 | |
---|
564 | /// divides factors shifted by evaluation by their content wrt. Variable(1) and |
---|
565 | /// checks if these polys divide F |
---|
566 | /// |
---|
567 | /// @return returns factors of F |
---|
568 | CFList recoverFactors (const CanonicalForm& F, ///< [in] some poly F |
---|
569 | const CFList& factors, ///< [in] some list of |
---|
570 | ///< factor candidates |
---|
571 | const CFList& evaluation ///< [in] evaluation point |
---|
572 | ); |
---|
573 | |
---|
574 | /// checks if factors divide F, if so F is divided by this factor and the factor |
---|
575 | /// is divided by its content wrt. Variable(1) and the entry in index at the |
---|
576 | /// position of the factor is set to 1, otherwise the entry in index is set to 0 |
---|
577 | /// |
---|
578 | /// @return returns factors of F |
---|
579 | CFList recoverFactors (CanonicalForm& F, ///< [in,out] some poly F |
---|
580 | const CFList& factors,///< [in] some list of |
---|
581 | ///< factor candidates |
---|
582 | int* index ///< [in] position of real factors |
---|
583 | ); |
---|
584 | |
---|
585 | /// refine a bivariate factorization of A with l factors to one with |
---|
586 | /// minFactorsLength |
---|
587 | void |
---|
588 | refineBiFactors (const CanonicalForm& A, ///< [in] some poly |
---|
589 | CFList& biFactors, ///< [in,out] list of bivariate to be |
---|
590 | ///< refined, returns refined factors |
---|
591 | CFList* const& factors, ///< [in] list of bivariate |
---|
592 | ///< factorizations of A wrt different |
---|
593 | ///< second variables |
---|
594 | const CFList& evaluation,///< [in] the evaluation point |
---|
595 | int minFactorsLength ///< [in] the minimal number of factors |
---|
596 | ); |
---|
597 | |
---|
598 | /// plug in evalPoint for y in a list of polys |
---|
599 | /// |
---|
600 | /// @return returns a list of the evaluated polys, these evaluated polys are |
---|
601 | /// made monic |
---|
602 | CFList |
---|
603 | buildUniFactors (const CFList& biFactors, ///< [in] a list of polys |
---|
604 | const CanonicalForm& evalPoint,///< [in] some evaluation point |
---|
605 | const Variable& y ///< [in] some variable |
---|
606 | ); |
---|
607 | |
---|
608 | /// extract leading coefficients wrt Variable(1) from bivariate factors obtained |
---|
609 | /// from factorizations of A wrt different second variables |
---|
610 | void |
---|
611 | getLeadingCoeffs (const CanonicalForm& A, ///< [in] some poly |
---|
612 | CFList*& Aeval, ///< [in,out] array of bivariate |
---|
613 | ///< factors, returns the leading |
---|
614 | ///< coefficients of these factors |
---|
615 | const CFList& uniFactors,///< [in] univariate factors of A |
---|
616 | const CFList& evaluation ///< [in] evaluation point |
---|
617 | ); |
---|
618 | |
---|
619 | /// normalize precomputed leading coefficients such that leading coefficients |
---|
620 | /// evaluated at @a evaluation in K^(n-2) equal the leading coeffs wrt |
---|
621 | /// Variable(1) of bivariate factors |
---|
622 | void |
---|
623 | prepareLeadingCoeffs (CFList*& LCs, ///<[in,out] |
---|
624 | int n, ///<[in] level of poly to be |
---|
625 | ///< factored |
---|
626 | const CFList& leadingCoeffs,///<[in] precomputed leading |
---|
627 | ///< coeffs |
---|
628 | const CFList& biFactors, ///<[in] bivariate factors |
---|
629 | const CFList& evaluation ///<[in] evaluation point |
---|
630 | ); |
---|
631 | |
---|
632 | /// obtain factors of F by reconstructing their leading coeffs |
---|
633 | /// |
---|
634 | /// @return returns the reconstructed factors |
---|
635 | /// @sa factorRecombination() |
---|
636 | CFList |
---|
637 | leadingCoeffReconstruction (const CanonicalForm& F,///<[in] poly to be factored |
---|
638 | const CFList& factors, ///<[in] factors of f monic |
---|
639 | ///< wrt Variable (1) |
---|
640 | const CFList& M ///<[in] a list of powers of |
---|
641 | ///< Variables |
---|
642 | ); |
---|
643 | |
---|
644 | /// distribute content |
---|
645 | /// |
---|
646 | /// @return returns a list result of polys such that prod (result)= prod (L) |
---|
647 | /// but the first entry of L may be (partially) factorized and these factors |
---|
648 | /// are distributed onto other entries in L |
---|
649 | CFList |
---|
650 | distributeContent ( |
---|
651 | const CFList& L, ///<[in] list of polys, first |
---|
652 | ///< entry the content to be |
---|
653 | ///< distributed |
---|
654 | const CFList* differentSecondVarFactors,///<[in] factorization wrt |
---|
655 | ///< different second vars |
---|
656 | int length ///<[in] length of |
---|
657 | ///<differentSecondVarFactors |
---|
658 | ); |
---|
659 | |
---|
660 | /// gcd free basis of two lists of factors |
---|
661 | void |
---|
662 | gcdFreeBasis (CFFList& factors1, ///< [in,out] list of factors, returns gcd free |
---|
663 | ///< factors |
---|
664 | CFFList& factors2 ///< [in,out] list of factors, returns gcd free |
---|
665 | ///< factors |
---|
666 | ); |
---|
667 | |
---|
668 | /// evaluate @a F at @a evaluation |
---|
669 | /// |
---|
670 | /// @return @a evaluateAtEval returns a list containing the successive |
---|
671 | /// evaluations of @a F, last entry is @a F again |
---|
672 | CFList |
---|
673 | evaluateAtEval (const CanonicalForm& F, ///<[in] some poly |
---|
674 | const CFArray& evaluation ///<[in] some evaluation point |
---|
675 | ); |
---|
676 | |
---|
677 | /// evaluate @a F at @a evaluation |
---|
678 | /// |
---|
679 | /// @return @a evaluateAtEval returns a list containing the successive |
---|
680 | /// evaluations of @a F starting at level @a l, last entry is @a F again |
---|
681 | CFList |
---|
682 | evaluateAtEval (const CanonicalForm& F, ///<[in] some poly |
---|
683 | const CFList& evaluation,///<[in] some evaluation point |
---|
684 | int l ///<[in] level to start at |
---|
685 | ); |
---|
686 | |
---|
687 | #endif |
---|
688 | /* FAC_FQ_FACTORIZE_H */ |
---|
689 | |
---|