[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 | */ |
---|
[f7d39b] | 9 | |
---|
| 10 | #include <polys/monomials/ring.h> |
---|
| 11 | #include <polys/monomials/p_polys.h> |
---|
[8505243] | 12 | #include <polys/simpleideals.h> |
---|
[f7d39b] | 13 | |
---|
[da6156] | 14 | #include <kernel/structs.h> // for tHomog |
---|
[8505243] | 15 | |
---|
| 16 | //typedef struct sip_sideal * ideal; |
---|
| 17 | //typedef struct sip_smap * map; |
---|
| 18 | typedef ideal * resolvente; |
---|
| 19 | |
---|
[0f43c5] | 20 | static inline ideal idCopyFirstK (const ideal ide, const int k) |
---|
[d84a4d] | 21 | { |
---|
[9e8bfa] | 22 | return id_CopyFirstK(ide, k, currRing); |
---|
[d84a4d] | 23 | } |
---|
[8505243] | 24 | |
---|
[9234fb] | 25 | void idKeepFirstK(ideal ide, const int k); |
---|
[c81bf7] | 26 | void idDelEquals(ideal id); |
---|
[9234fb] | 27 | |
---|
[8505243] | 28 | /// delete an ideal |
---|
[86f1dc] | 29 | #define idDelete(H) id_Delete((H),currRing) |
---|
[8505243] | 30 | |
---|
| 31 | /// initialise the maximal ideal (at 0) |
---|
[a9c298] | 32 | //ideal id_MaxIdeal(int deg, const ring r); |
---|
[bb5c28] | 33 | #define idMaxIdeal(D) id_MaxIdeal(D,currRing) |
---|
[8505243] | 34 | |
---|
| 35 | /// index of generator with leading term in ground ring (if any); otherwise -1 |
---|
[bb5c28] | 36 | //int id_PosConstant(ideal id, const ring r) |
---|
| 37 | #define idPosConstant(I) id_PosConstant(I,currRing) |
---|
[d84a4d] | 38 | |
---|
[bb5c28] | 39 | //BOOLEAN id_IsConstant(ideal id, const ring r); |
---|
| 40 | #define idIsConstant(I) id_IsConstant(I,currRing) |
---|
[8505243] | 41 | |
---|
[36d6ec6] | 42 | #define idSimpleAdd(A,B) id_SimpleAdd(A,B,currRing) |
---|
| 43 | |
---|
[6a4ba5f] | 44 | ideal id_Copy (ideal h1, const ring r); |
---|
[8505243] | 45 | |
---|
[f7d39b] | 46 | #define idPrint(id) id_Print(id, currRing, currRing) |
---|
| 47 | #define idTest(id) id_Test(id, currRing) |
---|
| 48 | |
---|
[3630fa8] | 49 | #if 0 |
---|
| 50 | |
---|
| 51 | // ifdef PDEBUG // Sorry: the following was lost........ :(((((((( |
---|
[8505243] | 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 | |
---|
[9e8bfa] | 55 | inline ideal idCopy(ideal A) |
---|
[8505243] | 56 | { |
---|
[9e8bfa] | 57 | return id_DBCopy(A,currRing); // well, just for now... ok? Macros can't have default args values :( |
---|
[8505243] | 58 | } |
---|
| 59 | #else |
---|
[9e8bfa] | 60 | inline ideal idCopy(ideal A) |
---|
[8505243] | 61 | { |
---|
[9e8bfa] | 62 | return id_Copy(A, currRing); |
---|
[8505243] | 63 | } |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | |
---|
[d84a4d] | 67 | /// h1 + h2 |
---|
[9e8bfa] | 68 | inline ideal idAdd (ideal h1, ideal h2) |
---|
[d84a4d] | 69 | { |
---|
[9e8bfa] | 70 | return id_Add(h1, h2, currRing); |
---|
[d84a4d] | 71 | } |
---|
| 72 | |
---|
| 73 | BOOLEAN idInsertPoly (ideal h1,poly h2); /* h1 + h2 */ |
---|
[48cbb0] | 74 | BOOLEAN idInsertPolyOnPos (ideal I,poly p,int pos); /* inserts p in I on pos */ |
---|
[9e8bfa] | 75 | inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk) |
---|
[d84a4d] | 76 | { |
---|
[9e8bfa] | 77 | return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing); |
---|
[d84a4d] | 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | /* h1 + h2 */ |
---|
| 82 | |
---|
| 83 | /// hh := h1 * h2 |
---|
[9e8bfa] | 84 | inline ideal idMult (ideal h1, ideal h2) |
---|
[d84a4d] | 85 | { |
---|
[9e8bfa] | 86 | return id_Mult(h1, h2, currRing); |
---|
[d84a4d] | 87 | } |
---|
[8505243] | 88 | |
---|
| 89 | BOOLEAN idIs0 (ideal h); |
---|
| 90 | |
---|
[9e8bfa] | 91 | inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL) |
---|
[d84a4d] | 92 | { |
---|
[9e8bfa] | 93 | return id_HomIdeal(id, Q, currRing); |
---|
[d84a4d] | 94 | } |
---|
| 95 | |
---|
[9e8bfa] | 96 | inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w) |
---|
[d84a4d] | 97 | { |
---|
[9e8bfa] | 98 | return id_HomModule(m, Q, w, currRing); |
---|
[d84a4d] | 99 | } |
---|
| 100 | |
---|
[8505243] | 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 | |
---|
[9e8bfa] | 111 | inline ideal idFreeModule (int i) |
---|
[3630fa8] | 112 | { |
---|
[9e8bfa] | 113 | return id_FreeModule (i, currRing); |
---|
[3630fa8] | 114 | } |
---|
| 115 | |
---|
| 116 | |
---|
[8505243] | 117 | ideal idSect (ideal h1,ideal h2); |
---|
| 118 | ideal idMultSect(resolvente arg, int length); |
---|
| 119 | |
---|
| 120 | //ideal idSyzygies (ideal h1, tHomog h,intvec **w); |
---|
| 121 | ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE, |
---|
| 122 | BOOLEAN setRegularity=FALSE, int *deg = NULL); |
---|
| 123 | ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL); |
---|
| 124 | |
---|
| 125 | ideal idLift (ideal mod, ideal sumod,ideal * rest=NULL, |
---|
| 126 | BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE, |
---|
| 127 | matrix *unit=NULL); |
---|
| 128 | |
---|
| 129 | void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL ); |
---|
| 130 | |
---|
| 131 | intvec * idMWLift(ideal mod,intvec * weights); |
---|
| 132 | |
---|
| 133 | ideal idQuot (ideal h1,ideal h2, |
---|
| 134 | BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE); |
---|
| 135 | |
---|
[d84a4d] | 136 | // ideal idPower(ideal gid,int deg); |
---|
[8505243] | 137 | |
---|
| 138 | //ideal idElimination (ideal h1,poly delVar); |
---|
| 139 | ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL); |
---|
| 140 | |
---|
[7356be] | 141 | #ifdef WITH_OLD_MINOR |
---|
[d16ea9] | 142 | poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL); |
---|
[7356be] | 143 | #endif |
---|
[d16ea9] | 144 | ideal idMinors(matrix a, int ar, ideal R = NULL); |
---|
[8505243] | 145 | |
---|
| 146 | ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL); |
---|
| 147 | |
---|
| 148 | ideal idHead(ideal h); |
---|
| 149 | |
---|
[d84a4d] | 150 | // ideal idHomogen(ideal h, int varnum); |
---|
[8505243] | 151 | |
---|
| 152 | BOOLEAN idIsSubModule(ideal id1,ideal id2); |
---|
| 153 | |
---|
[0f43c5] | 154 | static inline ideal idVec2Ideal(poly vec) |
---|
[3630fa8] | 155 | { |
---|
[9e8bfa] | 156 | return id_Vec2Ideal(vec, currRing); |
---|
[3630fa8] | 157 | } |
---|
[8505243] | 158 | |
---|
| 159 | ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL); |
---|
| 160 | |
---|
[0f43c5] | 161 | static inline BOOLEAN idIsZeroDim(ideal i) |
---|
[d84a4d] | 162 | { |
---|
[9e8bfa] | 163 | return id_IsZeroDim(i, currRing); |
---|
[d84a4d] | 164 | } |
---|
| 165 | |
---|
[8505243] | 166 | matrix idDiff(matrix i, int k); |
---|
| 167 | matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE); |
---|
| 168 | |
---|
[0f43c5] | 169 | static inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE) |
---|
[d84a4d] | 170 | { |
---|
[9e8bfa] | 171 | return id_Sort(id, nolex, currRing); |
---|
[d84a4d] | 172 | } |
---|
| 173 | |
---|
[8505243] | 174 | ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL); |
---|
| 175 | matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how); |
---|
| 176 | |
---|
[d84a4d] | 177 | // intvec *idQHomWeight(ideal id); |
---|
[8505243] | 178 | |
---|
| 179 | ideal idXXX (ideal h1, int k); |
---|
| 180 | |
---|
| 181 | poly id_GCD(poly f, poly g, const ring r); |
---|
| 182 | |
---|
[f9591a] | 183 | ideal id_Farey(ideal x, number N, const ring r); |
---|
[8505243] | 184 | |
---|
| 185 | ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG |
---|
[d84a4d] | 186 | |
---|
[8505243] | 187 | #endif |
---|