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