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