1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file facFqBivarUtil.h |
---|
5 | * |
---|
6 | * This file provides utility functions for bivariate factorization |
---|
7 | * |
---|
8 | * @author Martin Lee |
---|
9 | * |
---|
10 | * @internal @version \$Id$ |
---|
11 | * |
---|
12 | **/ |
---|
13 | /*****************************************************************************/ |
---|
14 | |
---|
15 | #ifndef FAC_FQ_BIVAR_UTIL_H |
---|
16 | #define FAC_FQ_BIVAR_UTIL_H |
---|
17 | |
---|
18 | #include <config.h> |
---|
19 | |
---|
20 | #include "cf_map.h" |
---|
21 | #include "ExtensionInfo.h" |
---|
22 | |
---|
23 | /// append @a factors2 on @a factors1 |
---|
24 | void append (CFList& factors1, ///< [in,out] a list of polys |
---|
25 | const CFList& factors2 ///< [in] a list of polys |
---|
26 | ); |
---|
27 | |
---|
28 | /// decompress a list of polys @a factors using the map @a N |
---|
29 | void decompress (CFList& factors, ///< [in,out] a list of polys |
---|
30 | const CFMap& N ///< [in] a map |
---|
31 | ); |
---|
32 | |
---|
33 | /// first swap Variables in @a factors1 if necessary, then append @a factors2 |
---|
34 | /// and @a factors3 on @a factors1 and finally decompress @a factors1 |
---|
35 | void appendSwapDecompress (CFList& factors1, ///< [in,out] a list of polys |
---|
36 | const CFList& factors2, ///< [in] a list of polys |
---|
37 | const CFList& factors3, ///< [in] a list of polys |
---|
38 | const bool swap1, ///< [in] indicates the need |
---|
39 | ///< to swap |
---|
40 | const bool swap2, ///< [in] indicates the need |
---|
41 | ///< to swap |
---|
42 | const CFMap& N ///< [in] a map |
---|
43 | ); |
---|
44 | |
---|
45 | /// swap Variables in @a factors, then decompress @a factors |
---|
46 | void swapDecompress (CFList& factors, ///< [in,out] a list of polys |
---|
47 | const bool swap, ///< [in] indicates the need to swap |
---|
48 | const CFMap& N ///< [in] a map |
---|
49 | ); |
---|
50 | |
---|
51 | /// tests if F is not contained in a subfield defined by @a gamma (Fq case) or |
---|
52 | /// @a k (GF case) |
---|
53 | /// |
---|
54 | /// @return @a isInExtension returns true if @a F is not contained in a subfield |
---|
55 | /// defined by @a gamma (Fq case) or @a k (GF case), false else |
---|
56 | /// @sa appendTestMapDown() |
---|
57 | bool isInExtension (const CanonicalForm& F, ///< [in] a poly over |
---|
58 | ///< F_p (alpha)=Fq or GF(p^l) |
---|
59 | const CanonicalForm& gamma, ///< [in] a primitive element |
---|
60 | ///< defining a subfield of |
---|
61 | ///< Fq if we are not over some |
---|
62 | ///< GF |
---|
63 | const int k ///< some int k such that k |
---|
64 | ///< divides l if we are not |
---|
65 | ///< over some Fq |
---|
66 | ); |
---|
67 | |
---|
68 | /// map a poly into a subfield of the current field, no testing is performed! |
---|
69 | /// |
---|
70 | /// @return @a mapDown returns @a F mapped into a subfield of the current field |
---|
71 | /// @sa appendTestMapDown(), appendMapDown() |
---|
72 | CanonicalForm |
---|
73 | mapDown (const CanonicalForm& F, ///< [in] a poly |
---|
74 | const ExtensionInfo& info, ///< [in] information about the sub- and |
---|
75 | ///< current field |
---|
76 | CFList& source, ///< [in,out] in case we are over some |
---|
77 | ///< F_p (alpha) and want to map down into |
---|
78 | ///< F_p (beta) source contains powers of |
---|
79 | ///< the primitive element of F_p (alpha) |
---|
80 | CFList& dest ///< [in,out] as source but contains |
---|
81 | ///< the corresponding powers of the |
---|
82 | ///< primitive element of F_p (beta) |
---|
83 | ); |
---|
84 | |
---|
85 | /// test if @a g is in a subfield of the current field, if so map it down and |
---|
86 | /// append it to @a factors |
---|
87 | /// |
---|
88 | /// @sa mapDown(), isInExtension() |
---|
89 | void appendTestMapDown (CFList& factors, ///< [in,out] a list of polys |
---|
90 | const CanonicalForm& f, ///< [in] a poly |
---|
91 | const ExtensionInfo& info,///< [in] information about |
---|
92 | ///< extension |
---|
93 | CFList& source, ///< [in,out] @sa mapDown() |
---|
94 | CFList& dest ///< [in,out] @sa mapDown() |
---|
95 | ); |
---|
96 | |
---|
97 | /// map @a g down into a subfield of the current field and append it to @a |
---|
98 | /// factors |
---|
99 | /// |
---|
100 | /// @sa mapDown(), appendTestMapDown() |
---|
101 | void |
---|
102 | appendMapDown (CFList& factors, ///< [in,out] a list of polys |
---|
103 | const CanonicalForm& g, ///< [in] a poly |
---|
104 | const ExtensionInfo& info,///< [in] information about extension |
---|
105 | CFList& source, ///< [in,out] @sa mapDown() |
---|
106 | CFList& dest ///< [in,out] @sa mapDown() |
---|
107 | ); |
---|
108 | |
---|
109 | /// normalize factors, i.e. make factors monic |
---|
110 | void normalize (CFList& factors ///< [in,out] a list of polys |
---|
111 | ); |
---|
112 | |
---|
113 | /// extract a subset given by @a index of size @a s from @a elements, if there |
---|
114 | /// is no subset we have not yet considered noSubset is set to true. @a index |
---|
115 | /// encodes the next subset, e.g. if s= 3, elements= {a,b,c,d}, |
---|
116 | /// index= {1, 2, 4, 0}, then subset= {a,c,d}. @a index is of size |
---|
117 | /// @a elements.size(). |
---|
118 | /// |
---|
119 | /// @return @a subset returns a list of polys of length @a s if there is a |
---|
120 | /// subset we have not yet considered. |
---|
121 | CFList subset (int index [], ///< [in,out] an array encoding the next |
---|
122 | ///< subset |
---|
123 | const int& s, ///< [in] size of the subset |
---|
124 | const CFArray& elements, ///< [in] an array of polys |
---|
125 | bool& noSubset ///< [in,out] if there is no subset we |
---|
126 | ///< have not yet considered @a noSubset |
---|
127 | ///< is true |
---|
128 | ); |
---|
129 | |
---|
130 | /// write elements of @a list into an array |
---|
131 | /// |
---|
132 | /// @return an array of polys |
---|
133 | CFArray copy (const CFList& list ///< [in] a list of polys |
---|
134 | ); |
---|
135 | |
---|
136 | /// update @a index |
---|
137 | void indexUpdate (int index [], ///< [in,out] an array encoding a |
---|
138 | ///< subset of size subsetSize |
---|
139 | const int& subsetSize, ///< [in] size of the subset |
---|
140 | const int& setSize, ///< [in] size of the given set |
---|
141 | bool& noSubset ///< [in,out] if there is no subset we |
---|
142 | ///< have not yet considered @a |
---|
143 | ///< noSubset is true |
---|
144 | ); |
---|
145 | |
---|
146 | /// compute the sum of degrees in Variable(1) of elements in S |
---|
147 | /// |
---|
148 | /// @return @a subsetDegree returns the sum of degrees in Variable(1) of |
---|
149 | /// elements in S |
---|
150 | int subsetDegree (const CFList& S ///< [in] a list of polys |
---|
151 | ); |
---|
152 | |
---|
153 | /// determine multiplicity of the factors |
---|
154 | /// |
---|
155 | /// @return a list of factors of F with their multiplicity |
---|
156 | CFFList multiplicity (CanonicalForm& F, ///< [in] a poly |
---|
157 | const CFList& factors ///< [in] a list of factors of F |
---|
158 | ); |
---|
159 | |
---|
160 | #endif |
---|
161 | /* FAC_FQ_BIVAR_UTIL_H */ |
---|
162 | |
---|