source: git/kernel/ideals.h @ a82c308

spielwiese
Last change on this file since a82c308 was a82c308, checked in by Martin Lee <martinlee84@…>, 12 years ago
fix: idIsZeroDim
  • Property mode set to 100644
File size: 5.7 KB
Line 
1#ifndef IDEALS_H
2#define IDEALS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT - all basic methods to manipulate ideals
9*/
10#include <polys/simpleideals.h>
11#include <kernel/polys.h>
12
13#include <kernel/structs.h> // for tHomog
14
15//typedef struct sip_sideal *        ideal;
16//typedef struct sip_smap *          map;
17typedef ideal *            resolvente;
18
19extern ideal currQuotient;
20
21
22inline ideal idCopyFirstK (const ideal ide, const int k, ring R = currRing)
23{
24  return id_CopyFirstK(ide, k, R);
25}
26
27/// delete an ideal
28inline void idDelete (ideal* h, ring r = currRing)
29{ 
30  id_Delete(h, r); 
31}
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)
43static 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#ifdef PDEBUG
58#define idTest(A) id_DBTest(A, PDEBUG, __FILE__,__LINE__,currRing)
59#define idPrint(id) idShow(id, currRing, currRing)
60#else
61#define idTest(A)  (TRUE)
62#define idPrint(A) ((void)0)
63#endif
64
65ideal id_Copy (ideal h1, const ring r);
66
67#if 0
68
69// ifdef PDEBUG // Sorry: the following was lost........ :((((((((
70ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
71#define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
72
73inline ideal idCopy(ideal A, const ring R = currRing)
74{
75  return id_DBCopy(A,R); // well, just for now... ok? Macros can't  have default args values :(
76}
77#else
78inline ideal idCopy(ideal A, const ring R = currRing)
79{
80  return id_Copy(A, R);
81}
82#endif
83
84
85/// h1 + h2
86inline ideal idAdd (ideal h1, ideal h2, const ring R = currRing)
87{
88  return id_Add(h1, h2, R);
89}
90
91BOOLEAN idInsertPoly (ideal h1,poly h2);  /* h1 + h2 */
92inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring R = currRing)
93{
94  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, R);
95}
96
97
98/* h1 + h2 */
99
100/// hh := h1 * h2
101inline ideal idMult (ideal h1, ideal h2, const ring R = currRing)
102{
103  return id_Mult(h1, h2, R);
104}
105
106BOOLEAN idIs0 (ideal h);
107
108// returns TRUE, if idRankFreeModule(m) > 0
109BOOLEAN idIsModule(ideal m, const ring r);
110
111inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL, const ring R = currRing)
112{
113  return id_HomIdeal(id, Q, R);
114}
115
116inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w, const ring R = currRing)
117{
118   return id_HomModule(m, Q, w, R);
119}
120
121BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w);
122
123ideal idMinBase (ideal h1);
124  /*returns a minimized set of generators of h1*/
125void    idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
126void    idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
127int     idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
128
129int     binom (int n,int r);
130
131inline ideal idFreeModule (int i, const ring R = currRing)
132{
133  return id_FreeModule (i, R);
134}
135
136
137ideal   idSect (ideal h1,ideal h2);
138ideal   idMultSect(resolvente arg, int length);
139
140//ideal   idSyzygies (ideal h1, tHomog h,intvec **w);
141ideal   idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
142                    BOOLEAN setRegularity=FALSE, int *deg = NULL);
143ideal   idLiftStd  (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL);
144
145ideal   idLift (ideal mod, ideal sumod,ideal * rest=NULL,
146             BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
147             matrix *unit=NULL);
148
149void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL );
150
151intvec * idMWLift(ideal mod,intvec * weights);
152
153ideal   idQuot (ideal h1,ideal h2,
154                BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
155
156// ideal   idPower(ideal gid,int deg);
157
158//ideal   idElimination (ideal h1,poly delVar);
159ideal   idElimination (ideal h1,poly delVar, intvec *hilb=NULL);
160
161poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL);
162ideal   idMinors(matrix a, int ar, ideal R = NULL);
163
164ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
165
166ideal   idHead(ideal h);
167
168// ideal   idHomogen(ideal h, int varnum);
169
170BOOLEAN idIsSubModule(ideal id1,ideal id2);
171
172inline ideal idVec2Ideal(poly vec, const ring R = currRing)
173{
174  return id_Vec2Ideal(vec, R);
175}
176
177ideal   idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL);
178
179inline BOOLEAN idIsZeroDim(ideal i, const ring R = currRing)
180{
181  return id_IsZeroDim(i, R);
182}
183
184matrix  idDiff(matrix i, int k);
185matrix  idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
186
187inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE, const ring R = currRing)
188{
189  return id_Sort(id, nolex, R);
190}
191
192ideal   idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL);
193matrix  idCoeffOfKBase(ideal arg, ideal kbase, poly how);
194
195/// transpose a module
196inline ideal   idTransp(ideal a, const ring R = currRing)
197{
198  return id_Transp(a, R);
199}
200
201// intvec *idQHomWeight(ideal id);
202
203ideal idXXX (ideal  h1, int k);
204
205poly id_GCD(poly f, poly g, const ring r);
206
207ideal id_ChineseRemainder(ideal *x, number *q, int rl, const ring R);
208//ideal idChineseRemainder(ideal *x, intvec *iv); /* currently unused */
209ideal id_Farey(ideal x, number N, const ring r);
210
211ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
212
213
214#endif
Note: See TracBrowser for help on using the repository browser.