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 static inline ideal idCopyFirstK (const ideal ide, const int k)
23 {
24  return id_CopyFirstK(ide, k, currRing);
25 }
26 
27 void idKeepFirstK(ideal ide, const int k);
28 void idDelEquals(ideal id);
29 
30 /// delete an ideal
31 #define idDelete(H) id_Delete((H),currRing)
32 
33 /// initialise the maximal ideal (at 0)
34 //ideal id_MaxIdeal(int deg, const ring r);
35 #define idMaxIdeal(D) id_MaxIdeal(D,currRing)
36 
37 /// index of generator with leading term in ground ring (if any); otherwise -1
38 //int id_PosConstant(ideal id, const ring r)
39 #define idPosConstant(I) id_PosConstant(I,currRing)
40 
41 /// Count the effective size of an ideal
42 /// (without the trailing allocated zero-elements)
43 static inline int idSize(const ideal id)
44 {
45  int j = IDELEMS(id) - 1;
46  poly* mm = id->m;
47  while ((j >= 0) && (mm[j] == NULL)) j--;
48  return (j + 1);
49 }
50 
51 
52 //BOOLEAN id_IsConstant(ideal id, const ring r);
53 #define idIsConstant(I) id_IsConstant(I,currRing)
54 
55 #define idSimpleAdd(A,B) id_SimpleAdd(A,B,currRing)
56 
57 ideal id_Copy (ideal h1, const ring r);
58 
59 #define idPrint(id) id_Print(id, currRing, currRing)
60 #define idTest(id) id_Test(id, currRing)
61 
62 #if 0
63 
64 // ifdef PDEBUG // Sorry: the following was lost........ :((((((((
65 ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
66 #define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
67 
68 inline ideal idCopy(ideal A)
69 {
70  return id_DBCopy(A,currRing); // well, just for now... ok? Macros can't have default args values :(
71 }
72 #else
73 inline ideal idCopy(ideal A)
74 {
75  return id_Copy(A, currRing);
76 }
77 #endif
78 
79 
80 /// h1 + h2
81 inline ideal idAdd (ideal h1, ideal h2)
82 {
83  return id_Add(h1, h2, currRing);
84 }
85 
86 BOOLEAN idInsertPoly (ideal h1,poly h2); /* h1 + h2 */
87 inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
88 {
89  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);
90 }
91 
92 
93 /* h1 + h2 */
94 
95 /// hh := h1 * h2
96 inline ideal idMult (ideal h1, ideal h2)
97 {
98  return id_Mult(h1, h2, currRing);
99 }
100 
101 BOOLEAN idIs0 (ideal h);
102 
103 inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
104 {
105  return id_HomIdeal(id, Q, currRing);
106 }
107 
108 inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w)
109 {
110  return id_HomModule(m, Q, w, currRing);
111 }
112 
113 BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w);
114 
115 ideal idMinBase (ideal h1);
116  /*returns a minimized set of generators of h1*/
117 void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
118 void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
119 int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
120 
121 int binom (int n,int r);
122 
123 inline ideal idFreeModule (int i)
124 {
125  return id_FreeModule (i, currRing);
126 }
127 
128 
129 ideal idSect (ideal h1,ideal h2);
130 ideal idMultSect(resolvente arg, int length);
131 
132 //ideal idSyzygies (ideal h1, tHomog h,intvec **w);
133 ideal idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
134  BOOLEAN setRegularity=FALSE, int *deg = NULL);
135 ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL);
136 
137 ideal idLift (ideal mod, ideal sumod,ideal * rest=NULL,
138  BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
139  matrix *unit=NULL);
140 
141 void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL );
142 
143 intvec * idMWLift(ideal mod,intvec * weights);
144 
145 ideal idQuot (ideal h1,ideal h2,
146  BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
147 
148 // ideal idPower(ideal gid,int deg);
149 
150 //ideal idElimination (ideal h1,poly delVar);
151 ideal idElimination (ideal h1,poly delVar, intvec *hilb=NULL);
152 
153 #ifdef WITH_OLD_MINOR
154 poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL);
155 #endif
156 ideal idMinors(matrix a, int ar, ideal R = NULL);
157 
158 ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
159 
160 ideal idHead(ideal h);
161 
162 // ideal idHomogen(ideal h, int varnum);
163 
164 BOOLEAN idIsSubModule(ideal id1,ideal id2);
165 
166 static inline ideal idVec2Ideal(poly vec)
167 {
168  return id_Vec2Ideal(vec, currRing);
169 }
170 
171 ideal idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL);
172 
173 static inline BOOLEAN idIsZeroDim(ideal i)
174 {
175  return id_IsZeroDim(i, currRing);
176 }
177 
178 matrix idDiff(matrix i, int k);
179 matrix idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
180 
181 static inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE)
182 {
183  return id_Sort(id, nolex, currRing);
184 }
185 
186 ideal idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL);
187 matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how);
188 
189 // intvec *idQHomWeight(ideal id);
190 
191 ideal idXXX (ideal h1, int k);
192 
193 poly id_GCD(poly f, poly g, const ring r);
194 
195 ideal id_Farey(ideal x, number N, const ring r);
196 
197 ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
198 
199 
200 #endif
ideal id_FreeModule(int i, const ring r)
the free module of rank i
const poly a
Definition: syzextra.cc:212
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, short *w=NULL)
Definition: ideals.cc:1130
#define FALSE
Definition: auxiliary.h:140
ideal idXXX(ideal h1, int k)
Definition: ideals.cc:701
ideal id_Copy(ideal h1, const ring r)
copy an ideal
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)
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:2035
#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:2175
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:181
ideal idLift(ideal mod, ideal sumod, ideal *rest=NULL, BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE, BOOLEAN divide=FALSE, matrix *unit=NULL)
Definition: ideals.cc:935
void idDelEquals(ideal id)
Definition: ideals.cc:2647
#define Q
Definition: sirandom.c:25
ideal idLiftStd(ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL)
Definition: ideals.cc:748
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:173
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:1933
#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:1400
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
Definition: ideals.cc:2344
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:2578
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)
compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R ...
Definition: ideals.cc:1791
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2278
ideal idFreeModule(int i)
Definition: ideals.h:123
#define A
Definition: sirandom.c:23
poly id_GCD(poly f, poly g, const ring r)
Definition: ideals.cc:2402
const ring R
Definition: DebugPrint.cc:36
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)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
int m
Definition: cfEzgcd.cc:119
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:24
ideal idCopy(ideal A)
Definition: ideals.h:73
ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition: ideals.h:96
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...
BOOLEAN idInsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
Definition: ideals.h:87
static ideal idCopyFirstK(const ideal ide, const int k)
Definition: ideals.h:22
#define NULL
Definition: omList.c:10
BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:103
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp=TRUE, BOOLEAN setRegularity=FALSE, int *deg=NULL)
Definition: ideals.cc:557
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2
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 id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2502
BOOLEAN idIsSubModule(ideal id1, ideal id2)
Definition: ideals.cc:1860
ideal * resolvente
Definition: ideals.h:20
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE)
Definition: ideals.cc:1307
BOOLEAN id_IsZeroDim(ideal I, const ring r)
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
copies the first k (>= 1) entries of the given ideal/module and returns these as a new ideal/module (...
matrix idDiffOp(ideal I, ideal J, BOOLEAN multiply=TRUE)
Definition: ideals.cc:1963
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:43
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:81
ideal id_Vec2Ideal(poly vec, const ring R)
kBucketDestroy & P
Definition: myNF.cc:191
static ideal idVec2Ideal(poly vec)
Definition: ideals.h:166
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
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:1881
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:108
int binom(int n, int r)
matrix idDiff(matrix i, int k)
Definition: ideals.cc:1950
int l
Definition: cfEzgcd.cc:94