[7eb7b5] | 1 | #ifndef SIMPLEIDEALS_H |
---|
| 2 | #define SIMPLEIDEALS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* $Id$ */ |
---|
| 7 | /* |
---|
| 8 | * ABSTRACT - all basic methods to manipulate ideals |
---|
| 9 | */ |
---|
[f71e8c5] | 10 | #include <omalloc/omalloc.h> |
---|
[b78996] | 11 | #include <polys/monomials/ring.h> |
---|
[7829fb] | 12 | #include <polys/matpol.h> |
---|
[7eb7b5] | 13 | |
---|
[f7a975] | 14 | struct sip_sideal |
---|
| 15 | { |
---|
| 16 | poly* m; |
---|
| 17 | long rank; |
---|
| 18 | int nrows; |
---|
| 19 | int ncols; |
---|
| 20 | #define IDELEMS(i) ((i)->ncols) |
---|
| 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] |
---|
[760a78f] | 24 | |
---|
[f7a975] | 25 | }; |
---|
| 26 | |
---|
| 27 | struct sip_smap |
---|
| 28 | { |
---|
| 29 | poly *m; |
---|
| 30 | char *preimage; |
---|
| 31 | int nrows; |
---|
| 32 | int ncols; |
---|
| 33 | }; |
---|
| 34 | |
---|
| 35 | struct sideal_list; |
---|
| 36 | typedef struct sideal_list * ideal_list; |
---|
| 37 | |
---|
| 38 | struct sideal_list |
---|
| 39 | { |
---|
| 40 | ideal_list next; |
---|
| 41 | ideal d; |
---|
| 42 | #ifndef NDEBUG |
---|
| 43 | int nr; |
---|
| 44 | #endif |
---|
| 45 | }; |
---|
| 46 | |
---|
[f71e8c5] | 47 | extern omBin sip_sideal_bin; |
---|
| 48 | |
---|
[7eb7b5] | 49 | /*- creates an ideal -*/ |
---|
| 50 | ideal idInit (int size, int rank=1); |
---|
[760a78f] | 51 | |
---|
[7eb7b5] | 52 | /*- deletes an ideal -*/ |
---|
| 53 | void id_Delete (ideal* h, ring r); |
---|
| 54 | void id_ShallowDelete (ideal* h, ring r); |
---|
| 55 | void idSkipZeroes (ideal ide); |
---|
| 56 | /*gives an ideal the minimal possible size*/ |
---|
| 57 | |
---|
[71955d] | 58 | /// number of non-zero polys in F |
---|
| 59 | int idElem(const ideal F); |
---|
| 60 | /// normialize all polys in id |
---|
| 61 | void id_Normalize(ideal id, const ring r); |
---|
| 62 | |
---|
[ad3aa7] | 63 | int id_MinDegW(ideal M,intvec *w, const ring r); |
---|
| 64 | |
---|
[7eb7b5] | 65 | #ifdef PDEBUG |
---|
[32d07a5] | 66 | void id_DBTest(ideal h1, int level, const char *f,const int l, const ring r); |
---|
| 67 | #define id_Test(A, r) id_DBTest(A, PDEBUG, __FILE__,__LINE__, r) |
---|
| 68 | // #define id_Print(id, r) id_Show(id, r) |
---|
[7eb7b5] | 69 | #else |
---|
[32d07a5] | 70 | #define id_Test(A, r) (TRUE) |
---|
| 71 | // #define id_Print(A, r) ((void)0) |
---|
[7eb7b5] | 72 | #endif |
---|
| 73 | |
---|
[91a72f] | 74 | ideal id_Copy (ideal h1,const ring r); |
---|
[760a78f] | 75 | |
---|
[7eb7b5] | 76 | /*adds two ideals without simplifying the result*/ |
---|
[a665eb] | 77 | ideal id_SimpleAdd (ideal h1,ideal h2, const ring r); |
---|
[7eb7b5] | 78 | /*adds the quotient ideal*/ |
---|
[2f5936] | 79 | ideal id_Add (ideal h1,ideal h2,const ring r); |
---|
[7eb7b5] | 80 | /* h1 + h2 */ |
---|
[a2d993] | 81 | |
---|
| 82 | ideal id_Power(ideal given,int exp, const ring r); |
---|
[7eb7b5] | 83 | BOOLEAN idIs0 (ideal h); |
---|
| 84 | |
---|
| 85 | long id_RankFreeModule(ideal m, ring lmRing, ring tailRing); |
---|
| 86 | static inline long id_RankFreeModule(ideal m, ring r) |
---|
| 87 | {return id_RankFreeModule(m, r, r);} |
---|
| 88 | // returns TRUE, if idRankFreeModule(m) > 0 |
---|
| 89 | BOOLEAN id_IsModule(ideal m, ring r); |
---|
[2f5547] | 90 | ideal id_FreeModule (int i, const ring r); |
---|
[7eb7b5] | 91 | int idElem(const ideal F); |
---|
[f71e8c5] | 92 | int id_PosConstant(ideal id, const ring r); |
---|
[a2d993] | 93 | ideal id_Head(ideal h,const ring r); |
---|
[f71e8c5] | 94 | ideal id_MaxIdeal (const ring r); |
---|
[a665eb] | 95 | ideal id_MaxIdeal(int deg, const ring r); |
---|
[f71e8c5] | 96 | ideal id_CopyFirstK (const ideal ide, const int k,const ring r); |
---|
[f5c2d02] | 97 | void id_DelMultiples(ideal id, const ring r); |
---|
[9aa29b] | 98 | void id_Norm(ideal id, const ring r); |
---|
[4a08e7] | 99 | void id_DelEquals(ideal id, const ring r); |
---|
[119853] | 100 | void id_DelLmEquals(ideal id, const ring r); |
---|
[3d0808] | 101 | void id_DelDiv(ideal id, const ring r); |
---|
[2e7dee] | 102 | BOOLEAN id_IsConstant(ideal id, const ring r); |
---|
[599813] | 103 | |
---|
| 104 | /// sorts the ideal w.r.t. the actual ringordering |
---|
| 105 | /// uses lex-ordering when nolex = FALSE |
---|
| 106 | intvec *id_Sort(const ideal id, const BOOLEAN nolex, const ring r); |
---|
| 107 | |
---|
[2f5936] | 108 | ideal id_Transp(ideal a, const ring rRing); |
---|
| 109 | void id_Compactify(ideal id, const ring r); |
---|
[a665eb] | 110 | ideal id_Mult (ideal h1,ideal h2, const ring r); |
---|
[a2d993] | 111 | ideal id_Homogen(ideal h, int varnum,const ring r); |
---|
[a665eb] | 112 | BOOLEAN id_HomIdeal (ideal id, ideal Q, const ring r); |
---|
[a2d993] | 113 | BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R); |
---|
| 114 | BOOLEAN id_IsZeroDim(ideal I, const ring r); |
---|
| 115 | ideal id_Jet(ideal i,int d, const ring R); |
---|
| 116 | ideal id_JetW(ideal i,int d, intvec * iv, const ring R); |
---|
| 117 | ideal id_Subst(ideal id, int n, poly e, const ring r); |
---|
| 118 | matrix id_Module2Matrix(ideal mod, const ring R); |
---|
| 119 | matrix id_Module2formatedMatrix(ideal mod,int rows, int cols, const ring R); |
---|
| 120 | ideal id_Matrix2Module(matrix mat, const ring R); |
---|
| 121 | ideal id_Vec2Ideal(poly vec, const ring R); |
---|
| 122 | |
---|
[d16ea9] | 123 | int id_ReadOutPivot(ideal arg, int* comp, const ring r); |
---|
[5d9aa6] | 124 | |
---|
| 125 | int binom (int n,int r); |
---|
| 126 | |
---|
[cf02b22] | 127 | /*- verschiebt die Indizes der Modulerzeugenden um i -*/ |
---|
| 128 | void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise); |
---|
| 129 | void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise); |
---|
| 130 | int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise); |
---|
| 131 | |
---|
[2a38d90] | 132 | #ifdef PDEBUG |
---|
| 133 | void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint = 0); |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | |
---|
[d84a4d] | 137 | /// insert h2 into h1 depending on the two boolean parameters: |
---|
| 138 | /// - if zeroOk is true, then h2 will also be inserted when it is zero |
---|
| 139 | /// - if duplicateOk is true, then h2 will also be inserted when it is |
---|
| 140 | /// already present in h1 |
---|
| 141 | /// return TRUE iff h2 was indeed inserted |
---|
| 142 | BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries, |
---|
| 143 | const poly h2, const bool zeroOk, |
---|
| 144 | const bool duplicateOk, const ring r); |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | intvec * id_QHomWeight(ideal id, const ring r); |
---|
| 148 | |
---|
| 149 | |
---|
[7eb7b5] | 150 | #endif |
---|