source: git/libpolys/polys/ideals.h @ 028192

spielwiese
Last change on this file since 028192 was 028192, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
FIX: p_polys.cc, ring.cc (mostly NC-stuff + ideals/matrices/numbers)
  • Property mode set to 100644
File size: 6.4 KB
RevLine 
[35aab3]1#ifndef IDEALS_H
2#define IDEALS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
[341696]6/* $Id$ */
[35aab3]7/*
8* ABSTRACT - all basic methods to manipulate ideals
9*/
[028192]10// #include <kernel/structs.h>
11
12#include <polys/monomials/ring.h>
[35aab3]13
[b07ba77]14struct sip_sideal
15{
16  poly*  m;
17  long rank;
18  int nrows;
19  int ncols;
20  #define IDELEMS(i) ((i)->ncols)
[028192]21  #define MATCOLS(i) ((i)->ncols)
22  #define MATROWS(i) ((i)->nrows)
23  #define MATELEM(mat,i,j) ((mat)->m)[MATCOLS((mat)) * ((i)-1) + (j)-1]
24   
[b07ba77]25};
26
27struct sip_smap
28{
29  poly *m;
30  char *preimage;
31  int nrows;
32  int ncols;
33};
34
[028192]35class ip_smatrix;
36typedef ip_smatrix *       matrix;
37
[b07ba77]38struct sideal_list;
39typedef struct sideal_list *      ideal_list;
[028192]40
[b07ba77]41struct sideal_list
42{
43  ideal_list next;
44  ideal      d;
45#ifndef NDEBUG
46  int nr;
47#endif
48};
49
50//typedef struct sip_sideal *        ideal;
51//typedef struct sip_smap *          map;
52typedef ideal *            resolvente;
53
54
55extern omBin sip_sideal_bin;
56
[35aab3]57/*- creates an ideal -*/
58ideal idInit (int size, int rank=1);
[1919112]59ideal idCopyFirstK (const ideal ide, const int k);
[e9c3b2]60
61/// delete an ideal
[028192]62// #define idDelete(h) id_Delete(h, currRing)
[35aab3]63void id_Delete (ideal* h, ring r);
64void id_ShallowDelete (ideal* h, ring r);
[e9c3b2]65/*- initialise an ideal -*/ // ?
66
67/// initialise the maximal ideal (at 0)
[35aab3]68ideal idMaxIdeal (int deg);
[e9c3b2]69
70/// gives an ideal the minimal possible size
[35aab3]71void idSkipZeroes (ideal ide);
[e9c3b2]72
73/// index of generator with leading term in ground ring (if any); otherwise -1
[dd5534]74int idPosConstant (ideal id);
[e9c3b2]75
76/// Count the effective size of an ideal
77/// (without the trailing allocated zero-elements)
78static inline int idSize(const ideal id)
79{
80  int j = IDELEMS(id) - 1;
81  poly* mm = id->m;
82  while ((j >= 0) && (mm[j] == NULL)) j--;
83  return (j + 1); 
[27fc50]84}
[e9c3b2]85
[35aab3]86void idNorm(ideal id);
87void idDelMultiples(ideal id);
88void idDelEquals(ideal id);
89void idDelLmEquals(ideal id);
90void idDelDiv(ideal id);
91BOOLEAN idIsConstant(ideal id);
92
93#ifdef PDEBUG
[85e68dd]94void idDBTest(ideal h1, int level, const char *f,const int l);
[35aab3]95#define idTest(A) idDBTest(A, PDEBUG, __FILE__,__LINE__)
96#define idPrint(id) idShow(id)
97#else
98#define idTest(A)  (TRUE)
99#define idPrint(A) ((void)0)
100#endif
101
[d523f3]102ideal id_Copy (ideal h1,const ring r);
[028192]103#ifdef PDEBUG
104ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
105#define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
106#define idCopy(A,r) id_DBCopy(A,r)
107#else
108#define idCopy(A,r) id_Copy(A,r)
109#endif
110
111
[35aab3]112  /*adds two ideals without simplifying the result*/
113ideal idSimpleAdd (ideal h1,ideal h2);
114  /*adds the quotient ideal*/
115ideal idAdd (ideal h1,ideal h2);
116  /* h1 + h2 */
[ded085]117BOOLEAN idInsertPoly (ideal h1,poly h2);
[e070895]118  /* h1 + h2 */
[2b3caae]119BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries,
120  const poly h2, const bool zeroOk, const bool duplicateOk);
[1a68d1d]121  /* h1 + h2 */
[35aab3]122ideal idMult (ideal h1,ideal h2);
123  /*hh := h1 * h2*/
124
125BOOLEAN idIs0 (ideal h);
126
127long idRankFreeModule(ideal m, ring lmRing, ring tailRing);
[028192]128
129static inline long idRankFreeModule(ideal m, ring r){ return idRankFreeModule(m, r, r); }
130
[35aab3]131// returns TRUE, if idRankFreeModule(m) > 0
[028192]132BOOLEAN idIsModule(ideal m, const ring r);
[35aab3]133BOOLEAN idHomIdeal (ideal id, ideal Q=NULL);
134BOOLEAN idHomModule(ideal m, ideal Q,intvec **w);
[30b8381]135BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w);
[35aab3]136
137ideal idMinBase (ideal h1);
138  /*returns a minimized set of generators of h1*/
139int pLowVar (poly p);
140  /*-the minimal index of used variables - 1-*/
141void pShift (poly * p,int i);
142  /*- verschiebt die Indizes der Modulerzeugenden um i -*/
143void    idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
144void    idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
145int     idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
146
147int     binom (int n,int r);
148
149ideal   idFreeModule (int i);
150
151ideal   idSect (ideal h1,ideal h2);
152ideal   idMultSect(resolvente arg, int length);
153
154//ideal   idSyzygies (ideal h1, tHomog h,intvec **w);
155ideal   idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
156                    BOOLEAN setRegularity=FALSE, int *deg = NULL);
[81dab73]157ideal   idLiftStd  (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL);
[35aab3]158
159ideal   idLift (ideal mod, ideal sumod,ideal * rest=NULL,
160             BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
161             matrix *unit=NULL);
162
163void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL );
164
165intvec * idMWLift(ideal mod,intvec * weights);
166
167ideal   idQuot (ideal h1,ideal h2,
168                BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
169
170ideal   idPower(ideal gid,int deg);
171
172//ideal   idElimination (ideal h1,poly delVar);
173ideal   idElimination (ideal h1,poly delVar, intvec *hilb=NULL);
174
[0a64b14]175poly idMinor(matrix a, int ar, unsigned long which, ideal R=NULL);
176
[35aab3]177ideal   idMinors(matrix a, int ar, ideal R=NULL);
178
[10ea45f]179void   idCompactify(ideal id);
[35aab3]180
[cf108d]181ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
[35aab3]182
183ideal   idHead(ideal h);
184
185ideal   idHomogen(ideal h, int varnum);
186
187BOOLEAN idIsSubModule(ideal id1,ideal id2);
188
189ideal   idVec2Ideal(poly vec);
190
191ideal   idMatrix2Module(matrix mat);
192
193matrix  idModule2Matrix(ideal mod);
194
195matrix  idModule2formatedMatrix(ideal mod,int rows, int cols);
196
197ideal   idSubst(ideal i, int n, poly e);
198
199ideal   idJet(ideal i,int d);
200ideal   idJetW(ideal i,int d, intvec * iv);
201int idMinDegW(ideal M,intvec *w);
202ideal   idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL);
203
204BOOLEAN idIsZeroDim(ideal i);
205matrix  idDiff(matrix i, int k);
206matrix  idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
207
208intvec *idSort(ideal id,BOOLEAN nolex=TRUE);
[cf108d]209ideal   idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL);
[b3930d]210int     idElem(const ideal F);
[35aab3]211matrix  idCoeffOfKBase(ideal arg, ideal kbase, poly how);
[90a60f]212// transpose a module
[35aab3]213ideal   idTransp(ideal a);
[90a60f]214// version of "ideal idTransp(ideal)" which works within a given ring.
[028192]215ideal id_Transp(ideal a, const ring rRing);
[90a60f]216
[35aab3]217intvec *idQHomWeight(ideal id);
218
219void    idNormalize(ideal id);
220
221ideal idXXX (ideal  h1, int k);
[225d94]222
223poly id_GCD(poly f, poly g, const ring r);
[bba835]224
225ideal idChineseRemainder(ideal *x, number *q, int rl);
[3580b7]226//ideal idChineseRemainder(ideal *x, intvec *iv); /* currently unused */
[3149a5]227ideal idFarey(ideal x, number N);
[90a60f]228
[028192]229ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
[90a60f]230
[e9c3b2]231#ifdef PDEBUG
[1a4313]232/* Shows an ideal -- only for debugging */
[028192]233void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint = 0);
[e9c3b2]234#else
235#define idShow(id, lmRing, tailRing, debugPrint) ((void)0)
[1a4313]236#endif
[35aab3]237#endif
Note: See TracBrowser for help on using the repository browser.