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