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