1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facFqSquarefree.h |
---|
5 | * |
---|
6 | * This file provides functions for squarefrees factorizing over |
---|
7 | * \f$ F_{p} \f$ , \f$ F_{p}(\alpha ) \f$ or GF. |
---|
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 |
---|
24 | CFFList |
---|
25 | squarefreeFactorization |
---|
26 | (const CanonicalForm & F, ///<[in] a poly |
---|
27 | const Variable & alpha ///<[in] either an algebraic variable, |
---|
28 | ///< i.e. we are over some F_p (alpha) |
---|
29 | ///< or a variable of level 1, i.e. |
---|
30 | ///< we are F_p or GF |
---|
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 |
---|
38 | CFFList FpSqrf (const CanonicalForm& F ///< [in] a poly |
---|
39 | ) |
---|
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; |
---|
59 | } |
---|
60 | |
---|
61 | /// squarefree factorization over GF. |
---|
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 |
---|
67 | ) |
---|
68 | { |
---|
69 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
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 | |
---|
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. |
---|
79 | /// |
---|
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 |
---|
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 |
---|
92 | /// @sa pthRoot() |
---|
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 |
---|
97 | ///< a p^l-th power |
---|
98 | ); |
---|
99 | |
---|
100 | #endif |
---|
101 | /* FAC_FQ_SQUAREFREE_H */ |
---|
102 | |
---|