source: git/kernel/ideals.h @ f91f8f3

fieker-DuValspielwiese
Last change on this file since f91f8f3 was 5f24ec, checked in by Oleksandr Motsak <motsak@…>, 9 years ago
Reviewing 0-size ideals/modules ADD: added assume's, esp. concerning corner cases ADD: doxygen documentation for id* functions and sip_sideal structure CHG: minor improvements CHG: moved id_IsModule back to where it came from NOTE: id_Delete will also be used for dense matrices
  • Property mode set to 100644
File size: 5.2 KB
Line 
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>
11#include <polys/monomials/p_polys.h>
12#include <polys/simpleideals.h>
13
14extern ring currRing;
15
16#include <kernel/structs.h> // for tHomog
17
18//typedef struct sip_sideal *        ideal;
19//typedef struct sip_smap *          map;
20typedef ideal *            resolvente;
21
22inline ideal idCopyFirstK (const ideal ide, const int k)
23{
24  return id_CopyFirstK(ide, k, currRing);
25}
26
27void idKeepFirstK(ideal ide, const int k);
28void idDelEquals(ideal id);
29
30/// delete an ideal
31inline void idDelete (ideal* h)
32{
33  id_Delete(h, currRing);
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)
46static 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
60ideal 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........ :((((((((
68ideal idDBCopy(ideal h1,const char *f,int l,const ring r);
69#define id_DBCopy(A,r) idDBCopy(A,__FILE__,__LINE__,r)
70
71inline ideal idCopy(ideal A)
72{
73  return id_DBCopy(A,currRing); // well, just for now... ok? Macros can't  have default args values :(
74}
75#else
76inline ideal idCopy(ideal A)
77{
78  return id_Copy(A, currRing);
79}
80#endif
81
82
83/// h1 + h2
84inline ideal idAdd (ideal h1, ideal h2)
85{
86  return id_Add(h1, h2, currRing);
87}
88
89BOOLEAN idInsertPoly (ideal h1,poly h2);  /* h1 + h2 */
90inline BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
91{
92  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);
93}
94
95
96/* h1 + h2 */
97
98/// hh := h1 * h2
99inline ideal idMult (ideal h1, ideal h2)
100{
101  return id_Mult(h1, h2, currRing);
102}
103
104BOOLEAN idIs0 (ideal h);
105
106inline BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
107{
108  return id_HomIdeal(id, Q, currRing);
109}
110
111inline BOOLEAN idHomModule(ideal m, ideal Q,intvec **w)
112{
113   return id_HomModule(m, Q, w, currRing);
114}
115
116BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w);
117
118ideal idMinBase (ideal h1);
119  /*returns a minimized set of generators of h1*/
120void    idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
121void    idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
122int     idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
123
124int     binom (int n,int r);
125
126inline ideal idFreeModule (int i)
127{
128  return id_FreeModule (i, currRing);
129}
130
131
132ideal   idSect (ideal h1,ideal h2);
133ideal   idMultSect(resolvente arg, int length);
134
135//ideal   idSyzygies (ideal h1, tHomog h,intvec **w);
136ideal   idSyzygies (ideal h1, tHomog h,intvec **w, BOOLEAN setSyzComp=TRUE,
137                    BOOLEAN setRegularity=FALSE, int *deg = NULL);
138ideal   idLiftStd  (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL);
139
140ideal   idLift (ideal mod, ideal sumod,ideal * rest=NULL,
141             BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
142             matrix *unit=NULL);
143
144void idLiftW(ideal P,ideal Q,int n,matrix &T, ideal &R, short *w= NULL );
145
146intvec * idMWLift(ideal mod,intvec * weights);
147
148ideal   idQuot (ideal h1,ideal h2,
149                BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE);
150
151// ideal   idPower(ideal gid,int deg);
152
153//ideal   idElimination (ideal h1,poly delVar);
154ideal   idElimination (ideal h1,poly delVar, intvec *hilb=NULL);
155
156#ifdef WITH_OLD_MINOR
157poly idMinor(matrix a, int ar, unsigned long which, ideal R = NULL);
158#endif
159ideal   idMinors(matrix a, int ar, ideal R = NULL);
160
161ideal idMinEmbedding(ideal arg,BOOLEAN inPlace=FALSE, intvec **w=NULL);
162
163ideal   idHead(ideal h);
164
165// ideal   idHomogen(ideal h, int varnum);
166
167BOOLEAN idIsSubModule(ideal id1,ideal id2);
168
169inline ideal idVec2Ideal(poly vec)
170{
171  return id_Vec2Ideal(vec, currRing);
172}
173
174ideal   idSeries(int n,ideal M,matrix U=NULL,intvec *w=NULL);
175
176inline BOOLEAN idIsZeroDim(ideal i)
177{
178  return id_IsZeroDim(i, currRing);
179}
180
181matrix  idDiff(matrix i, int k);
182matrix  idDiffOp(ideal I, ideal J,BOOLEAN multiply=TRUE);
183
184inline intvec *idSort(ideal id,BOOLEAN nolex=TRUE)
185{
186  return id_Sort(id, nolex, currRing);
187}
188
189ideal   idModulo (ideal h1,ideal h2, tHomog h=testHomog, intvec ** w=NULL);
190matrix  idCoeffOfKBase(ideal arg, ideal kbase, poly how);
191
192/// transpose a module
193inline ideal   idTransp(ideal a)
194{
195  return id_Transp(a, currRing);
196}
197
198// intvec *idQHomWeight(ideal id);
199
200ideal idXXX (ideal  h1, int k);
201
202poly id_GCD(poly f, poly g, const ring r);
203
204ideal id_Farey(ideal x, number N, const ring r);
205
206ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
207
208
209#endif
Note: See TracBrowser for help on using the repository browser.