simpleideals.h
Go to the documentation of this file.
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 
38 {
39  ideal_list next;
41 #ifndef SING_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 lR, const ring tR );
66 #define id_TestTail(A, lR, tR) id_DBTest(A, PDEBUG, __FILE__,__LINE__, lR, tR)
67 #define id_Test(A, lR) id_DBTest(A, PDEBUG, __FILE__,__LINE__, lR, lR)
68 #else
69 #define id_TestTail(A, lR, tR) do {} while (0)
70 #define id_Test(A, lR) 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);
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 #define id_Print(id, lR, tR) idShow(id, lR, tR)
134 #else
135 #define id_Print(A, lR, tR) do {} while (0)
136 #endif
137 
138 
139 
140 /// insert h2 into h1 depending on the two boolean parameters:
141 /// - if zeroOk is true, then h2 will also be inserted when it is zero
142 /// - if duplicateOk is true, then h2 will also be inserted when it is
143 /// already present in h1
144 /// return TRUE iff h2 was indeed inserted
145 BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries,
146  const poly h2, const bool zeroOk,
147  const bool duplicateOk, const ring r);
148 
149 
150 intvec * id_QHomWeight(ideal id, const ring r);
151 
152 
153 ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r);
154 
155 void id_Shift(ideal M, int s, const ring r);
156 #endif
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
ideal id_Copy(ideal h1, const ring r)
int binom(int n, int r)
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
int level(const CanonicalForm &f)
omBin_t * omBin
Definition: omStructs.h:12
BOOLEAN id_IsConstant(ideal id, const ring r)
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
int id_PosConstant(ideal id, const ring r)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: simpleideals.cc:81
f
Definition: cfModGcd.cc:4022
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
void id_DBTest(ideal h1, int level, const char *f, const int l, const ring lR, const ring tR)
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
void id_DelLmEquals(ideal id, const ring r)
poly * m
Definition: simpleideals.h:28
ideal id_FreeModule(int i, const ring r)
int id_MinDegW(ideal M, intvec *w, const ring r)
ideal id_Mult(ideal h1, ideal h2, const ring r)
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
ideal id_Power(ideal given, int exp, const ring r)
void id_DelMultiples(ideal id, const ring r)
intvec * id_Sort(const ideal id, const BOOLEAN nolex, const ring r)
sorts the ideal w.r.t. the actual ringordering uses lex-ordering when nolex = FALSE ...
void id_DelDiv(ideal id, const ring r)
ideal id_Head(ideal h, const ring r)
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ideal id_Jet(ideal i, int d, const ring R)
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
ideal id_MaxIdeal(const ring r)
#define M
Definition: sirandom.c:24
void id_Norm(ideal id, const ring r)
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
const ring r
Definition: syzextra.cc:208
ideal id_SimpleAdd(ideal h1, ideal h2, const ring r)
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
Definition: intvec.h:16
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
void idSkipZeroes(ideal ide)
BOOLEAN id_IsZeroDim(ideal I, const ring r)
matrix id_Module2Matrix(ideal mod, const ring R)
void id_DelEquals(ideal id, const ring r)
polyrec * poly
Definition: hilb.h:10
ideal id_JetW(ideal i, int d, intvec *iv, const ring R)
void id_Compactify(ideal id, const ring r)
int m
Definition: cfEzgcd.cc:119
char * preimage
Definition: simpleideals.h:29
BOOLEAN idIs0(ideal h)
int i
Definition: cfEzgcd.cc:123
ideal id_Subst(ideal id, int n, poly e, const ring r)
intvec * id_QHomWeight(ideal id, const ring r)
ideal_list next
Definition: simpleideals.h:39
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
void id_Shift(ideal M, int s, const ring r)
void id_Normalize(ideal id, const ring r)
normialize all polys in id
ideal id_Homogen(ideal h, int varnum, const ring r)
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
omBin sip_sideal_bin
Definition: simpleideals.cc:30
void id_ShallowDelete(ideal *h, ring r)
long id_RankFreeModule(ideal m, ring lmRing, ring tailRing)
BOOLEAN id_IsModule(ideal m, ring r)
ideal id_Transp(ideal a, const ring rRing)
ideal id_Vec2Ideal(poly vec, const ring R)
p exp[i]
Definition: DebugPrint.cc:39
BOOLEAN id_InsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring r)
insert h2 into h1 depending on the two boolean parameters:
ideal id_Matrix2Module(matrix mat, const ring R)
void id_Delete(ideal *h, ring r)
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
ideal id_Add(ideal h1, ideal h2, const ring r)
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint=0)
Definition: simpleideals.cc:58
int idElem(const ideal F)
number of non-zero polys in F
int l
Definition: cfEzgcd.cc:94
ideal idInit(int size, int rank=1)
Definition: simpleideals.cc:40
poly * m
Definition: simpleideals.h:15