1 | #ifndef IDEALS_H |
---|
2 | #define IDEALS_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id$ */ |
---|
7 | /* |
---|
8 | * ABSTRACT - all basic methods to manipulate ideals |
---|
9 | */ |
---|
10 | #include <kernel/structs.h> |
---|
11 | #include <kernel/ring.h> |
---|
12 | |
---|
13 | struct sip_sideal |
---|
14 | { |
---|
15 | poly* m; |
---|
16 | long rank; |
---|
17 | int nrows; |
---|
18 | int ncols; |
---|
19 | #define IDELEMS(i) ((i)->ncols) |
---|
20 | }; |
---|
21 | |
---|
22 | struct sip_smap |
---|
23 | { |
---|
24 | poly *m; |
---|
25 | char *preimage; |
---|
26 | int nrows; |
---|
27 | int ncols; |
---|
28 | }; |
---|
29 | |
---|
30 | struct sideal_list; |
---|
31 | typedef struct sideal_list * ideal_list; |
---|
32 | struct sideal_list |
---|
33 | { |
---|
34 | ideal_list next; |
---|
35 | ideal d; |
---|
36 | #ifndef NDEBUG |
---|
37 | int nr; |
---|
38 | #endif |
---|
39 | }; |
---|
40 | |
---|
41 | //typedef struct sip_sideal * ideal; |
---|
42 | //typedef struct sip_smap * map; |
---|
43 | typedef ideal * resolvente; |
---|
44 | |
---|
45 | |
---|
46 | extern omBin sip_sideal_bin; |
---|
47 | |
---|
48 | /*- creates an ideal -*/ |
---|
49 | ideal idInit (int size, int rank=1); |
---|
50 | ideal idCopyFirstK (const ideal ide, const int k); |
---|
51 | |
---|
52 | /// delete an ideal |
---|
53 | #define idDelete(h) id_Delete(h, currRing) |
---|
54 | void id_Delete (ideal* h, ring r); |
---|
55 | void id_ShallowDelete (ideal* h, ring r); |
---|
56 | /*- initialise an ideal -*/ // ? |
---|
57 | |
---|
58 | /// initialise the maximal ideal (at 0) |
---|
59 | ideal idMaxIdeal (int deg); |
---|
60 | |
---|
61 | /// gives an ideal the minimal possible size |
---|
62 | void idSkipZeroes (ideal ide); |
---|
63 | |
---|
64 | /// index of generator with leading term in ground ring (if any); otherwise -1 |
---|
65 | int idPosConstant (ideal id); |
---|
66 | |
---|
67 | /// Count the effective size of an ideal |
---|
68 | /// (without the trailing allocated zero-elements) |
---|
69 | static inline int idSize(const ideal id) |
---|
70 | { |
---|
71 | int j = IDELEMS(id) - 1; |
---|
72 | poly* mm = id->m; |
---|
73 | while ((j >= 0) && (mm[j] == NULL)) j--; |
---|
74 | return (j + 1); |
---|
75 | } |
---|
76 | |
---|
77 | void idNorm(ideal id); |
---|
78 | void idDelMultiples(ideal id); |
---|
79 | void idDelEquals(ideal id); |
---|
80 | void idDelLmEquals(ideal id); |
---|
81 | void idDelDiv(ideal id); |
---|
82 | BOOLEAN idIsConstant(ideal id); |
---|
83 | |
---|
84 | #ifdef PDEBUG |
---|
85 | void idDBTest(ideal h1, int level, const char *f,const int l); |
---|
86 | #define idTest(A) idDBTest(A, PDEBUG, __FILE__,__LINE__) |
---|
87 | #define idPrint(id) idShow(id) |
---|
88 | #else |
---|
89 | #define idTest(A) (TRUE) |
---|
90 | #define idPrint(A) ((void)0) |
---|
91 | #endif |
---|
92 | |
---|
93 | ideal id_Copy (ideal h1,const ring r); |
---|
94 | #define idCopy(A) id_Copy(A,currRing) |
---|
95 | /*adds two ideals without simplifying the result*/ |
---|
96 | ideal idSimpleAdd (ideal h1,ideal h2); |
---|
97 | /*adds the quotient ideal*/ |
---|
98 | ideal idAdd (ideal h1,ideal h2); |
---|
99 | /* h1 + h2 */ |
---|
100 | BOOLEAN idInsertPoly (ideal h1,poly h2); |
---|
101 | /* h1 + h2 */ |
---|
102 | BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, |
---|
103 | const poly h2, const bool zeroOk, const bool duplicateOk); |
---|
104 | /* h1 + h2 */ |
---|
105 | ideal idMult (ideal h1,ideal h2); |
---|
106 | /*hh := h1 * h2*/ |
---|
107 | |
---|
108 | BOOLEAN idIs0 (ideal h); |
---|
109 | |
---|
110 | long idRankFreeModule(ideal m, ring lmRing, ring tailRing); |
---|
111 | inline long idRankFreeModule(ideal m, ring r = currRing) |
---|
112 | {return idRankFreeModule(m, r, r);} |
---|
113 | // returns TRUE, if idRankFreeModule(m) > 0 |
---|
114 | BOOLEAN idIsModule(ideal m, ring r = currRing); |
---|
115 | BOOLEAN idHomIdeal (ideal id, ideal Q=NULL); |
---|
116 | BOOLEAN idHomModule(ideal m, ideal Q,intvec **w); |
---|
117 | BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w); |
---|
118 | |
---|
119 | ideal idMinBase (ideal h1); |
---|
120 | /*returns a minimized set of generators of h1*/ |
---|
121 | int pLowVar (poly p); |
---|
122 | /*-the minimal index of used variables - 1-*/ |
---|
123 | void pShift (poly * p,int i); |
---|
124 | /*- verschiebt die Indizes der Modulerzeugenden um i -*/ |
---|
125 | void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise); |
---|
126 | void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise); |
---|
127 | int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise); |
---|
128 | |
---|
129 | int binom (int n,int r); |
---|
130 | |
---|
131 | ideal idFreeModule (int i); |
---|
132 | |
---|
133 | ideal idSect (ideal h1,ideal h2); |
---|
134 | ideal idMultSect(resolvente arg, int length); |
---|
135 | |
---|
136 | //ideal idSyzygies (ideal h1, tHomog h,intvec **w); |
---|
137 | ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE, |
---|
138 | BOOLEAN setRegularity=FALSE, int *deg = NULL); |
---|
139 | ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL); |
---|
140 | |
---|
141 | ideal idLift (ideal mod, ideal sumod,ideal * rest=NULL, |
---|
142 | BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE, |
---|
143 | matrix *unit=NULL); |
---|
144 | |
---|
145 | void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL ); |
---|
146 | |
---|
147 | intvec * idMWLift(ideal mod,intvec * weights); |
---|
148 | |
---|
149 | ideal idQuot (ideal h1,ideal h2, |
---|
150 | BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE); |
---|
151 | |
---|
152 | ideal idPower(ideal gid,int deg); |
---|
153 | |
---|
154 | //ideal idElimination (ideal h1,poly delVar); |
---|
155 | ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL); |
---|
156 | |
---|
157 | poly idMinor(matrix a, int ar, unsigned long which, ideal R=NULL); |
---|
158 | |
---|
159 | ideal idMinors(matrix a, int ar, ideal R=NULL); |
---|
160 | |
---|
161 | void idCompactify(ideal id); |
---|
162 | |
---|
163 | ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL); |
---|
164 | |
---|
165 | ideal idHead(ideal h); |
---|
166 | |
---|
167 | ideal idHomogen(ideal h, int varnum); |
---|
168 | |
---|
169 | BOOLEAN idIsSubModule(ideal id1,ideal id2); |
---|
170 | |
---|
171 | ideal idVec2Ideal(poly vec); |
---|
172 | |
---|
173 | ideal idMatrix2Module(matrix mat); |
---|
174 | |
---|
175 | matrix idModule2Matrix(ideal mod); |
---|
176 | |
---|
177 | matrix idModule2formatedMatrix(ideal mod,int rows, int cols); |
---|
178 | |
---|
179 | ideal idSubst(ideal i, int n, poly e); |
---|
180 | |
---|
181 | ideal idJet(ideal i,int d); |
---|
182 | ideal idJetW(ideal i,int d, intvec * iv); |
---|
183 | int idMinDegW(ideal M,intvec *w); |
---|
184 | ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL); |
---|
185 | |
---|
186 | BOOLEAN idIsZeroDim(ideal i); |
---|
187 | matrix idDiff(matrix i, int k); |
---|
188 | matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE); |
---|
189 | |
---|
190 | intvec *idSort(ideal id,BOOLEAN nolex=TRUE); |
---|
191 | ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL); |
---|
192 | int idElem(const ideal F); |
---|
193 | matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how); |
---|
194 | // transpose a module |
---|
195 | ideal idTransp(ideal a); |
---|
196 | // version of "ideal idTransp(ideal)" which works within a given ring. |
---|
197 | ideal id_Transp(ideal a, const ring rRing = currRing); |
---|
198 | |
---|
199 | intvec *idQHomWeight(ideal id); |
---|
200 | |
---|
201 | void idNormalize(ideal id); |
---|
202 | |
---|
203 | ideal idXXX (ideal h1, int k); |
---|
204 | |
---|
205 | poly id_GCD(poly f, poly g, const ring r); |
---|
206 | |
---|
207 | ideal idChineseRemainder(ideal *x, number *q, int rl); |
---|
208 | //ideal idChineseRemainder(ideal *x, intvec *iv); /* currently unused */ |
---|
209 | ideal idFarey(ideal x, number N); |
---|
210 | |
---|
211 | ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing = currRing); // image of certain map for BGG |
---|
212 | |
---|
213 | #ifdef PDEBUG |
---|
214 | /* Shows an ideal -- only for debugging */ |
---|
215 | void idShow(const ideal id, const ring lmRing = currRing, const ring tailRing = currRing, const int debugPrint = 0); |
---|
216 | #else |
---|
217 | #define idShow(id, lmRing, tailRing, debugPrint) ((void)0) |
---|
218 | #endif |
---|
219 | #endif |
---|