ideals.h
Go to the documentation of this file.
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 */
9 
10 #include <polys/monomials/ring.h>
12 #include <polys/simpleideals.h>
13 
14 extern ring currRing;
15 
16 #include <kernel/structs.h> // for tHomog
17 
18 //typedef struct sip_sideal * ideal;
19 //typedef struct sip_smap * map;
20 typedef ideal * resolvente;
21 
22 inline ideal idCopyFirstK (const ideal ide, const int k, ring R = currRing)
23 {
24  return id_CopyFirstK(ide, k, R);
25 }
26 
27 void idKeepFirstK(ideal ide, const int k);
28 void idDelEquals(ideal id);
29 
30 /// delete an ideal
31 inline void idDelete (ideal* h, ring r = currRing)
32 {
33  id_Delete(h, r);
34 }
35 
36 /// initialise the maximal ideal (at 0)
37 //ideal id_MaxIdeal(int deg, const ring r);
38 #define idMaxIdeal(D) id_MaxIdeal(D,currRing)
39 
40 /// index of generator with leading term in ground ring (if any); otherwise -1
41 //int id_PosConstant(ideal id, const ring r)
42 #define idPosConstant(I) id_PosConstant(I,currRing)
43 
44 /// Count the effective size of an ideal
45 /// (without the trailing allocated zero-elements)
46 static inline int idSize(const ideal id)
47 {
48  int j = IDELEMS(id) - 1;
49  poly* mm = id->m;
50  while ((j >= 0) && (mm[j] == NULL)) j--;
51  return (j + 1);
52 }
53 
54 
55 //BOOLEAN id_IsConstant(ideal id, const ring r);
56 #define idIsConstant(I) id_IsConstant(I,currRing)
57 
58 #define idSimpleAdd(A,B) id_SimpleAdd(A,B,currRing)
59 
60 ideal id_Copy (ideal h1, const ring r);
61 
62 #define idPrint(id) id_Print(id, currRing, currRing)
63 #define idTest(id) id_Test(id, currRing)
64 
65 #if 0
66 
67 // ifdef PDEBUG // Sorry: the following was lost........ :((((((((
68 ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
69 #define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
70 
71 inline ideal idCopy(ideal A, const ring R = currRing)
72 {
73  return id_DBCopy(A,R); // well, just for now... ok? Macros can't have default args values :(
74 }
75 #else
76 inline ideal idCopy(ideal A, const ring R = currRing)
77 {
78  return id_Copy(A, R);
79 }
80 #endif
81 
82 
83 /// h1 + h2
84 inline ideal idAdd (ideal h1, ideal h2, const ring R = currRing)
85 {
86  return id_Add(h1, h2, R);
87 }
88 
89 BOOLEAN idInsertPoly (ideal h1,poly h2); /* h1 + h2 */
90 inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring R = currRing)
91 {
92  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, R);
93 }
94 
95 
96 /* h1 + h2 */
97 
98 /// hh := h1 * h2
99 inline ideal idMult (ideal h1, ideal h2, const ring R = currRing)
100 {
101  return id_Mult(h1, h2, R);
102 }
103 
104 BOOLEAN idIs0 (ideal h);
105 
106 // returns TRUE, if idRankFreeModule(m) > 0
107 BOOLEAN idIsModule(ideal m, const ring r);
108 
109 inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL, const ring R = currRing)
110 {
111  return id_HomIdeal(id, Q, R);
112 }
113 
114 inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w, const ring R = currRing)
115 {
116  return id_HomModule(m, Q, w, R);
117 }
118 
120 
121 ideal idMinBase (ideal h1);
122  /*returns a minimized set of generators of h1*/
123 void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
124 void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
125 int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
126 
127 int binom (int n,int r);
128 
129 inline ideal idFreeModule (int i, const ring R = currRing)
130 {
131  return id_FreeModule (i, R);
132 }
133 
134 
135 ideal idSect (ideal h1,ideal h2);
136 ideal idMultSect(resolvente arg, int length);
137 
138 //ideal idSyzygies (ideal h1, tHomog h,intvec **w);
139 ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
140  BOOLEAN setRegularity=FALSE, int *deg = NULL);
142 
143 ideal idLift (ideal mod, ideal sumod,ideal * rest=NULL,
144  BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
145  matrix *unit=NULL);
146 
147 void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL );
148 
149 intvec * idMWLift(ideal mod,intvec * weights);
150 
151 ideal idQuot (ideal h1,ideal h2,
152  BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
153 
154 // ideal idPower(ideal gid,int deg);
155 
156 //ideal idElimination (ideal h1,poly delVar);
157 ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL);
158 
159 #ifdef WITH_OLD_MINOR
160 poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL);
161 #endif
162 ideal idMinors(matrix a, int ar, ideal R = NULL);
163 
165 
167 
168 // ideal idHomogen(ideal h, int varnum);
169 
171 
172 inline ideal idVec2Ideal(poly vec, const ring R = currRing)
173 {
174  return id_Vec2Ideal(vec, R);
175 }
176 
178 
179 inline BOOLEAN idIsZeroDim(ideal i, const ring R = currRing)
180 {
181  return id_IsZeroDim(i, R);
182 }
183 
184 matrix idDiff(matrix i, int k);
185 matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
186 
187 inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE, const ring R = currRing)
188 {
189  return id_Sort(id, nolex, R);
190 }
191 
193 matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how);
194 
195 /// transpose a module
196 inline ideal idTransp(ideal a, const ring R = currRing)
197 {
198  return id_Transp(a, R);
199 }
200 
201 // intvec *idQHomWeight(ideal id);
202 
203 ideal idXXX (ideal h1, int k);
204 
205 poly id_GCD(poly f, poly g, const ring r);
206 
207 ideal id_Farey(ideal x, number N, const ring r);
208 
209 ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
210 
211 
212 #endif
BOOLEAN idHomIdeal(ideal id, ideal Q=NULL, const ring R=currRing)
Definition: ideals.h:109
ideal id_FreeModule(int i, const ring r)
ideal id_Transp(ideal a, const ring rRing)
const poly a
Definition: syzextra.cc:212
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
ideal id_Mult(ideal h1, ideal h2, const ring r)
BOOLEAN idIsZeroDim(ideal i, const ring R=currRing)
Definition: ideals.h:179
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, short *w=NULL)
Definition: ideals.cc:1127
#define FALSE
Definition: auxiliary.h:140
ideal idXXX(ideal h1, int k)
Definition: ideals.cc:704
ideal id_Copy(ideal h1, const ring r)
f
Definition: cfModGcd.cc:4022
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
void id_Delete(ideal *h, ring r)
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
ideal idModulo(ideal h1, ideal h2, tHomog h=testHomog, intvec **w=NULL)
Definition: ideals.cc:2016
#define TRUE
Definition: auxiliary.h:144
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:
intvec * idMWLift(ideal mod, intvec *weights)
Definition: ideals.cc:2156
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
ideal idAdd(ideal h1, ideal h2, const ring R=currRing)
h1 + h2
Definition: ideals.h:84
ideal idLift(ideal mod, ideal sumod, ideal *rest=NULL, BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE, BOOLEAN divide=FALSE, matrix *unit=NULL)
Definition: ideals.cc:933
void idDelEquals(ideal id)
Definition: ideals.cc:2628
#define Q
Definition: sirandom.c:25
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w, const ring R=currRing)
Definition: ideals.h:114
ideal idLiftStd(ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL)
Definition: ideals.cc:751
BOOLEAN idIsModule(ideal m, const ring r)
ideal idMinBase(ideal h1)
Definition: ideals.cc:53
ideal idHead(ideal h)
ideal idSeries(int n, ideal M, matrix U=NULL, intvec *w=NULL)
Definition: ideals.cc:1914
#define M
Definition: sirandom.c:24
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
const ring r
Definition: syzextra.cc:208
ideal idElimination(ideal h1, poly delVar, intvec *hilb=NULL)
Definition: ideals.cc:1397
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
Definition: ideals.cc:2325
Definition: intvec.h:16
void idKeepFirstK(ideal ide, const int k)
keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero...
Definition: ideals.cc:2559
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
ideal idMinors(matrix a, int ar, ideal R=NULL)
Definition: ideals.cc:1788
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2259
polyrec * poly
Definition: hilb.h:10
#define A
Definition: sirandom.c:23
poly id_GCD(poly f, poly g, const ring r)
Definition: ideals.cc:2383
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
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 ...
ideal idMultSect(resolvente arg, int length)
Definition: ideals.cc:350
BOOLEAN idInsertPoly(ideal h1, poly h2)
int m
Definition: cfEzgcd.cc:119
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
int i
Definition: cfEzgcd.cc:123
ideal idSect(ideal h1, ideal h2)
Definition: ideals.cc:211
#define IDELEMS(i)
Definition: simpleideals.h:19
ideal idMult(ideal h1, ideal h2, const ring R=currRing)
hh := h1 * h2
Definition: ideals.h:99
#define NULL
Definition: omList.c:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp=TRUE, BOOLEAN setRegularity=FALSE, int *deg=NULL)
Definition: ideals.cc:560
ideal idVec2Ideal(poly vec, const ring R=currRing)
Definition: ideals.h:172
ideal id_Add(ideal h1, ideal h2, const ring r)
#define R
Definition: sirandom.c:26
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
const CanonicalForm & w
Definition: facAbsFact.cc:55
Variable x
Definition: cfModGcd.cc:4023
ideal idCopyFirstK(const ideal ide, const int k, ring R=currRing)
Definition: ideals.h:22
intvec * idSort(ideal id, BOOLEAN nolex=TRUE, const ring R=currRing)
Definition: ideals.h:187
ideal idTransp(ideal a, const ring R=currRing)
transpose a module
Definition: ideals.h:196
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2483
BOOLEAN idIsSubModule(ideal id1, ideal id2)
Definition: ideals.cc:1841
ideal * resolvente
Definition: ideals.h:20
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE)
Definition: ideals.cc:1304
BOOLEAN id_IsZeroDim(ideal I, const ring r)
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
matrix idDiffOp(ideal I, ideal J, BOOLEAN multiply=TRUE)
Definition: ideals.cc:1944
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
ideal id_Vec2Ideal(poly vec, const ring R)
kBucketDestroy & P
Definition: myNF.cc:191
static jList * T
Definition: janet.cc:37
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
BOOLEAN idInsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring R=currRing)
Definition: ideals.h:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1862
int binom(int n, int r)
matrix idDiff(matrix i, int k)
Definition: ideals.cc:1931
int l
Definition: cfEzgcd.cc:94