[24b338] | 1 | /*****************************************************************************\ |
---|
[806c18] | 2 | * Computer Algebra System SINGULAR |
---|
[24b338] | 3 | \*****************************************************************************/ |
---|
| 4 | /** @file facFqSquarefree.h |
---|
[806c18] | 5 | * |
---|
[24b338] | 6 | * This file provides functions for squarefrees factorizing over |
---|
[806c18] | 7 | * \f$ F_{p} \f$ , \f$ F_{p}(\alpha ) \f$ or GF. |
---|
[24b338] | 8 | * |
---|
| 9 | * @author Martin Lee |
---|
| 10 | * |
---|
| 11 | * @internal @version \$Id$ |
---|
| 12 | * |
---|
| 13 | **/ |
---|
| 14 | /*****************************************************************************/ |
---|
| 15 | |
---|
| 16 | #ifndef FAC_FQ_SQUAREFREE_H |
---|
| 17 | #define FAC_FQ_SQUAREFREE_H |
---|
| 18 | |
---|
| 19 | #include "assert.h" |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | /// squarefree factorization over a finite field |
---|
| 23 | /// @a return a list of squarefree factors with multiplicity |
---|
[806c18] | 24 | CFFList |
---|
| 25 | squarefreeFactorization |
---|
[24b338] | 26 | (const CanonicalForm & F, ///<[in] a poly |
---|
[806c18] | 27 | const Variable & alpha ///<[in] either an algebraic variable, |
---|
[24b338] | 28 | ///< i.e. we are over some F_p (alpha) |
---|
| 29 | ///< or a variable of level 1, i.e. |
---|
[806c18] | 30 | ///< we are F_p or GF |
---|
[24b338] | 31 | ); |
---|
| 32 | |
---|
| 33 | /// squarefree factorization over \f$ F_{p} \f$. |
---|
| 34 | /// If input is not monic, the leading coefficient is dropped |
---|
| 35 | /// |
---|
| 36 | /// @return a list of squarefree factors with multiplicity |
---|
| 37 | inline |
---|
[806c18] | 38 | CFFList FpSqrf (const CanonicalForm& F ///< [in] a poly |
---|
| 39 | ) |
---|
[24b338] | 40 | { |
---|
| 41 | Variable a= 1; |
---|
| 42 | CFFList result= squarefreeFactorization (F, a); |
---|
| 43 | result.insert (CFFactor (Lc(F), 1)); |
---|
| 44 | return result; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | /// squarefree factorization over \f$ F_{p}(\alpha ) \f$. |
---|
| 48 | /// If input is not monic, the leading coefficient is dropped |
---|
| 49 | /// |
---|
| 50 | /// @return a list of squarefree factors with multiplicity |
---|
| 51 | inline |
---|
| 52 | CFFList FqSqrf (const CanonicalForm& F, ///< [in] a poly |
---|
| 53 | const Variable& alpha ///< [in] algebraic variable |
---|
| 54 | ) |
---|
| 55 | { |
---|
| 56 | CFFList result= squarefreeFactorization (F, alpha); |
---|
| 57 | result.insert (CFFactor (Lc(F), 1)); |
---|
| 58 | return result; |
---|
[806c18] | 59 | } |
---|
[24b338] | 60 | |
---|
[806c18] | 61 | /// squarefree factorization over GF. |
---|
[24b338] | 62 | /// If input is not monic, the leading coefficient is dropped |
---|
| 63 | /// |
---|
| 64 | /// @return a list of squarefree factors with multiplicity |
---|
| 65 | inline |
---|
| 66 | CFFList GFSqrf (const CanonicalForm& F ///< [in] a poly |
---|
[806c18] | 67 | ) |
---|
[24b338] | 68 | { |
---|
[806c18] | 69 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
[24b338] | 70 | "GF as base field expected"); |
---|
| 71 | Variable a= 1; |
---|
| 72 | CFFList result= squarefreeFactorization (F, a); |
---|
| 73 | result.insert (CFFactor (Lc(F), 1)); |
---|
| 74 | return result; |
---|
| 75 | } |
---|
| 76 | |
---|
[806c18] | 77 | /// squarefree part of @a F/g, where g is the product of those squarefree |
---|
| 78 | /// factors whose multiplicity is 0 mod p, if @a F a pth power pthPower= F. |
---|
[24b338] | 79 | /// |
---|
[806c18] | 80 | /// @return @a sqrfPart returns 1, if F is a pthPower, else it returns the |
---|
| 81 | /// squarefree part of @a F/g, where g is the product of those |
---|
| 82 | /// squarefree factors whose multiplicity is 0 mod p |
---|
| 83 | CanonicalForm |
---|
| 84 | sqrfPart (const CanonicalForm& F, ///< [in] a poly |
---|
| 85 | CanonicalForm& pthPower, ///< [in,out] returns F is F is a pthPower |
---|
[24b338] | 86 | const Variable& alpha ///< [in] algebraic variable |
---|
| 87 | ); |
---|
| 88 | |
---|
| 89 | /// p^l-th root extraction, where l is maximal |
---|
| 90 | /// |
---|
| 91 | /// @return @a maxpthRoot returns a p^l-th root of @a F, where @a l is maximal |
---|
[806c18] | 92 | /// @sa pthRoot() |
---|
[24b338] | 93 | CanonicalForm |
---|
| 94 | maxpthRoot (const CanonicalForm & F, ///< [in] a poly which is a pth power |
---|
| 95 | const int & q, ///< [in] size of the field |
---|
| 96 | int& l ///< [in,out] @a l maximal, s.t. @a F is |
---|
[806c18] | 97 | ///< a p^l-th power |
---|
[24b338] | 98 | ); |
---|
| 99 | |
---|
| 100 | #endif |
---|
| 101 | /* FAC_FQ_SQUAREFREE_H */ |
---|
| 102 | |
---|