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 "cf_assert.h" |
---|
20 | #include "cf_factory.h" |
---|
21 | |
---|
22 | |
---|
23 | /// squarefree factorization over a finite field |
---|
24 | /// @a return a list of squarefree factors with multiplicity |
---|
25 | CFFList |
---|
26 | squarefreeFactorization |
---|
27 | (const CanonicalForm & F, ///<[in] a poly |
---|
28 | const Variable & alpha ///<[in] either an algebraic variable, |
---|
29 | ///< i.e. we are over some F_p (alpha) |
---|
30 | ///< or a variable of level 1, i.e. |
---|
31 | ///< we are F_p or GF |
---|
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 |
---|
39 | CFFList FpSqrf (const CanonicalForm& F ///< [in] a poly |
---|
40 | ) |
---|
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; |
---|
60 | } |
---|
61 | |
---|
62 | /// squarefree factorization over GF. |
---|
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 |
---|
68 | ) |
---|
69 | { |
---|
70 | ASSERT (CFFactory::gettype() == GaloisFieldDomain, |
---|
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 | |
---|
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. |
---|
80 | /// |
---|
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 |
---|
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 |
---|
93 | /// @sa pthRoot() |
---|
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 |
---|
98 | ///< a p^l-th power |
---|
99 | ); |
---|
100 | |
---|
101 | #endif |
---|
102 | /* FAC_FQ_SQUAREFREE_H */ |
---|
103 | |
---|