[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 | */ |
---|
| 10 | #include <polys/monomials/ring.h> |
---|
[f71e8c5] | 11 | #include <omalloc/omalloc.h> |
---|
[7eb7b5] | 12 | |
---|
[f7a975] | 13 | struct sip_sideal |
---|
| 14 | { |
---|
| 15 | poly* m; |
---|
| 16 | long rank; |
---|
| 17 | int nrows; |
---|
| 18 | int ncols; |
---|
| 19 | #define IDELEMS(i) ((i)->ncols) |
---|
| 20 | #define MATCOLS(i) ((i)->ncols) |
---|
| 21 | #define MATROWS(i) ((i)->nrows) |
---|
| 22 | #define MATELEM(mat,i,j) ((mat)->m)[MATCOLS((mat)) * ((i)-1) + (j)-1] |
---|
| 23 | |
---|
| 24 | }; |
---|
| 25 | |
---|
| 26 | struct sip_smap |
---|
| 27 | { |
---|
| 28 | poly *m; |
---|
| 29 | char *preimage; |
---|
| 30 | int nrows; |
---|
| 31 | int ncols; |
---|
| 32 | }; |
---|
| 33 | |
---|
| 34 | class ip_smatrix; |
---|
| 35 | typedef ip_smatrix * matrix; |
---|
| 36 | |
---|
| 37 | struct sideal_list; |
---|
| 38 | typedef struct sideal_list * ideal_list; |
---|
| 39 | |
---|
| 40 | struct sideal_list |
---|
| 41 | { |
---|
| 42 | ideal_list next; |
---|
| 43 | ideal d; |
---|
| 44 | #ifndef NDEBUG |
---|
| 45 | int nr; |
---|
| 46 | #endif |
---|
| 47 | }; |
---|
| 48 | |
---|
[f71e8c5] | 49 | extern omBin sip_sideal_bin; |
---|
| 50 | |
---|
[7eb7b5] | 51 | #ifdef PDEBUG |
---|
| 52 | ideal idDBInit (int size, int rank, const char *f, int l); |
---|
| 53 | #define idInit(A,B) idDBInit(A,B,__FILE__,__LINE__) |
---|
| 54 | #else |
---|
| 55 | /*- creates an ideal -*/ |
---|
| 56 | ideal idInit (int size, int rank=1); |
---|
| 57 | #endif |
---|
| 58 | /*- deletes an ideal -*/ |
---|
| 59 | #define idDelete(h) id_Delete(h, currRing) |
---|
| 60 | void id_Delete (ideal* h, ring r); |
---|
| 61 | void id_ShallowDelete (ideal* h, ring r); |
---|
| 62 | void idSkipZeroes (ideal ide); |
---|
| 63 | /*gives an ideal the minimal possible size*/ |
---|
| 64 | |
---|
| 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 | |
---|
| 74 | ideal id_Copy (ideal h1,const ring r); |
---|
| 75 | #ifdef PDEBUG |
---|
| 76 | ideal idDBCopy(ideal h1,const char *f,int l); |
---|
| 77 | #define idCopy(A) idDBCopy(A,__FILE__,__LINE__) |
---|
| 78 | #else |
---|
| 79 | #define idCopy(A) id_Copy(A,currRing) |
---|
| 80 | #endif |
---|
| 81 | /*adds two ideals without simplifying the result*/ |
---|
| 82 | ideal idSimpleAdd (ideal h1,ideal h2); |
---|
| 83 | /*adds the quotient ideal*/ |
---|
| 84 | ideal idAdd (ideal h1,ideal h2); |
---|
| 85 | /* h1 + h2 */ |
---|
| 86 | BOOLEAN idIs0 (ideal h); |
---|
| 87 | |
---|
| 88 | long id_RankFreeModule(ideal m, ring lmRing, ring tailRing); |
---|
| 89 | static inline long id_RankFreeModule(ideal m, ring r) |
---|
| 90 | {return id_RankFreeModule(m, r, r);} |
---|
| 91 | // returns TRUE, if idRankFreeModule(m) > 0 |
---|
| 92 | BOOLEAN id_IsModule(ideal m, ring r); |
---|
| 93 | ideal idFreeModule (int i); |
---|
| 94 | int idElem(const ideal F); |
---|
[f71e8c5] | 95 | int id_PosConstant(ideal id, const ring r); |
---|
| 96 | ideal id_MaxIdeal (const ring r); |
---|
| 97 | ideal id_CopyFirstK (const ideal ide, const int k,const ring r); |
---|
[f5c2d02] | 98 | void id_DelMultiples(ideal id, const ring r); |
---|
[9aa29b] | 99 | void id_Norm(ideal id, const ring r); |
---|
[4a08e7] | 100 | void id_DelEquals(ideal id, const ring r); |
---|
[119853] | 101 | void id_DelLmEquals(ideal id, const ring r); |
---|
[3d0808] | 102 | void id_DelDiv(ideal id, const ring r); |
---|
| 103 | |
---|
[7eb7b5] | 104 | #endif |
---|