1 #ifndef IDEALS_H
2 #define IDEALS_H
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 /*
7 * ABSTRACT - all basic methods to manipulate ideals
8 */
9
10 #include "polys/monomials/ring.h"
11 #include "polys/monomials/p_polys.h"
12 #include "polys/simpleideals.h"
13
14 #include "kernel/structs.h" // for tHomog
15
16 //typedef struct sip_sideal * ideal;
17 //typedef struct sip_smap * map;
18 typedef ideal * resolvente;
19
idCopyFirstK(const ideal ide,const int k)20 static inline ideal idCopyFirstK (const ideal ide, const int k)
21 {
22 return id_CopyFirstK(ide, k, currRing);
23 }
24
25 void idKeepFirstK(ideal ide, const int k);
26 void idDelEquals(ideal id);
27
28 /// delete an ideal
29 #define idDelete(H) id_Delete((H),currRing)
30
31 /// initialise the maximal ideal (at 0)
32 //ideal id_MaxIdeal(int deg, const ring r);
33 #define idMaxIdeal(D) id_MaxIdeal(D,currRing)
34
35 /// index of generator with leading term in ground ring (if any); otherwise -1
36 //int id_PosConstant(ideal id, const ring r)
37 #define idPosConstant(I) id_PosConstant(I,currRing)
38
39 //BOOLEAN id_IsConstant(ideal id, const ring r);
40 #define idIsConstant(I) id_IsConstant(I,currRing)
41
42 #define idSimpleAdd(A,B) id_SimpleAdd(A,B,currRing)
43
44 ideal id_Copy (ideal h1, const ring r);
45
46 #define idPrint(id) id_Print(id, currRing, currRing)
47 #define idTest(id) id_Test(id, currRing)
48
49 #if 0
50
51 // ifdef PDEBUG // Sorry: the following was lost........ :((((((((
52 ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
53 #define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
54
55 inline ideal idCopy(ideal A)
56 {
57 return id_DBCopy(A,currRing); // well, just for now... ok? Macros can't have default args values :(
58 }
59 #else
idCopy(ideal A)60 inline ideal idCopy(ideal A)
61 {
62 return id_Copy(A, currRing);
63 }
64 #endif
65
66
67 /// h1 + h2
idAdd(ideal h1,ideal h2)68 inline ideal idAdd (ideal h1, ideal h2)
69 {
70 return id_Add(h1, h2, currRing);
71 }
72
73 BOOLEAN idInsertPoly (ideal h1,poly h2); /* h1 + h2 */
74 BOOLEAN idInsertPolyOnPos (ideal I,poly p,int pos); /* inserts p in I on pos */
idInsertPolyWithTests(ideal h1,const int validEntries,const poly h2,const bool zeroOk,const bool duplicateOk)75 inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
76 {
77 return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);
78 }
79
80
81 /* h1 + h2 */
82
83 /// hh := h1 * h2
idMult(ideal h1,ideal h2)84 static inline ideal idMult (ideal h1, ideal h2)
85 {
86 return id_Mult(h1, h2, currRing);
87 }
88
89 BOOLEAN idIs0 (ideal h);
90
91 static inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
92 {
93 return id_HomIdeal(id, Q, currRing);
94 }
95
idHomModule(ideal m,ideal Q,intvec ** w)96 static inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w)
97 {
98 return id_HomModule(m, Q, w, currRing);
99 }
100
101 BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w);
102
103 ideal idMinBase (ideal h1);
104 /*returns a minimized set of generators of h1*/
105 void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
106 void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
107 int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
108
109 int binom (int n,int r);
110
idFreeModule(int i)111 inline ideal idFreeModule (int i)
112 {
113 return id_FreeModule (i, currRing);
114 }
115
116
117 // GB algorithm for syz computaions:
118 enum GbVariant
119 {
120 GbDefault=0,
121 // internal variants:
122 GbStd,
123 GbSlimgb,
124 GbSba,
125 // and the library functions:
126 GbGroebner,
127 GbModstd,
128 GbFfmod,
129 GbNfmod,
130 GbStdSat,
131 GbSingmatic
132 };
133
134 ideal idSect (ideal h1,ideal h2, GbVariant a=GbDefault);
135 ideal idMultSect(resolvente arg, int length, GbVariant a=GbDefault);
136
137 //ideal idSyzygies (ideal h1, tHomog h,intvec **w);
138 ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
139 BOOLEAN setRegularity=FALSE, int *deg = NULL, GbVariant a=GbDefault);
140 ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL, GbVariant a=GbDefault, ideal h11=NULL);
141
142 ideal idLift (ideal mod, ideal submod,ideal * rest=NULL,
143 BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
144 matrix *unit=NULL, GbVariant a=GbDefault);
145
146 void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, int *w= NULL );
147
148 ideal idQuot (ideal h1,ideal h2,
149 BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
150
151 // ideal idPower(ideal gid,int deg);
152
153 //ideal idElimination (ideal h1,poly delVar);
154 ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL, GbVariant a=GbDefault);
155
156 #ifdef WITH_OLD_MINOR
157 poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL);
158 #endif
159 ideal idMinors(matrix a, int ar, ideal R = NULL);
160
161 ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
162
163 ideal idHead(ideal h);
164
165 // ideal idHomogen(ideal h, int varnum);
166
167 BOOLEAN idIsSubModule(ideal id1,ideal id2);
168
idVec2Ideal(poly vec)169 static inline ideal idVec2Ideal(poly vec)
170 {
171 return id_Vec2Ideal(vec, currRing);
172 }
173
174 ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL);
175
idIsZeroDim(ideal i)176 static inline BOOLEAN idIsZeroDim(ideal i)
177 {
178 return id_IsZeroDim(i, currRing);
179 }
180
181 matrix idDiff(matrix i, int k);
182 matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
183
184 static inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE)
185 {
186 return id_Sort(id, nolex, currRing);
187 }
188
189 ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL,
190 matrix *T=NULL, GbVariant a=GbDefault);
191 matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how);
192
193 // intvec *idQHomWeight(ideal id);
194
195 poly id_GCD(poly f, poly g, const ring r);
196
197 ideal id_Farey(ideal x, number N, const ring r);
198
199 ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
200
201 ideal id_Satstd(const ideal I, ideal J, const ring r);
202
203 GbVariant syGetAlgorithm(char *n, const ring r, const ideal M);
204 #endif
205