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