[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 | |
---|
[aa8a7e] | 10 | #include "polys/monomials/ring.h" |
---|
| 11 | #include "polys/monomials/p_polys.h" |
---|
| 12 | #include "polys/simpleideals.h" |
---|
[f7d39b] | 13 | |
---|
[aa8a7e] | 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 |
---|
[109c06] | 84 | static 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 | |
---|
[109c06] | 91 | static inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL) |
---|
[d84a4d] | 92 | { |
---|
[9e8bfa] | 93 | return id_HomIdeal(id, Q, currRing); |
---|
[d84a4d] | 94 | } |
---|
| 95 | |
---|
[109c06] | 96 | static 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 | |
---|
[c5f2e8e] | 103 | ideal idMinBase (ideal h1, ideal *SB=NULL); |
---|
[8505243] | 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 | |
---|
[c57af60] | 117 | // GB algorithm for syz computations: |
---|
[109c06] | 118 | enum GbVariant |
---|
| 119 | { |
---|
| 120 | GbDefault=0, |
---|
[d617882] | 121 | // internal variants: |
---|
[109c06] | 122 | GbStd, |
---|
[d617882] | 123 | GbSlimgb, |
---|
| 124 | GbSba, |
---|
| 125 | // and the library functions: |
---|
| 126 | GbGroebner, |
---|
| 127 | GbModstd, |
---|
| 128 | GbFfmod, |
---|
| 129 | GbNfmod, |
---|
[167596] | 130 | GbStdSat, |
---|
[d617882] | 131 | GbSingmatic |
---|
[40f727c] | 132 | // and test variants |
---|
[109c06] | 133 | }; |
---|
| 134 | |
---|
[3d3597] | 135 | ideal idSect (ideal h1,ideal h2, GbVariant a=GbDefault); |
---|
| 136 | ideal idMultSect(resolvente arg, int length, GbVariant a=GbDefault); |
---|
| 137 | |
---|
[8505243] | 138 | //ideal idSyzygies (ideal h1, tHomog h,intvec **w); |
---|
| 139 | ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE, |
---|
[109c06] | 140 | BOOLEAN setRegularity=FALSE, int *deg = NULL, GbVariant a=GbDefault); |
---|
[ebb5c16] | 141 | ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL, GbVariant a=GbDefault, ideal h11=NULL); |
---|
[8505243] | 142 | |
---|
[6f436ce] | 143 | ideal idLift (ideal mod, ideal submod,ideal * rest=NULL, |
---|
[8505243] | 144 | BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE, |
---|
[109c06] | 145 | matrix *unit=NULL, GbVariant a=GbDefault); |
---|
[8505243] | 146 | |
---|
[33b097] | 147 | void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, int *w= NULL ); |
---|
[8505243] | 148 | |
---|
| 149 | ideal idQuot (ideal h1,ideal h2, |
---|
| 150 | BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE); |
---|
| 151 | |
---|
[d84a4d] | 152 | // ideal idPower(ideal gid,int deg); |
---|
[8505243] | 153 | |
---|
| 154 | //ideal idElimination (ideal h1,poly delVar); |
---|
[459e064] | 155 | ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL, GbVariant a=GbDefault); |
---|
[8505243] | 156 | |
---|
[7356be] | 157 | #ifdef WITH_OLD_MINOR |
---|
[d16ea9] | 158 | poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL); |
---|
[7356be] | 159 | #endif |
---|
[d2a9865] | 160 | ideal idMinors(matrix a, int ar, ideal R = NULL); |
---|
[8505243] | 161 | |
---|
| 162 | ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL); |
---|
[47e5de] | 163 | ideal idMinEmbedding_with_map(ideal arg,intvec **w, ideal &trans); |
---|
[873fc1] | 164 | ideal idMinEmbedding_with_map_v(ideal arg,intvec **w, ideal &trans, int*red_comp); |
---|
[8505243] | 165 | |
---|
| 166 | ideal idHead(ideal h); |
---|
| 167 | |
---|
[d84a4d] | 168 | // ideal idHomogen(ideal h, int varnum); |
---|
[8505243] | 169 | |
---|
| 170 | BOOLEAN idIsSubModule(ideal id1,ideal id2); |
---|
| 171 | |
---|
[0f43c5] | 172 | static inline ideal idVec2Ideal(poly vec) |
---|
[3630fa8] | 173 | { |
---|
[9e8bfa] | 174 | return id_Vec2Ideal(vec, currRing); |
---|
[3630fa8] | 175 | } |
---|
[8505243] | 176 | |
---|
| 177 | ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL); |
---|
| 178 | |
---|
[0f43c5] | 179 | static inline BOOLEAN idIsZeroDim(ideal i) |
---|
[d84a4d] | 180 | { |
---|
[9e8bfa] | 181 | return id_IsZeroDim(i, currRing); |
---|
[d84a4d] | 182 | } |
---|
| 183 | |
---|
[8505243] | 184 | matrix idDiff(matrix i, int k); |
---|
| 185 | matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE); |
---|
| 186 | |
---|
[0f43c5] | 187 | static inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE) |
---|
[d84a4d] | 188 | { |
---|
[9e8bfa] | 189 | return id_Sort(id, nolex, currRing); |
---|
[d84a4d] | 190 | } |
---|
| 191 | |
---|
[760bfdc] | 192 | ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL, |
---|
| 193 | matrix *T=NULL, GbVariant a=GbDefault); |
---|
[8505243] | 194 | matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how); |
---|
| 195 | |
---|
[d84a4d] | 196 | // intvec *idQHomWeight(ideal id); |
---|
[8505243] | 197 | |
---|
| 198 | poly id_GCD(poly f, poly g, const ring r); |
---|
| 199 | |
---|
[f9591a] | 200 | ideal id_Farey(ideal x, number N, const ring r); |
---|
[8505243] | 201 | |
---|
| 202 | ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG |
---|
[d84a4d] | 203 | |
---|
[52ec76] | 204 | ideal id_Satstd(const ideal I, ideal J, const ring r); |
---|
[40f727c] | 205 | ideal id_Sat_principal(const ideal I, ideal J, const ring r); |
---|
[fbe0d7d] | 206 | ideal idSaturate(ideal I, ideal J, int &ki, BOOLEAN isIdeal=TRUE); |
---|
[40f727c] | 207 | ideal id_Homogenize(ideal I, int var_num, const ring r); |
---|
[0d6b7fc] | 208 | ideal id_HomogenizeW(ideal I, int var_num, intvec *w,const ring r); |
---|
[52ec76] | 209 | |
---|
[d617882] | 210 | GbVariant syGetAlgorithm(char *n, const ring r, const ideal M); |
---|
[8505243] | 211 | #endif |
---|