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 <polys/simpleideals.h> |
---|
11 | #include <kernel/polys.h> |
---|
12 | // #include <kernel/structs.h> |
---|
13 | |
---|
14 | //typedef struct sip_sideal * ideal; |
---|
15 | //typedef struct sip_smap * map; |
---|
16 | typedef ideal * resolvente; |
---|
17 | |
---|
18 | extern ideal currQuotient; |
---|
19 | |
---|
20 | |
---|
21 | inline ideal idCopyFirstK (const ideal ide, const int k, ring R = currRing) |
---|
22 | { |
---|
23 | return id_CopyFirstK(ide, k, R); |
---|
24 | } |
---|
25 | |
---|
26 | /// delete an ideal |
---|
27 | inline void idDelete (ideal* h, ring r = currRing) |
---|
28 | { |
---|
29 | id_Delete(h, r); |
---|
30 | } |
---|
31 | |
---|
32 | /// initialise the maximal ideal (at 0) |
---|
33 | //ideal id_MaxIdeal(int deg, const ring r); |
---|
34 | #define idMaxIdeal(D) id_MaxIdeal(D,currRing) |
---|
35 | |
---|
36 | /// index of generator with leading term in ground ring (if any); otherwise -1 |
---|
37 | //int id_PosConstant(ideal id, const ring r) |
---|
38 | #define idPosConstant(I) id_PosConstant(I,currRing) |
---|
39 | |
---|
40 | /// Count the effective size of an ideal |
---|
41 | /// (without the trailing allocated zero-elements) |
---|
42 | static inline int idSize(const ideal id) |
---|
43 | { |
---|
44 | int j = IDELEMS(id) - 1; |
---|
45 | poly* mm = id->m; |
---|
46 | while ((j >= 0) && (mm[j] == NULL)) j--; |
---|
47 | return (j + 1); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | //BOOLEAN id_IsConstant(ideal id, const ring r); |
---|
52 | #define idIsConstant(I) id_IsConstant(I,currRing) |
---|
53 | |
---|
54 | #define idSimpleAdd(A,B) id_SimpleAdd(A,B,currRing) |
---|
55 | |
---|
56 | #ifdef PDEBUG |
---|
57 | #define idTest(A) id_DBTest(A, PDEBUG, __FILE__,__LINE__,currRing) |
---|
58 | #define idPrint(id) idShow(id, currRing, currRing) |
---|
59 | #else |
---|
60 | #define idTest(A) (TRUE) |
---|
61 | #define idPrint(A) ((void)0) |
---|
62 | #endif |
---|
63 | |
---|
64 | ideal id_Copy (ideal h1, const ring r); |
---|
65 | |
---|
66 | #if 0 |
---|
67 | |
---|
68 | // ifdef PDEBUG // Sorry: the following was lost........ :(((((((( |
---|
69 | ideal idDBCopy(ideal h1,const char *f,int l,const ring r); |
---|
70 | #define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r) |
---|
71 | |
---|
72 | inline ideal idCopy(ideal A, const ring R = currRing) |
---|
73 | { |
---|
74 | return id_DBCopy(A,R); // well, just for now... ok? Macros can't have default args values :( |
---|
75 | } |
---|
76 | #else |
---|
77 | inline ideal idCopy(ideal A, const ring R = currRing) |
---|
78 | { |
---|
79 | return id_Copy(A, R); |
---|
80 | } |
---|
81 | #endif |
---|
82 | |
---|
83 | |
---|
84 | /// h1 + h2 |
---|
85 | inline ideal idAdd (ideal h1, ideal h2, const ring R = currRing) |
---|
86 | { |
---|
87 | return id_Add(h1, h2, R); |
---|
88 | } |
---|
89 | |
---|
90 | BOOLEAN idInsertPoly (ideal h1,poly h2); /* h1 + h2 */ |
---|
91 | inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring R = currRing) |
---|
92 | { |
---|
93 | return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, R); |
---|
94 | } |
---|
95 | |
---|
96 | |
---|
97 | /* h1 + h2 */ |
---|
98 | |
---|
99 | /// hh := h1 * h2 |
---|
100 | inline ideal idMult (ideal h1, ideal h2, const ring R = currRing) |
---|
101 | { |
---|
102 | return id_Mult(h1, h2, R); |
---|
103 | } |
---|
104 | |
---|
105 | BOOLEAN idIs0 (ideal h); |
---|
106 | |
---|
107 | // returns TRUE, if idRankFreeModule(m) > 0 |
---|
108 | BOOLEAN idIsModule(ideal m, const ring r); |
---|
109 | |
---|
110 | inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL, const ring R = currRing) |
---|
111 | { |
---|
112 | return id_HomIdeal(id, Q, R); |
---|
113 | } |
---|
114 | |
---|
115 | inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w, const ring R = currRing) |
---|
116 | { |
---|
117 | return id_HomModule(m, Q, w, R); |
---|
118 | } |
---|
119 | |
---|
120 | BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w); |
---|
121 | |
---|
122 | ideal idMinBase (ideal h1); |
---|
123 | /*returns a minimized set of generators of h1*/ |
---|
124 | void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise); |
---|
125 | void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise); |
---|
126 | int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise); |
---|
127 | |
---|
128 | int binom (int n,int r); |
---|
129 | |
---|
130 | inline ideal idFreeModule (int i, const ring R = currRing) |
---|
131 | { |
---|
132 | return id_FreeModule (i, R); |
---|
133 | } |
---|
134 | |
---|
135 | |
---|
136 | |
---|
137 | |
---|
138 | ideal idSect (ideal h1,ideal h2); |
---|
139 | ideal idMultSect(resolvente arg, int length); |
---|
140 | |
---|
141 | //ideal idSyzygies (ideal h1, tHomog h,intvec **w); |
---|
142 | ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE, |
---|
143 | BOOLEAN setRegularity=FALSE, int *deg = NULL); |
---|
144 | ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL); |
---|
145 | |
---|
146 | ideal idLift (ideal mod, ideal sumod,ideal * rest=NULL, |
---|
147 | BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE, |
---|
148 | matrix *unit=NULL); |
---|
149 | |
---|
150 | void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL ); |
---|
151 | |
---|
152 | intvec * idMWLift(ideal mod,intvec * weights); |
---|
153 | |
---|
154 | ideal idQuot (ideal h1,ideal h2, |
---|
155 | BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE); |
---|
156 | |
---|
157 | // ideal idPower(ideal gid,int deg); |
---|
158 | |
---|
159 | //ideal idElimination (ideal h1,poly delVar); |
---|
160 | ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL); |
---|
161 | |
---|
162 | poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL); |
---|
163 | ideal idMinors(matrix a, int ar, ideal R = NULL); |
---|
164 | |
---|
165 | ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL); |
---|
166 | |
---|
167 | ideal idHead(ideal h); |
---|
168 | |
---|
169 | // ideal idHomogen(ideal h, int varnum); |
---|
170 | |
---|
171 | BOOLEAN idIsSubModule(ideal id1,ideal id2); |
---|
172 | |
---|
173 | inline ideal idVec2Ideal(poly vec, const ring R = currRing) |
---|
174 | { |
---|
175 | return id_Vec2Ideal(vec, R); |
---|
176 | } |
---|
177 | |
---|
178 | inline ideal idMatrix2Module(matrix mat, const ring R = currRing) |
---|
179 | { |
---|
180 | return idMatrix2Module(mat, R); |
---|
181 | } |
---|
182 | |
---|
183 | inline matrix idModule2Matrix(ideal mod, const ring R = currRing) |
---|
184 | { |
---|
185 | return id_Module2Matrix(mod, R); |
---|
186 | } |
---|
187 | inline matrix idModule2formatedMatrix(ideal mod, int rows, int cols, const ring R = currRing) |
---|
188 | { |
---|
189 | return id_Module2formatedMatrix(mod, rows, cols, R); |
---|
190 | } |
---|
191 | |
---|
192 | // ideal idSubst(ideal i, int n, poly e); |
---|
193 | |
---|
194 | inline ideal idJet(ideal i, int d, const ring R = currRing) |
---|
195 | { |
---|
196 | return id_Jet(i, d, R); |
---|
197 | } |
---|
198 | |
---|
199 | inline ideal idJetW(ideal i,int d, intvec * iv, const ring R = currRing) |
---|
200 | { |
---|
201 | return id_JetW(i, d, iv, R); |
---|
202 | } |
---|
203 | ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL); |
---|
204 | |
---|
205 | inline BOOLEAN idIsZeroDim(ideal i, const ring R = currRing) |
---|
206 | { |
---|
207 | return idIsZeroDim(i, R); |
---|
208 | } |
---|
209 | |
---|
210 | matrix idDiff(matrix i, int k); |
---|
211 | matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE); |
---|
212 | |
---|
213 | inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE, const ring R = currRing) |
---|
214 | { |
---|
215 | return id_Sort(id, nolex, R); |
---|
216 | } |
---|
217 | |
---|
218 | ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL); |
---|
219 | matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how); |
---|
220 | |
---|
221 | /// transpose a module |
---|
222 | inline ideal idTransp(ideal a, const ring R = currRing) |
---|
223 | { |
---|
224 | return id_Transp(a, R); |
---|
225 | } |
---|
226 | |
---|
227 | // intvec *idQHomWeight(ideal id); |
---|
228 | |
---|
229 | ideal idXXX (ideal h1, int k); |
---|
230 | |
---|
231 | poly id_GCD(poly f, poly g, const ring r); |
---|
232 | |
---|
233 | ideal id_ChineseRemainder(ideal *x, number *q, int rl, const ring R); |
---|
234 | //ideal idChineseRemainder(ideal *x, intvec *iv); /* currently unused */ |
---|
235 | ideal id_Farey(ideal x, number N, const ring r); |
---|
236 | |
---|
237 | ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG |
---|
238 | |
---|
239 | |
---|
240 | #endif |
---|