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