source: git/libpolys/polys/simpleideals.h @ 644f81

jengelh-datetimespielwiese
Last change on this file since 644f81 was 644f81, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
eliminates some more of compiler warnings: "unused result value"
  • Property mode set to 100644
File size: 4.5 KB
Line 
1#ifndef SIMPLEIDEALS_H
2#define SIMPLEIDEALS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT - all basic methods to manipulate ideals
9*/
10#include <omalloc/omalloc.h>
11#include <polys/monomials/ring.h>
12#include <polys/matpol.h>
13
14struct sip_sideal
15{
16  poly*  m;
17  long rank;
18  int nrows;
19  int ncols;
20  #define IDELEMS(i) ((i)->ncols)
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
25};
26
27struct sip_smap
28{
29  poly *m;
30  char *preimage;
31  int nrows;
32  int ncols;
33};
34
35struct sideal_list;
36typedef struct sideal_list *      ideal_list;
37
38struct sideal_list
39{
40  ideal_list next;
41  ideal      d;
42#ifndef NDEBUG
43  int nr;
44#endif
45};
46
47extern omBin sip_sideal_bin;
48
49/*- creates an ideal -*/
50ideal idInit (int size, int rank=1);
51
52/*- deletes an ideal -*/
53void id_Delete (ideal* h, ring r);
54void id_ShallowDelete (ideal* h, ring r);
55void idSkipZeroes (ideal ide);
56  /*gives an ideal the minimal possible size*/
57
58/// number of non-zero polys in F
59int     idElem(const ideal F);
60/// normialize all polys in id
61void    id_Normalize(ideal id, const ring r);
62
63int id_MinDegW(ideal M,intvec *w, const ring r);
64
65#ifdef PDEBUG
66void id_DBTest(ideal h1, int level, const char *f,const int l, const ring r);
67#define id_Test(A, r) id_DBTest(A, PDEBUG, __FILE__,__LINE__, r)
68// #define id_Print(id, r) id_Show(id, r)
69#else
70#define id_Test(A, r)  ((void)(TRUE))
71// #define id_Print(A, r) ((void)0)
72#endif
73
74ideal id_Copy (ideal h1,const ring r);
75
76  /*adds two ideals without simplifying the result*/
77ideal id_SimpleAdd (ideal h1,ideal h2, const ring r);
78  /*adds the quotient ideal*/
79ideal id_Add (ideal h1,ideal h2,const ring r);
80  /* h1 + h2 */
81
82ideal id_Power(ideal given,int exp, const ring r);
83BOOLEAN idIs0 (ideal h);
84
85long id_RankFreeModule(ideal m, ring lmRing, ring tailRing);
86static inline long id_RankFreeModule(ideal m, ring r)
87{return id_RankFreeModule(m, r, r);}
88// returns TRUE, if idRankFreeModule(m) > 0
89BOOLEAN id_IsModule(ideal m, ring r);
90ideal   id_FreeModule (int i, const ring r);
91int     idElem(const ideal F);
92int id_PosConstant(ideal id, const ring r);
93ideal id_Head(ideal h,const ring r);
94ideal id_MaxIdeal (const ring r);
95ideal id_MaxIdeal(int deg, const ring r);
96ideal id_CopyFirstK (const ideal ide, const int k,const ring r);
97void id_DelMultiples(ideal id, const ring r);
98void id_Norm(ideal id, const ring r);
99void id_DelEquals(ideal id, const ring r);
100void id_DelLmEquals(ideal id, const ring r);
101void id_DelDiv(ideal id, const ring r);
102BOOLEAN id_IsConstant(ideal id, const ring r);
103
104/// sorts the ideal w.r.t. the actual ringordering
105/// uses lex-ordering when nolex = FALSE
106intvec *id_Sort(const ideal id, const BOOLEAN nolex, const ring r);
107
108ideal id_Transp(ideal a, const ring rRing);
109void id_Compactify(ideal id, const ring r);
110ideal  id_Mult (ideal h1,ideal  h2, const ring r);
111ideal id_Homogen(ideal h, int varnum,const ring r);
112BOOLEAN id_HomIdeal (ideal id, ideal Q, const ring r);
113BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R);
114BOOLEAN id_IsZeroDim(ideal I, const ring r);
115ideal id_Jet(ideal i,int d, const ring R);
116ideal id_JetW(ideal i,int d, intvec * iv, const ring R);
117ideal  id_Subst(ideal id, int n, poly e, const ring r);
118matrix id_Module2Matrix(ideal mod, const ring R);
119matrix id_Module2formatedMatrix(ideal mod,int rows, int cols, const ring R);
120ideal id_Matrix2Module(matrix mat, const ring R);
121ideal id_Vec2Ideal(poly vec, const ring R);
122
123int id_ReadOutPivot(ideal arg, int* comp, const ring r);
124
125int     binom (int n,int r);
126
127  /*- verschiebt die Indizes der Modulerzeugenden um i -*/
128void    idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
129void    idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
130int     idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
131
132#ifdef PDEBUG
133void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint = 0);
134#endif
135
136
137/// insert h2 into h1 depending on the two boolean parameters:
138/// - if zeroOk is true, then h2 will also be inserted when it is zero
139/// - if duplicateOk is true, then h2 will also be inserted when it is
140///   already present in h1
141/// return TRUE iff h2 was indeed inserted
142BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries,
143                                const poly h2, const bool zeroOk,
144                                const bool duplicateOk, const ring r);
145
146
147intvec * id_QHomWeight(ideal id, const ring r);
148
149
150#endif
Note: See TracBrowser for help on using the repository browser.