My Project  debian-1:4.1.2-p1+ds-2
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 "polys/monomials/ring.h"
10 #include "polys/matpol.h"
11 
12 /// The following sip_sideal structure has many different uses
13 /// thoughout Singular. Basic use-cases for it are:
14 /// * ideal/module: nrows = 1, ncols >=0 and rank:1 for ideals, rank>=0 for modules
15 /// * matrix: nrows, ncols >=0, rank == nrows! see mp_* procedures
16 /// NOTE: the m member point to memory chunk of size (ncols*nrows*sizeof(poly)) or is NULL
17 struct sip_sideal
18 {
19  poly* m;
20  long rank;
21  int nrows;
22  int ncols;
23  #define IDELEMS(i) ((i)->ncols)
24  #define MATCOLS(i) ((i)->ncols)
25  #define MATROWS(i) ((i)->nrows)
26  #define MATELEM(mat,i,j) ((mat)->m)[MATCOLS((mat)) * ((i)-1) + (j)-1]
27 
28 };
29 /* the settings of rank, nrows, ncols, m , entries:
30  * for IDEAL_CMD: 1 1 n size n poly (n>=0)
31  * for MODUL_CMD: r 1 n size n vector of rank<=r (n>=0, r>=0)
32  * for MATRIX_CMD r r c size r*c poly (r>=0, c>=0)
33  * for MAP_CMD: char* 1 n size n poly (n>=0)
34  */
35 
36 struct sip_smap
37 {
38  poly *m;
39  char *preimage;
40  int nrows;
41  int ncols;
42 };
43 
44 //typedef struct sip_smap * map;
45 
46 struct sideal_list;
47 typedef struct sideal_list * ideal_list;
48 
49 struct sideal_list
50 {
51  ideal_list next;
52  ideal d;
53 #ifdef KDEBUG
54  int nr;
55 #endif
56 };
57 
59 
60 /// creates an ideal / module
61 ideal idInit (int size, int rank=1);
62 
63 /*- deletes an ideal -*/
64 void id_Delete (ideal* h, ring r);
65 void id_ShallowDelete (ideal* h, ring r);
66 void idSkipZeroes (ideal ide);
67  /*gives an ideal the minimal possible size*/
68 
69 /// number of non-zero polys in F
70 int idElem(const ideal F);
71 /// normialize all polys in id
72 void id_Normalize(ideal id, const ring r);
73 
74 int id_MinDegW(ideal M,intvec *w, const ring r);
75 
76 #ifdef PDEBUG
77 void id_DBTest(ideal h1, int level, const char *f,const int l, const ring lR, const ring tR );
78 #define id_TestTail(A, lR, tR) id_DBTest(A, PDEBUG, __FILE__,__LINE__, lR, tR)
79 #define id_Test(A, lR) id_DBTest(A, PDEBUG, __FILE__,__LINE__, lR, lR)
80 #else
81 #define id_TestTail(A, lR, tR) do {} while (0)
82 #define id_Test(A, lR) do {} while (0)
83 #endif
84 
85 ideal id_Copy (ideal h1,const ring r);
86 
87  /*adds two ideals without simplifying the result*/
88 ideal id_SimpleAdd (ideal h1,ideal h2, const ring r);
89  /*adds the quotient ideal*/
90 ideal id_Add (ideal h1,ideal h2,const ring r);
91  /* h1 + h2 */
92 
93 ideal id_Power(ideal given,int exp, const ring r);
94 BOOLEAN idIs0 (ideal h);
95 
96 long id_RankFreeModule(ideal m, ring lmRing, ring tailRing);
97 static inline long id_RankFreeModule(ideal m, ring r)
98 {return id_RankFreeModule(m, r, r);}
99 
100 ideal id_FreeModule (int i, const ring r);
101 int idElem(const ideal F);
102 int id_PosConstant(ideal id, const ring r);
103 ideal id_Head(ideal h,const ring r);
104 ideal id_MaxIdeal (const ring r);
105 ideal id_MaxIdeal(int deg, const ring r);
106 ideal id_CopyFirstK (const ideal ide, const int k,const ring r);
107 void id_DelMultiples(ideal id, const ring r);
108 void id_Norm(ideal id, const ring r);
109 void id_DelEquals(ideal id, const ring r);
110 void id_DelLmEquals(ideal id, const ring r);
111 void id_DelDiv(ideal id, const ring r);
112 BOOLEAN id_IsConstant(ideal id, const ring r);
113 
114 /// sorts the ideal w.r.t. the actual ringordering
115 /// uses lex-ordering when nolex = FALSE
116 intvec *id_Sort(const ideal id, const BOOLEAN nolex, const ring r);
117 
118 /// transpose a module
119 ideal id_Transp(ideal a, const ring rRing);
120 
121 void id_Compactify(ideal id, const ring r);
122 ideal id_Mult (ideal h1,ideal h2, const ring r);
123 ideal id_Homogen(ideal h, int varnum,const ring r);
124 BOOLEAN id_HomIdeal (ideal id, ideal Q, const ring r);
125 BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R);
126 BOOLEAN id_IsZeroDim(ideal I, const ring r);
127 ideal id_Jet(const ideal i,int d, const ring R);
128 ideal id_JetW(const ideal i,int d, intvec * iv, const ring R);
129 ideal id_Subst(ideal id, int n, poly e, const ring r);
130 matrix id_Module2Matrix(ideal mod, const ring R);
131 matrix id_Module2formatedMatrix(ideal mod,int rows, int cols, const ring R);
132 ideal id_ResizeModule(ideal mod,int rows, int cols, const ring R);
133 ideal id_Matrix2Module(matrix mat, const ring R);
134 ideal id_Vec2Ideal(poly vec, const ring R);
135 
136 int id_ReadOutPivot(ideal arg, int* comp, const ring r);
137 
138 int binom (int n,int r);
139 
140  /*- verschiebt die Indizes der Modulerzeugenden um i -*/
141 void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
142 void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
143 int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
144 
145 #ifdef PDEBUG
146 void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint = 0);
147 #define id_Print(id, lR, tR) idShow(id, lR, tR)
148 #else
149 #define id_Print(A, lR, tR) do {} while (0)
150 #endif
151 
152 
153 
154 /// insert h2 into h1 depending on the two boolean parameters:
155 /// - if zeroOk is true, then h2 will also be inserted when it is zero
156 /// - if duplicateOk is true, then h2 will also be inserted when it is
157 /// already present in h1
158 /// return TRUE iff h2 was indeed inserted
159 BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries,
160  const poly h2, const bool zeroOk,
161  const bool duplicateOk, const ring r);
162 
163 
164 intvec * id_QHomWeight(ideal id, const ring r);
165 
166 
167 ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r);
168 
169 void id_Shift(ideal M, int s, const ring r);
170 ideal id_Delete_Pos(const ideal I, const int pos, const ring r);
171 
172 /// for julia: convert an array of poly to vector
173 poly id_Array2Vector(poly *m, unsigned n, const ring R);
174 #endif
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:776
id_IsZeroDim
BOOLEAN id_IsZeroDim(ideal I, const ring r)
Definition: simpleideals.cc:1687
id_DBTest
void id_DBTest(ideal h1, int level, const char *f, const int l, const ring lR, const ring tR)
Internal verification for ideals/modules and dense matrices!
Definition: simpleideals.cc:424
ip_smatrix
Definition: matpol.h:13
f
FILE * f
Definition: checklibs.c:9
id_Compactify
void id_Compactify(ideal id, const ring r)
Definition: simpleideals.cc:1159
id_Vec2Ideal
ideal id_Vec2Ideal(poly vec, const ring R)
Definition: simpleideals.cc:1207
k
int k
Definition: cfEzgcd.cc:92
id_MinDegW
int id_MinDegW(ideal M, intvec *w, const ring r)
Definition: simpleideals.cc:1716
id_DelDiv
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
Definition: simpleideals.cc:350
idGetNumberOfChoise
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
Definition: simpleideals.cc:889
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:863
sip_sideal_bin
EXTERN_VAR omBin sip_sideal_bin
Definition: simpleideals.h:57
id_MaxIdeal
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)
Definition: simpleideals.cc:97
h
STATIC_VAR Poly * h
Definition: janet.cc:971
id_Sort
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
Definition: simpleideals.cc:511
id_CopyFirstK
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 (...
Definition: simpleideals.cc:234
idInit
ideal idInit(int size, int rank=1)
creates an ideal / module
Definition: simpleideals.cc:34
level
int level(const CanonicalForm &f)
Definition: canonicalform.h:324
mod
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
id_Matrix2Module
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
Definition: simpleideals.cc:1239
id_Subst
ideal id_Subst(ideal id, int n, poly e, const ring r)
Definition: simpleideals.cc:1388
id_HomModule
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
Definition: simpleideals.cc:1403
sip_smap
Definition: simpleideals.h:35
id_ReadOutPivot
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
Definition: simpleideals.cc:1563
sideal_list::next
ideal_list next
Definition: simpleideals.h:50
id_Transp
ideal id_Transp(ideal a, const ring rRing)
transpose a module
Definition: simpleideals.cc:1736
idShow
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint=0)
Definition: simpleideals.cc:56
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
id_Normalize
void id_Normalize(ideal id, const ring r)
normialize all polys in id
Definition: simpleideals.cc:1706
sip_smap::preimage
char * preimage
Definition: simpleideals.h:38
id_HomIdeal
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
Definition: simpleideals.cc:814
id_Add
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2
Definition: simpleideals.cc:722
i
int i
Definition: cfEzgcd.cc:125
id_ResizeModule
ideal id_ResizeModule(ideal mod, int rows, int cols, const ring R)
Definition: simpleideals.cc:1351
matpol.h
sip_smap::m
poly * m
Definition: simpleideals.h:37
M
#define M
Definition: sirandom.c:25
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:87
sip_sideal::ncols
int ncols
Definition: simpleideals.h:22
sip_sideal::m
poly * m
Definition: simpleideals.h:19
id_DelLmEquals
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.
Definition: simpleideals.cc:322
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:841
id_FreeModule
ideal id_FreeModule(int i, const ring r)
the free module of rank i
Definition: simpleideals.cc:943
id_Shift
void id_Shift(ideal M, int s, const ring r)
Definition: simpleideals.cc:1918
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
intvec
Definition: intvec.h:18
Q
STATIC_VAR jList * Q
Definition: janet.cc:30
id_ShallowDelete
void id_ShallowDelete(ideal *h, ring r)
Shallowdeletes an ideal/matrix.
Definition: simpleideals.cc:156
binom
int binom(int n, int r)
Definition: simpleideals.cc:921
id_RankFreeModule
long id_RankFreeModule(ideal m, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:790
id_DelMultiples
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
Definition: simpleideals.cc:264
id_Delete_Pos
ideal id_Delete_Pos(const ideal I, const int pos, const ring r)
Definition: simpleideals.cc:1932
id_InsertPolyWithTests
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:
Definition: simpleideals.cc:694
sip_smap::ncols
int ncols
Definition: simpleideals.h:40
sideal_list
Definition: simpleideals.h:48
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:356
ring.h
omBin
omBin_t * omBin
Definition: omStructs.h:11
id_Norm
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
Definition: simpleideals.cc:250
idElem
int idElem(const ideal F)
number of non-zero polys in F
Definition: simpleideals.cc:218
id_PosConstant
int id_PosConstant(ideal id, const ring r)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: simpleideals.cc:79
sip_sideal
The following sip_sideal structure has many different uses thoughout Singular. Basic use-cases for it...
Definition: simpleideals.h:16
id_Mult
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...
Definition: simpleideals.cc:735
id_Head
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
Definition: simpleideals.cc:1183
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:122
sip_sideal::nrows
int nrows
Definition: simpleideals.h:21
id_Module2Matrix
matrix id_Module2Matrix(ideal mod, const ring R)
Definition: simpleideals.cc:1273
id_JetW
ideal id_JetW(const ideal i, int d, intvec *iv, const ring R)
Definition: simpleideals.cc:1539
m
int m
Definition: cfEzgcd.cc:121
id_SimpleAdd
ideal id_SimpleAdd(ideal h1, ideal h2, const ring r)
concat the lists h1 and h2 without zeros
Definition: simpleideals.cc:606
l
int l
Definition: cfEzgcd.cc:93
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:180
id_ChineseRemainder
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
Definition: simpleideals.cc:1869
sideal_list::nr
int nr
Definition: simpleideals.h:53
R
#define R
Definition: sirandom.c:27
sideal_list::d
ideal d
Definition: simpleideals.h:51
id_DelEquals
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
Definition: simpleideals.cc:299
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition: simpleideals.cc:412
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition: facSparseHensel.h:25
id_Module2formatedMatrix
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
Definition: simpleideals.cc:1319
id_Array2Vector
poly id_Array2Vector(poly *m, unsigned n, const ring R)
for julia: convert an array of poly to vector
Definition: simpleideals.cc:1216
id_IsConstant
BOOLEAN id_IsConstant(ideal id, const ring r)
test if the ideal has only constant polynomials NOTE: zero ideal/module is also constant
Definition: simpleideals.cc:399
id_Homogen
ideal id_Homogen(ideal h, int varnum, const ring r)
Definition: simpleideals.cc:1194
sip_sideal::rank
long rank
Definition: simpleideals.h:20
id_Power
ideal id_Power(ideal given, int exp, const ring r)
Definition: simpleideals.cc:1133
EXTERN_VAR
#define EXTERN_VAR
Definition: globaldefs.h:6
sip_smap::nrows
int nrows
Definition: simpleideals.h:39
id_QHomWeight
intvec * id_QHomWeight(ideal id, const ring r)
Definition: simpleideals.cc:1640
id_Jet
ideal id_Jet(const ideal i, int d, const ring R)
Definition: simpleideals.cc:1526
vec
fq_nmod_poly_t * vec
Definition: facHensel.cc:103