[ab547e2] | 1 | /*****************************************************************************\ |
---|
| 2 | * Computer Algebra System SINGULAR |
---|
| 3 | \*****************************************************************************/ |
---|
| 4 | /** @file facFactorize.h |
---|
| 5 | * |
---|
| 6 | * multivariate factorization over Q(a) |
---|
| 7 | * |
---|
| 8 | * @author Martin Lee |
---|
| 9 | * |
---|
| 10 | * @internal @version \$Id$ |
---|
| 11 | * |
---|
| 12 | **/ |
---|
| 13 | /*****************************************************************************/ |
---|
| 14 | |
---|
| 15 | #ifndef FAC_FACTORIZE_H |
---|
| 16 | #define FAC_FACTORIZE_H |
---|
| 17 | |
---|
| 18 | #include <config.h> |
---|
| 19 | |
---|
| 20 | #include "facBivar.h" |
---|
| 21 | #include "facFqBivarUtil.h" |
---|
| 22 | |
---|
| 23 | /// Factorization over Q (a) |
---|
| 24 | /// |
---|
| 25 | /// @return @a multiFactorize returns a factorization of F |
---|
| 26 | CFList |
---|
| 27 | multiFactorize (const CanonicalForm& F, ///< [in] poly to be factored |
---|
| 28 | const Variable& v ///< [in] some algebraic variable |
---|
| 29 | ); |
---|
| 30 | |
---|
| 31 | /// factorize a squarefree multivariate polynomial over \f$ Q(\alpha) \f$ |
---|
| 32 | /// |
---|
| 33 | /// @return @a ratSqrfFactorize returns a list of monic factors, the first |
---|
| 34 | /// element is the leading coefficient. |
---|
| 35 | inline |
---|
| 36 | CFList ratSqrfFactorize (const CanonicalForm & F, ///< [in] a multivariate poly |
---|
| 37 | const Variable& v |
---|
| 38 | ) |
---|
| 39 | { |
---|
| 40 | if (getNumVars (F) == 2) |
---|
| 41 | return ratBiSqrfFactorize (F, v); |
---|
| 42 | CFList result= multiFactorize (F, v); |
---|
| 43 | if (isOn (SW_RATIONAL)) |
---|
| 44 | { |
---|
| 45 | normalize (result); |
---|
| 46 | result.insert (Lc(F)); |
---|
| 47 | } |
---|
| 48 | return result; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | /// factorize a multivariate polynomial over \f$ Q(\alpha) \f$ |
---|
| 52 | /// |
---|
| 53 | /// @return @a ratFactorize returns a list of monic factors with |
---|
| 54 | /// multiplicity, the first element is the leading coefficient. |
---|
| 55 | inline |
---|
| 56 | CFFList ratFactorize (const CanonicalForm& F, ///< [in] a multivariate poly |
---|
| 57 | const Variable& v |
---|
| 58 | ) |
---|
| 59 | { |
---|
| 60 | if (getNumVars (F) == 2) |
---|
| 61 | { |
---|
| 62 | CFFList result= ratBiFactorize (F,v); |
---|
| 63 | return result; |
---|
| 64 | } |
---|
| 65 | Variable a= Variable (1); |
---|
| 66 | CanonicalForm LcF= Lc (F); |
---|
| 67 | |
---|
| 68 | CanonicalForm sqrfP= sqrfPart (F); |
---|
| 69 | CFList buf; |
---|
| 70 | CFFList result; |
---|
| 71 | buf= multiFactorize (sqrfP, v); |
---|
| 72 | CanonicalForm G= F; |
---|
| 73 | result= multiplicity (G, buf); |
---|
| 74 | if (isOn (SW_RATIONAL)) |
---|
| 75 | { |
---|
| 76 | normalize (result); |
---|
| 77 | result.insert (CFFactor (LcF, 1)); |
---|
| 78 | } |
---|
| 79 | return result; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | #endif |
---|
| 83 | |
---|