1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facFqBivar.h |
---|
5 | * |
---|
6 | * This file provides functions for factorizing a bivariate polynomial over |
---|
7 | * \f$ F_{p} \f$ , \f$ F_{p}(\alpha ) \f$ or GF. |
---|
8 | * |
---|
9 | * ABSTRACT: In contrast to biFactorizer() in facFqFactorice.cc we evaluate and |
---|
10 | * factorize the polynomial in both variables. So far factor recombination is |
---|
11 | * done naive! |
---|
12 | * |
---|
13 | * @author Martin Lee |
---|
14 | * |
---|
15 | * @internal @version \$Id$ |
---|
16 | * |
---|
17 | **/ |
---|
18 | /*****************************************************************************/ |
---|
19 | |
---|
20 | #ifndef FAC_FQ_BIVAR_H |
---|
21 | #define FAC_FQ_BIVAR_H |
---|
22 | |
---|
23 | #include <config.h> |
---|
24 | |
---|
25 | #include "assert.h" |
---|
26 | |
---|
27 | #include "facFqBivarUtil.h" |
---|
28 | #include "DegreePattern.h" |
---|
29 | #include "ExtensionInfo.h" |
---|
30 | #include "cf_util.h" |
---|
31 | #include "facFqSquarefree.h" |
---|
32 | #include "cf_map.h" |
---|
33 | #include "cfNewtonPolygon.h" |
---|
34 | |
---|
35 | static const double log2exp= 1.442695041; |
---|
36 | |
---|
37 | /// Factorization of a squarefree bivariate polynomials over an arbitrary finite |
---|
38 | /// field, information on the current field we work over is in @a info. @a info |
---|
39 | /// may also contain information about the initial field if initial and current |
---|
40 | /// field do not coincide. In this case the current field is an extension of the |
---|
41 | /// initial field and the factors returned are factors of F over the initial |
---|
42 | /// field. |
---|
43 | /// |
---|
44 | /// @return @a biFactorize returns a list of factors of F. If F is not monic |
---|
45 | /// its leading coefficient is not outputted. |
---|
46 | /// @sa extBifactorize() |
---|
47 | CFList |
---|
48 | biFactorize (const CanonicalForm& F, ///< [in] a bivariate poly |
---|
49 | const ExtensionInfo& info ///< [in] information about extension |
---|
50 | ); |
---|
51 | |
---|
52 | /// factorize a squarefree bivariate polynomial over \f$ F_{p} \f$. |
---|
53 | /// |
---|
54 | /// @return @a FpBiSqrfFactorize returns a list of monic factors, the first |
---|
55 | /// element is the leading coefficient. |
---|
56 | /// @sa FqBiSqrfFactorize(), GFBiSqrfFactorize() |
---|
57 | #ifdef HAVE_NTL |
---|
58 | inline |
---|
59 | CFList FpBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly |
---|
60 | ) |
---|
61 | { |
---|
62 | ExtensionInfo info= ExtensionInfo (false); |
---|
63 | CFMap N; |
---|
64 | CanonicalForm F= compress (G, N); |
---|
65 | CanonicalForm contentX= content (F, 1); |
---|
66 | CanonicalForm contentY= content (F, 2); |
---|
67 | F /= (contentX*contentY); |
---|
68 | CFFList contentXFactors, contentYFactors; |
---|
69 | contentXFactors= factorize (contentX); |
---|
70 | contentYFactors= factorize (contentY); |
---|
71 | if (contentXFactors.getFirst().factor().inCoeffDomain()) |
---|
72 | contentXFactors.removeFirst(); |
---|
73 | if (contentYFactors.getFirst().factor().inCoeffDomain()) |
---|
74 | contentYFactors.removeFirst(); |
---|
75 | if (F.inCoeffDomain()) |
---|
76 | { |
---|
77 | CFList result; |
---|
78 | for (CFFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
79 | result.append (N (i.getItem().factor())); |
---|
80 | for (CFFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
81 | result.append (N (i.getItem().factor())); |
---|
82 | normalize (result); |
---|
83 | result.insert (Lc (G)); |
---|
84 | return result; |
---|
85 | } |
---|
86 | mat_ZZ M; |
---|
87 | vec_ZZ S; |
---|
88 | F= compress (F, M, S); |
---|
89 | CFList result= biFactorize (F, info); |
---|
90 | for (CFListIterator i= result; i.hasItem(); i++) |
---|
91 | i.getItem()= N (decompress (i.getItem(), M, S)); |
---|
92 | for (CFFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
93 | result.append (N(i.getItem().factor())); |
---|
94 | for (CFFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
95 | result.append (N (i.getItem().factor())); |
---|
96 | normalize (result); |
---|
97 | result.insert (Lc(G)); |
---|
98 | return result; |
---|
99 | } |
---|
100 | |
---|
101 | /// factorize a squarefree bivariate polynomial over \f$ F_{p}(\alpha ) \f$. |
---|
102 | /// |
---|
103 | /// @return @a FqBiSqrfFactorize returns a list of monic factors, the first |
---|
104 | /// element is the leading coefficient. |
---|
105 | /// @sa FpBiSqrfFactorize(), GFBiSqrfFactorize() |
---|
106 | inline |
---|
107 | CFList FqBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly |
---|
108 | const Variable& alpha ///< [in] algebraic variable |
---|
109 | ) |
---|
110 | { |
---|
111 | ExtensionInfo info= ExtensionInfo (alpha, false); |
---|
112 | CFMap N; |
---|
113 | CanonicalForm F= compress (G, N); |
---|
114 | CanonicalForm contentX= content (F, 1); |
---|
115 | CanonicalForm contentY= content (F, 2); |
---|
116 | F /= (contentX*contentY); |
---|
117 | CFFList contentXFactors, contentYFactors; |
---|
118 | contentXFactors= factorize (contentX); |
---|
119 | contentYFactors= factorize (contentY); |
---|
120 | if (contentXFactors.getFirst().factor().inCoeffDomain()) |
---|
121 | contentXFactors.removeFirst(); |
---|
122 | if (contentYFactors.getFirst().factor().inCoeffDomain()) |
---|
123 | contentYFactors.removeFirst(); |
---|
124 | if (F.inCoeffDomain()) |
---|
125 | { |
---|
126 | CFList result; |
---|
127 | for (CFFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
128 | result.append (N (i.getItem().factor())); |
---|
129 | for (CFFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
130 | result.append (N (i.getItem().factor())); |
---|
131 | normalize (result); |
---|
132 | result.insert (Lc (G)); |
---|
133 | return result; |
---|
134 | } |
---|
135 | mat_ZZ M; |
---|
136 | vec_ZZ S; |
---|
137 | F= compress (F, M, S); |
---|
138 | CFList result= biFactorize (F, info); |
---|
139 | for (CFListIterator i= result; i.hasItem(); i++) |
---|
140 | i.getItem()= N (decompress (i.getItem(), M, S)); |
---|
141 | for (CFFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
142 | result.append (N(i.getItem().factor())); |
---|
143 | for (CFFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
144 | result.append (N (i.getItem().factor())); |
---|
145 | normalize (result); |
---|
146 | result.insert (Lc(G)); |
---|
147 | return result; |
---|
148 | } |
---|
149 | |
---|
150 | /// factorize a squarefree bivariate polynomial over GF |
---|
151 | /// |
---|
152 | /// @return @a GFBiSqrfFactorize returns a list of monic factors, the first |
---|
153 | /// element is the leading coefficient. |
---|
154 | /// @sa FpBiSqrfFactorize(), FqBiSqrfFactorize() |
---|
155 | inline |
---|
156 | CFList GFBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly |
---|
157 | ) |
---|
158 | { |
---|
159 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
160 | "GF as base field expected"); |
---|
161 | ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false); |
---|
162 | CFMap N; |
---|
163 | CanonicalForm F= compress (G, N); |
---|
164 | CanonicalForm contentX= content (F, 1); |
---|
165 | CanonicalForm contentY= content (F, 2); |
---|
166 | F /= (contentX*contentY); |
---|
167 | CFList contentXFactors, contentYFactors; |
---|
168 | contentXFactors= biFactorize (contentX, info); |
---|
169 | contentYFactors= biFactorize (contentY, info); |
---|
170 | if (contentXFactors.getFirst().inCoeffDomain()) |
---|
171 | contentXFactors.removeFirst(); |
---|
172 | if (contentYFactors.getFirst().inCoeffDomain()) |
---|
173 | contentYFactors.removeFirst(); |
---|
174 | if (F.inCoeffDomain()) |
---|
175 | { |
---|
176 | CFList result; |
---|
177 | for (CFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
178 | result.append (N (i.getItem())); |
---|
179 | for (CFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
180 | result.append (N (i.getItem())); |
---|
181 | normalize (result); |
---|
182 | result.insert (Lc (G)); |
---|
183 | return result; |
---|
184 | } |
---|
185 | mat_ZZ M; |
---|
186 | vec_ZZ S; |
---|
187 | F= compress (F, M, S); |
---|
188 | CFList result= biFactorize (F, info); |
---|
189 | for (CFListIterator i= result; i.hasItem(); i++) |
---|
190 | i.getItem()= N (decompress (i.getItem(), M, S)); |
---|
191 | for (CFListIterator i= contentXFactors; i.hasItem(); i++) |
---|
192 | result.append (N(i.getItem())); |
---|
193 | for (CFListIterator i= contentYFactors; i.hasItem(); i++) |
---|
194 | result.append (N (i.getItem())); |
---|
195 | normalize (result); |
---|
196 | result.insert (Lc(G)); |
---|
197 | return result; |
---|
198 | } |
---|
199 | |
---|
200 | /// factorize a bivariate polynomial over \f$ F_{p} \f$ |
---|
201 | /// |
---|
202 | /// @return @a FpBiFactorize returns a list of monic factors with |
---|
203 | /// multiplicity, the first element is the leading coefficient. |
---|
204 | /// @sa FqBiFactorize(), GFBiFactorize() |
---|
205 | inline |
---|
206 | CFFList FpBiFactorize (const CanonicalForm & G ///< [in] a bivariate poly |
---|
207 | ) |
---|
208 | { |
---|
209 | ExtensionInfo info= ExtensionInfo (false); |
---|
210 | bool GF= false; |
---|
211 | CFMap N; |
---|
212 | CanonicalForm F= compress (G, N); |
---|
213 | CanonicalForm LcF= Lc (F); |
---|
214 | CanonicalForm contentX= content (F, 1); |
---|
215 | CanonicalForm contentY= content (F, 2); |
---|
216 | F /= (contentX*contentY); |
---|
217 | CFFList contentXFactors, contentYFactors; |
---|
218 | contentXFactors= factorize (contentX); |
---|
219 | contentYFactors= factorize (contentY); |
---|
220 | if (contentXFactors.getFirst().factor().inCoeffDomain()) |
---|
221 | contentXFactors.removeFirst(); |
---|
222 | if (contentYFactors.getFirst().factor().inCoeffDomain()) |
---|
223 | contentYFactors.removeFirst(); |
---|
224 | decompress (contentXFactors, N); |
---|
225 | decompress (contentYFactors, N); |
---|
226 | CFFList result, resultRoot; |
---|
227 | if (F.inCoeffDomain()) |
---|
228 | { |
---|
229 | result= Union (contentXFactors, contentYFactors); |
---|
230 | normalize (result); |
---|
231 | result.insert (CFFactor (LcF, 1)); |
---|
232 | return result; |
---|
233 | } |
---|
234 | mat_ZZ M; |
---|
235 | vec_ZZ S; |
---|
236 | F= compress (F, M, S); |
---|
237 | CanonicalForm pthRoot, A; |
---|
238 | CanonicalForm sqrfP= sqrfPart (F/Lc(F), pthRoot, info.getAlpha()); |
---|
239 | CFList buf, bufRoot; |
---|
240 | int p= getCharacteristic(); |
---|
241 | int l; |
---|
242 | if (degree (pthRoot) > 0) |
---|
243 | { |
---|
244 | pthRoot= maxpthRoot (pthRoot, p, l); |
---|
245 | result= FpBiFactorize (pthRoot); |
---|
246 | result.removeFirst(); |
---|
247 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
248 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
249 | i.getItem().exp()*ipower (p,l)); |
---|
250 | result= Union (result, contentXFactors); |
---|
251 | result= Union (result, contentYFactors); |
---|
252 | normalize (result); |
---|
253 | result.insert (CFFactor (LcF, 1)); |
---|
254 | return result; |
---|
255 | } |
---|
256 | else |
---|
257 | { |
---|
258 | buf= biFactorize (sqrfP, info); |
---|
259 | A= F/LcF; |
---|
260 | result= multiplicity (A, buf); |
---|
261 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
262 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
263 | i.getItem().exp()); |
---|
264 | } |
---|
265 | if (degree (A) > 0) |
---|
266 | { |
---|
267 | resultRoot= FpBiFactorize (A); |
---|
268 | resultRoot.removeFirst(); |
---|
269 | for (CFFListIterator i= resultRoot; i.hasItem(); i++) |
---|
270 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
271 | i.getItem().exp()); |
---|
272 | result= Union (result, resultRoot); |
---|
273 | } |
---|
274 | result= Union (result, contentXFactors); |
---|
275 | result= Union (result, contentYFactors); |
---|
276 | normalize (result); |
---|
277 | result.insert (CFFactor (LcF, 1)); |
---|
278 | return result; |
---|
279 | } |
---|
280 | |
---|
281 | /// factorize a bivariate polynomial over \f$ F_{p}(\alpha ) \f$ |
---|
282 | /// |
---|
283 | /// @return @a FqBiFactorize returns a list of monic factors with |
---|
284 | /// multiplicity, the first element is the leading coefficient. |
---|
285 | /// @sa FpBiFactorize(), FqBiFactorize() |
---|
286 | inline |
---|
287 | CFFList FqBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly |
---|
288 | const Variable & alpha ///< [in] algebraic variable |
---|
289 | ) |
---|
290 | { |
---|
291 | ExtensionInfo info= ExtensionInfo (alpha, false); |
---|
292 | bool GF= false; |
---|
293 | CFMap N; |
---|
294 | CanonicalForm F= compress (G, N); |
---|
295 | CanonicalForm LcF= Lc (F); |
---|
296 | CanonicalForm contentX= content (F, 1); |
---|
297 | CanonicalForm contentY= content (F, 2); |
---|
298 | F /= (contentX*contentY); |
---|
299 | CFFList contentXFactors, contentYFactors; |
---|
300 | contentXFactors= factorize (contentX); |
---|
301 | contentYFactors= factorize (contentY); |
---|
302 | if (contentXFactors.getFirst().factor().inCoeffDomain()) |
---|
303 | contentXFactors.removeFirst(); |
---|
304 | if (contentYFactors.getFirst().factor().inCoeffDomain()) |
---|
305 | contentYFactors.removeFirst(); |
---|
306 | decompress (contentXFactors, N); |
---|
307 | decompress (contentYFactors, N); |
---|
308 | CFFList result, resultRoot; |
---|
309 | if (F.inCoeffDomain()) |
---|
310 | { |
---|
311 | result= Union (contentXFactors, contentYFactors); |
---|
312 | normalize (result); |
---|
313 | result.insert (CFFactor (LcF, 1)); |
---|
314 | return result; |
---|
315 | } |
---|
316 | mat_ZZ M; |
---|
317 | vec_ZZ S; |
---|
318 | CanonicalForm oldF= F; |
---|
319 | F= compress (F, M, S); |
---|
320 | CanonicalForm pthRoot, A, tmp; |
---|
321 | CanonicalForm sqrfP= sqrfPart (F/Lc(F), pthRoot, alpha); |
---|
322 | CFList buf, bufRoot; |
---|
323 | int p= getCharacteristic(); |
---|
324 | int q= ipower (p, degree (getMipo (alpha))); |
---|
325 | int l; |
---|
326 | if (degree (pthRoot) > 0) |
---|
327 | { |
---|
328 | pthRoot= maxpthRoot (pthRoot, q, l); |
---|
329 | result= FqBiFactorize (pthRoot, alpha); |
---|
330 | result.removeFirst(); |
---|
331 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
332 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
333 | i.getItem().exp()*ipower (p,l)); |
---|
334 | result= Union (result, contentXFactors); |
---|
335 | result= Union (result, contentYFactors); |
---|
336 | normalize (result); |
---|
337 | result.insert (CFFactor (LcF, 1)); |
---|
338 | return result; |
---|
339 | } |
---|
340 | else |
---|
341 | { |
---|
342 | buf= biFactorize (sqrfP, info); |
---|
343 | A= F/LcF; |
---|
344 | result= multiplicity (A, buf); |
---|
345 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
346 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
347 | i.getItem().exp()); |
---|
348 | } |
---|
349 | if (degree (A) > 0) |
---|
350 | { |
---|
351 | resultRoot= FqBiFactorize (A, alpha); |
---|
352 | resultRoot.removeFirst(); |
---|
353 | for (CFFListIterator i= resultRoot; i.hasItem(); i++) |
---|
354 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
355 | i.getItem().exp()); |
---|
356 | result= Union (result, resultRoot); |
---|
357 | } |
---|
358 | result= Union (result, contentXFactors); |
---|
359 | result= Union (result, contentYFactors); |
---|
360 | normalize (result); |
---|
361 | result.insert (CFFactor (LcF, 1)); |
---|
362 | return result; |
---|
363 | } |
---|
364 | |
---|
365 | /// factorize a bivariate polynomial over GF |
---|
366 | /// |
---|
367 | /// @return @a GFBiFactorize returns a list of monic factors with |
---|
368 | /// multiplicity, the first element is the leading coefficient. |
---|
369 | /// @sa FpBiFactorize(), FqBiFactorize() |
---|
370 | inline |
---|
371 | CFFList GFBiFactorize (const CanonicalForm & G ///< [in] a bivariate poly |
---|
372 | ) |
---|
373 | { |
---|
374 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
375 | "GF as base field expected"); |
---|
376 | ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false); |
---|
377 | bool GF= true; |
---|
378 | CFMap N; |
---|
379 | CanonicalForm F= compress (G, N); |
---|
380 | CanonicalForm LcF= Lc (F); |
---|
381 | CanonicalForm contentX= content (F, 1); |
---|
382 | CanonicalForm contentY= content (F, 2); |
---|
383 | F /= (contentX*contentY); |
---|
384 | CFFList contentXFactors, contentYFactors; |
---|
385 | contentXFactors= factorize (contentX); |
---|
386 | contentYFactors= factorize (contentY); |
---|
387 | if (contentXFactors.getFirst().factor().inCoeffDomain()) |
---|
388 | contentXFactors.removeFirst(); |
---|
389 | if (contentYFactors.getFirst().factor().inCoeffDomain()) |
---|
390 | contentYFactors.removeFirst(); |
---|
391 | decompress (contentXFactors, N); |
---|
392 | decompress (contentYFactors, N); |
---|
393 | CFFList result, resultRoot; |
---|
394 | if (F.inCoeffDomain()) |
---|
395 | { |
---|
396 | result= Union (contentXFactors, contentYFactors); |
---|
397 | normalize (result); |
---|
398 | result.insert (CFFactor (LcF, 1)); |
---|
399 | return result; |
---|
400 | } |
---|
401 | mat_ZZ M; |
---|
402 | vec_ZZ S; |
---|
403 | F= compress (F, M, S); |
---|
404 | CanonicalForm pthRoot, A; |
---|
405 | CanonicalForm sqrfP= sqrfPart (F/LcF, pthRoot, info.getAlpha()); |
---|
406 | CFList buf; |
---|
407 | int p= getCharacteristic(); |
---|
408 | int q= ipower (p, getGFDegree()); |
---|
409 | int l; |
---|
410 | if (degree (pthRoot) > 0) |
---|
411 | { |
---|
412 | pthRoot= maxpthRoot (pthRoot, q, l); |
---|
413 | result= GFBiFactorize (pthRoot); |
---|
414 | result.removeFirst(); |
---|
415 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
416 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
417 | i.getItem().exp()*ipower (p,l)); |
---|
418 | result= Union (result, contentXFactors); |
---|
419 | result= Union (result, contentYFactors); |
---|
420 | normalize (result); |
---|
421 | result.insert (CFFactor (LcF, 1)); |
---|
422 | return result; |
---|
423 | } |
---|
424 | else |
---|
425 | { |
---|
426 | buf= biFactorize (sqrfP, info); |
---|
427 | A= F/LcF; |
---|
428 | result= multiplicity (A, buf); |
---|
429 | for (CFFListIterator i= result; i.hasItem(); i++) |
---|
430 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
431 | i.getItem().exp()); |
---|
432 | } |
---|
433 | if (degree (A) > 0) |
---|
434 | { |
---|
435 | resultRoot= GFBiFactorize (A); |
---|
436 | resultRoot.removeFirst(); |
---|
437 | for (CFFListIterator i= resultRoot; i.hasItem(); i++) |
---|
438 | i.getItem()= CFFactor (N (decompress (i.getItem().factor(), M, S)), |
---|
439 | i.getItem().exp()); |
---|
440 | result= Union (result, resultRoot); |
---|
441 | } |
---|
442 | result= Union (result, contentXFactors); |
---|
443 | result= Union (result, contentYFactors); |
---|
444 | normalize (result); |
---|
445 | result.insert (CFFactor (LcF, 1)); |
---|
446 | return result; |
---|
447 | } |
---|
448 | |
---|
449 | #endif |
---|
450 | |
---|
451 | /// \f$ \prod_{f\in L} {f (0, x)} \ mod\ M \f$ via divide-and-conquer |
---|
452 | /// |
---|
453 | /// @return @a prodMod0 computes the above defined product |
---|
454 | /// @sa prodMod() |
---|
455 | CanonicalForm prodMod0 (const CFList& L, ///< [in] a list of compressed, |
---|
456 | ///< bivariate polynomials |
---|
457 | const CanonicalForm& M ///< [in] a power of Variable (2) |
---|
458 | ); |
---|
459 | |
---|
460 | /// find an evaluation point p, s.t. F(p,y) is squarefree and |
---|
461 | /// \f$ deg_{y} (F(p,y))= deg_{y} (F(x,y)) \f$. |
---|
462 | /// |
---|
463 | /// @return @a evalPoint returns an evaluation point, which is valid if and only |
---|
464 | /// if fail == false. |
---|
465 | CanonicalForm |
---|
466 | evalPoint (const CanonicalForm& F, ///< [in] compressed, bivariate poly |
---|
467 | CanonicalForm & eval, ///< [in,out] F (p, y) |
---|
468 | const Variable& alpha, ///< [in] algebraic variable |
---|
469 | CFList& list, ///< [in] list of points already considered |
---|
470 | const bool& GF, ///< [in] GaloisFieldDomain? |
---|
471 | bool& fail ///< [in,out] equals true, if there is no |
---|
472 | ///< valid evaluation point |
---|
473 | ); |
---|
474 | |
---|
475 | /// Univariate factorization of squarefree monic polys over finite fields via |
---|
476 | /// NTL. If the characteristic is even special GF2 routines of NTL are used. |
---|
477 | /// |
---|
478 | /// @return @a uniFactorizer returns a list of monic factors |
---|
479 | CFList |
---|
480 | uniFactorizer (const CanonicalForm& A, ///< [in] squarefree univariate poly |
---|
481 | const Variable& alpha, ///< [in] algebraic variable |
---|
482 | const bool& GF ///< [in] GaloisFieldDomain? |
---|
483 | ); |
---|
484 | |
---|
485 | /// naive factor recombination over an extension of the initial field. |
---|
486 | /// Uses precomputed data to exclude combinations that are not possible. |
---|
487 | /// |
---|
488 | /// @return @a extFactorRecombination returns a list of factors over the initial |
---|
489 | /// field, whose shift to zero is reversed. |
---|
490 | /// @sa factorRecombination(), extEarlyFactorDetection() |
---|
491 | inline CFList |
---|
492 | extFactorRecombination ( |
---|
493 | CFList& factors, ///< [in,out] list of lifted factors that are |
---|
494 | ///< monic wrt Variable (1), |
---|
495 | ///< original factors-factors found |
---|
496 | CanonicalForm& F, ///< [in,out] poly to be factored, |
---|
497 | ///< F/factors found |
---|
498 | const CanonicalForm& M, ///< [in] Variable (2)^liftBound |
---|
499 | const ExtensionInfo& info,///< [in] contains information about |
---|
500 | ///< extension |
---|
501 | DegreePattern& degs, |
---|
502 | const CanonicalForm& eval,///< [in] evaluation point |
---|
503 | int s, ///< [in] algorithm starts checking subsets |
---|
504 | ///< of size s |
---|
505 | int thres ///< [in] threshold for the size of subsets |
---|
506 | ///< which are checked, for a full factor |
---|
507 | ///< recombination choose |
---|
508 | ///< thres= factors.length()/2 |
---|
509 | ); |
---|
510 | |
---|
511 | /// naive factor recombination. |
---|
512 | /// Uses precomputed data to exclude combinations that are not possible. |
---|
513 | /// |
---|
514 | /// @return @a factorRecombination returns a list of factors of F. |
---|
515 | /// @sa extFactorRecombination(), earlyFactorDetectection() |
---|
516 | inline CFList |
---|
517 | factorRecombination ( |
---|
518 | CFList& factors, ///< [in,out] list of lifted factors |
---|
519 | ///< that are monic wrt Variable (1) |
---|
520 | CanonicalForm& F, ///< [in,out] poly to be factored |
---|
521 | const CanonicalForm& M,///< [in] Variable (2)^liftBound |
---|
522 | DegreePattern& degs, ///< [in] degree pattern |
---|
523 | int s, ///< [in] algorithm starts checking |
---|
524 | ///< subsets of size s |
---|
525 | int thres ///< [in] threshold for the size of |
---|
526 | ///< subsets which are checked, for a |
---|
527 | ///< full factor recombination choose |
---|
528 | ///< thres= factors.length()/2 |
---|
529 | ); |
---|
530 | |
---|
531 | /// chooses a field extension. |
---|
532 | /// |
---|
533 | /// @return @a chooseExtension returns an extension specified by @a beta of |
---|
534 | /// appropiate size |
---|
535 | Variable chooseExtension ( |
---|
536 | const Variable & alpha, ///< [in] some algebraic variable |
---|
537 | const Variable & beta, ///< [in] some algebraic variable |
---|
538 | int k ///< [in] some int |
---|
539 | ); |
---|
540 | |
---|
541 | /// detects factors of @a F at stage @a deg of Hensel lifting. |
---|
542 | /// No combinations of more than one factor are tested. Lift bound and possible |
---|
543 | /// degree pattern are updated. |
---|
544 | /// |
---|
545 | /// @return @a earlyFactorDetection returns a list of factors of F (possibly in- |
---|
546 | /// complete), in case of success. Otherwise an empty list. |
---|
547 | /// @sa factorRecombination(), extEarlyFactorDetection() |
---|
548 | inline CFList |
---|
549 | earlyFactorDetection ( |
---|
550 | CanonicalForm& F, ///< [in,out] poly to be factored, returns |
---|
551 | ///< poly divided by detected factors in case |
---|
552 | ///< of success |
---|
553 | CFList& factors, ///< [in,out] list of factors lifted up to |
---|
554 | ///< @a deg, returns a list of factors |
---|
555 | ///< without detected factors |
---|
556 | int& adaptedLiftBound, ///< [in,out] adapted lift bound |
---|
557 | DegreePattern& degs, ///< [in,out] degree pattern, is updated |
---|
558 | ///< whenever we find a factor |
---|
559 | bool& success, ///< [in,out] indicating success |
---|
560 | int deg ///< [in] stage of Hensel lifting |
---|
561 | ); |
---|
562 | |
---|
563 | /// detects factors of @a F at stage @a deg of Hensel lifting. |
---|
564 | /// No combinations of more than one factor are tested. Lift bound and possible |
---|
565 | /// degree pattern are updated. |
---|
566 | /// |
---|
567 | /// @return @a extEarlyFactorDetection returns a list of factors of F (possibly |
---|
568 | /// incomplete), whose shift to zero is reversed, in case of success. |
---|
569 | /// Otherwise an empty list. |
---|
570 | /// @sa factorRecombination(), earlyFactorDetection() |
---|
571 | inline CFList |
---|
572 | extEarlyFactorDetection ( |
---|
573 | CanonicalForm& F, ///< [in,out] poly to be factored, returns |
---|
574 | ///< poly divided by detected factors in case |
---|
575 | ///< of success |
---|
576 | CFList& factors, ///< [in,out] list of factors lifted up to |
---|
577 | ///< @a deg, returns a list of factors |
---|
578 | ///< without detected factors |
---|
579 | int& adaptedLiftBound, ///< [in,out] adapted lift bound |
---|
580 | DegreePattern& degs, ///< [in,out] degree pattern, is updated |
---|
581 | ///< whenever we find a factor |
---|
582 | bool& success, ///< [in,out] indicating success |
---|
583 | const ExtensionInfo& info, ///< [in] information about extension |
---|
584 | const CanonicalForm& eval, ///< [in] evaluation point |
---|
585 | int deg ///< [in] stage of Hensel lifting |
---|
586 | ); |
---|
587 | |
---|
588 | /// hensel Lifting and early factor detection |
---|
589 | /// |
---|
590 | /// @return @a henselLiftAndEarly returns monic (wrt Variable (1)) lifted |
---|
591 | /// factors without factors which have been detected at an early stage |
---|
592 | /// of Hensel lifting |
---|
593 | /// @sa earlyFactorDetection(), extEarlyFactorDetection() |
---|
594 | |
---|
595 | inline CFList |
---|
596 | henselLiftAndEarly ( |
---|
597 | CanonicalForm& A, ///< [in,out] poly to be factored, |
---|
598 | ///< returns poly divided by detected factors |
---|
599 | ///< in case of success |
---|
600 | bool& earlySuccess, ///< [in,out] indicating success |
---|
601 | CFList& earlyFactors, ///< [in,out] list of factors detected |
---|
602 | ///< at early stage of Hensel lifting |
---|
603 | DegreePattern& degs, ///< [in,out] degree pattern |
---|
604 | int& liftBound, ///< [in,out] (adapted) lift bound |
---|
605 | const CFList& uniFactors, ///< [in] univariate factors |
---|
606 | const ExtensionInfo& info, ///< [in] information about extension |
---|
607 | const CanonicalForm& eval ///< [in] evaluation point |
---|
608 | ); |
---|
609 | |
---|
610 | /// Factorization over an extension of initial field |
---|
611 | /// |
---|
612 | /// @return @a extBiFactorize returns factorization of F over initial field |
---|
613 | /// @sa biFactorize() |
---|
614 | inline CFList |
---|
615 | extBiFactorize (const CanonicalForm& F, ///< [in] poly to be factored |
---|
616 | const ExtensionInfo& info ///< [in] info about extension |
---|
617 | ); |
---|
618 | |
---|
619 | |
---|
620 | #endif |
---|
621 | /* FAC_FQ_BIVAR_H */ |
---|
622 | |
---|