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