1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facAbsFact.h |
---|
5 | * |
---|
6 | * bivariate absolute factorization over Q described in "Modular Las Vegas |
---|
7 | * Algorithms for Polynomial Absolute Factorization" by Bertone, ChÚze, Galligo |
---|
8 | * |
---|
9 | * @author Martin Lee |
---|
10 | * |
---|
11 | **/ |
---|
12 | /*****************************************************************************/ |
---|
13 | |
---|
14 | #ifndef FAC_ABS_FACT_H |
---|
15 | #define FAC_ABS_FACT_H |
---|
16 | |
---|
17 | #include "cf_assert.h" |
---|
18 | |
---|
19 | #include "cf_algorithm.h" |
---|
20 | #include "cf_map.h" |
---|
21 | |
---|
22 | #ifdef HAVE_NTL |
---|
23 | /// main absolute factorization routine, expects bivariate poly which is |
---|
24 | /// primitive wrt. any of its variables and irreducible over Q |
---|
25 | /// |
---|
26 | /// @return absFactorizeMain returns a list whose entries contain three entities: |
---|
27 | /// an absolute irreducible factor, an irreducible univariate polynomial |
---|
28 | /// that defines the minimal field extension over which the irreducible |
---|
29 | /// factor is defined and the multiplicity of the absolute irreducible |
---|
30 | /// factor |
---|
31 | CFAFList absFactorizeMain (const CanonicalForm& F ///<[in] s.a. |
---|
32 | ); |
---|
33 | #endif |
---|
34 | |
---|
35 | /// normalize factors, i.e. make factors monic |
---|
36 | static inline |
---|
37 | void normalize (CFAFList & L) |
---|
38 | { |
---|
39 | for (CFAFListIterator i= L; i.hasItem(); i++) |
---|
40 | i.getItem()= CFAFactor (i.getItem().factor()/Lc (i.getItem().factor()), |
---|
41 | i.getItem().minpoly(), i.getItem().exp()); |
---|
42 | } |
---|
43 | |
---|
44 | /// univariate absolute factorization over Q |
---|
45 | /// |
---|
46 | /// @return uniAbsFactorize returns a list whose entries contain three entities: |
---|
47 | /// an absolute irreducible factor, an irreducible univariate polynomial |
---|
48 | /// that defines the minimal field extension over which the irreducible |
---|
49 | /// factor is defined and the multiplicity of the absolute irreducible |
---|
50 | /// factor |
---|
51 | static inline |
---|
52 | CFAFList uniAbsFactorize (const CanonicalForm& F ///<[in] univariate poly over Q |
---|
53 | ) |
---|
54 | { |
---|
55 | CFFList rationalFactors= factorize (F); |
---|
56 | CFFListIterator i= rationalFactors; |
---|
57 | i++; |
---|
58 | Variable alpha; |
---|
59 | CFAFList result; |
---|
60 | CFFList QaFactors; |
---|
61 | CFFListIterator iter; |
---|
62 | for (; i.hasItem(); i++) |
---|
63 | { |
---|
64 | if (degree (i.getItem().factor()) == 1) |
---|
65 | { |
---|
66 | result.append (CFAFactor (i.getItem().factor(), 1, i.getItem().exp())); |
---|
67 | continue; |
---|
68 | } |
---|
69 | alpha= rootOf (i.getItem().factor()); |
---|
70 | QaFactors= factorize (i.getItem().factor(), alpha); |
---|
71 | iter= QaFactors; |
---|
72 | if (iter.getItem().factor().inCoeffDomain()) |
---|
73 | iter++; |
---|
74 | for (;iter.hasItem(); iter++) |
---|
75 | { |
---|
76 | if (degree (iter.getItem().factor()) == 1) |
---|
77 | { |
---|
78 | result.append (CFAFactor (iter.getItem().factor(), getMipo (alpha), |
---|
79 | i.getItem().exp())); |
---|
80 | break; |
---|
81 | } |
---|
82 | } |
---|
83 | } |
---|
84 | result.insert (CFAFactor (rationalFactors.getFirst().factor(), 1, 1)); |
---|
85 | return result; |
---|
86 | } |
---|
87 | |
---|
88 | /*BEGINPUBLIC*/ |
---|
89 | |
---|
90 | #ifdef HAVE_NTL |
---|
91 | CFAFList absFactorize (const CanonicalForm& G); |
---|
92 | #endif |
---|
93 | |
---|
94 | /*ENDPUBLIC*/ |
---|
95 | |
---|
96 | #endif |
---|