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 | /// refine a bivariate factorization of A with l factors to one with |
---|
550 | /// minFactorsLength |
---|
551 | void |
---|
552 | refineBiFactors (const CanonicalForm& A, ///< [in] some poly |
---|
553 | CFList& biFactors, ///< [in,out] list of bivariate to be |
---|
554 | ///< refined, returns refined factors |
---|
555 | CFList* const& factors, ///< [in] list of bivariate |
---|
556 | ///< factorizations of A wrt different |
---|
557 | ///< second variables |
---|
558 | const CFList& evaluation,///< [in] the evaluation point |
---|
559 | int minFactorsLength ///< [in] the minimal number of factors |
---|
560 | ); |
---|
561 | |
---|
562 | /// plug in evalPoint for y in a list of polys |
---|
563 | /// |
---|
564 | /// @return returns a list of the evaluated polys, these evaluated polys are |
---|
565 | /// made monic |
---|
566 | CFList |
---|
567 | buildUniFactors (const CFList& biFactors, ///< [in] a list of polys |
---|
568 | const CanonicalForm& evalPoint,///< [in] some evaluation point |
---|
569 | const Variable& y ///< [in] some variable |
---|
570 | ); |
---|
571 | |
---|
572 | |
---|
573 | /// sort bivariate factors in Aeval such that their corresponding univariate |
---|
574 | /// factors coincide with uniFactors |
---|
575 | void sortByUniFactors (CFList*& Aeval, ///< [in,out] array of bivariate |
---|
576 | ///< factors |
---|
577 | int AevalLength, ///< [in] length of Aeval |
---|
578 | const CFList& uniFactors,///< [in] univariate factors |
---|
579 | const CFList& evaluation ///< [in] evaluation point |
---|
580 | ); |
---|
581 | |
---|
582 | /// extract leading coefficients wrt Variable(1) from bivariate factors obtained |
---|
583 | /// from factorizations of A wrt different second variables |
---|
584 | void |
---|
585 | getLeadingCoeffs (const CanonicalForm& A, ///< [in] some poly |
---|
586 | CFList*& Aeval, ///< [in,out] array of bivariate |
---|
587 | ///< factors, returns the leading |
---|
588 | ///< coefficients of these factors |
---|
589 | const CFList& uniFactors,///< [in] univariate factors of A |
---|
590 | const CFList& evaluation ///< [in] evaluation point |
---|
591 | ); |
---|
592 | |
---|
593 | /// normalize precomputed leading coefficients such that leading coefficients |
---|
594 | /// evaluated at @a evaluation in K^(n-2) equal the leading coeffs wrt |
---|
595 | /// Variable(1) of bivariate factors |
---|
596 | void |
---|
597 | prepareLeadingCoeffs (CFList*& LCs, ///<[in,out] |
---|
598 | int n, ///<[in] level of poly to be |
---|
599 | ///< factored |
---|
600 | const CFList& leadingCoeffs,///<[in] precomputed leading |
---|
601 | ///< coeffs |
---|
602 | const CFList& biFactors, ///<[in] bivariate factors |
---|
603 | const CFList& evaluation ///<[in] evaluation point |
---|
604 | ); |
---|
605 | |
---|
606 | /// obtain factors of F by reconstructing their leading coeffs |
---|
607 | /// |
---|
608 | /// @return returns the reconstructed factors |
---|
609 | /// @sa factorRecombination() |
---|
610 | CFList |
---|
611 | leadingCoeffReconstruction (const CanonicalForm& F,///<[in] poly to be factored |
---|
612 | const CFList& factors, ///<[in] factors of f monic |
---|
613 | ///< wrt Variable (1) |
---|
614 | const CFList& M ///<[in] a list of powers of |
---|
615 | ///< Variables |
---|
616 | ); |
---|
617 | |
---|
618 | /// distribute content |
---|
619 | /// |
---|
620 | /// @return returns a list result of polys such that prod (result)= prod (L) |
---|
621 | /// but the first entry of L may be (partially) factorized and these factors |
---|
622 | /// are distributed onto other entries in L |
---|
623 | CFList |
---|
624 | distributeContent ( |
---|
625 | const CFList& L, ///<[in] list of polys, first |
---|
626 | ///< entry the content to be |
---|
627 | ///< distributed |
---|
628 | const CFList* differentSecondVarFactors,///<[in] factorization wrt |
---|
629 | ///< different second vars |
---|
630 | int length ///<[in] length of |
---|
631 | ///<differentSecondVarFactors |
---|
632 | ); |
---|
633 | |
---|
634 | /// gcd free basis of two lists of factors |
---|
635 | void |
---|
636 | gcdFreeBasis (CFFList& factors1, ///< [in,out] list of factors, returns gcd free |
---|
637 | ///< factors |
---|
638 | CFFList& factors2 ///< [in,out] list of factors, returns gcd free |
---|
639 | ///< factors |
---|
640 | ); |
---|
641 | |
---|
642 | #endif |
---|
643 | /* FAC_FQ_FACTORIZE_H */ |
---|
644 | |
---|