My Project
Loading...
Searching...
No Matches
Functions | Variables
std_wrapper.cc File Reference
#include <vector>
#include "Singular/libsingular.h"

Go to the source code of this file.

Functions

ideal gfanlib_kStd_wrapper (ideal I, ring r, tHomog h=testHomog)
 
static BOOLEAN sat_vars_sp (kStrategy strat)
 
ideal gfanlib_satStd_wrapper (ideal I, ring r, tHomog h=testHomog)
 
static BOOLEAN abort_if_monomial_sp (kStrategy strat)
 
ideal gfanlib_monomialabortStd_wrapper (ideal I, ring r, tHomog h=testHomog)
 

Variables

std::vector< int > gitfan_satstdSaturatingVariables
 

Function Documentation

◆ abort_if_monomial_sp()

static BOOLEAN abort_if_monomial_sp ( kStrategy  strat)
static

Definition at line 145 of file std_wrapper.cc.

146{
147 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
148 // let it remain FALSE otherwise
149 if (strat->P.t_p==NULL)
150 {
151 poly p=strat->P.p;
152 if (pNext(p)==NULL)
153 {
154 while ((strat->Ll >= 0))
155 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
156 return FALSE;
157 }
158 }
159 else
160 {
161 poly p=strat->P.t_p;
162 if (pNext(p)==NULL)
163 {
164 while ((strat->Ll >= 0))
165 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
166 return FALSE;
167 }
168 }
169 return b; // return TRUE if sp was changed, FALSE if not
170}
int BOOLEAN
Definition: auxiliary.h:87
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
int Ll
Definition: kutil.h:351
LObject P
Definition: kutil.h:302
LSet L
Definition: kutil.h:327
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1215
#define pNext(p)
Definition: monomials.h:36
#define NULL
Definition: omList.c:12

◆ gfanlib_kStd_wrapper()

ideal gfanlib_kStd_wrapper ( ideal  I,
ring  r,
tHomog  h = testHomog 
)

Definition at line 6 of file std_wrapper.cc.

7{
8 ring origin = currRing;
9 if (origin != r)
11
12 intvec* nullVector = NULL;
13 ideal stdI = kStd(I,currRing->qideal,h,&nullVector); // there is still a memory leak here!!!
14 id_DelDiv(stdI,currRing);
15 idSkipZeroes(stdI);
16 if (nullVector!=NULL) delete nullVector;
17
18 if (origin != r)
19 rChangeCurrRing(origin);
20
21 return stdI;
22}
Definition: intvec.h:23
STATIC_VAR Poly * h
Definition: janet.cc:971
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2447
void rChangeCurrRing(ring r)
Definition: polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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...
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ gfanlib_monomialabortStd_wrapper()

ideal gfanlib_monomialabortStd_wrapper ( ideal  I,
ring  r,
tHomog  h = testHomog 
)

Definition at line 172 of file std_wrapper.cc.

173{
174 ring origin = currRing;
175 if (origin != r)
177
178 ideal stdI = kStd(I,currRing->qideal,h,NULL,NULL,0,0,NULL,abort_if_monomial_sp);
179 id_DelDiv(stdI,currRing);
180 idSkipZeroes(stdI);
181
182 if (origin != r)
183 rChangeCurrRing(origin);
184
185 return stdI;
186}
static BOOLEAN abort_if_monomial_sp(kStrategy strat)
Definition: std_wrapper.cc:145

◆ gfanlib_satStd_wrapper()

ideal gfanlib_satStd_wrapper ( ideal  I,
ring  r,
tHomog  h = testHomog 
)

Definition at line 124 of file std_wrapper.cc.

125{
126 ring origin = currRing;
127 if (origin != r)
129
130 int n = rVar(currRing);
131 gitfan_satstdSaturatingVariables = std::vector<int>(n);
132 for (int i=n-1; i>=0; i--)
134
135 ideal stdI = kStd(I,currRing->qideal,h,NULL,NULL,0,0,NULL,sat_vars_sp);
136 id_DelDiv(stdI,currRing);
137 idSkipZeroes(stdI);
138
139 if (origin != r)
140 rChangeCurrRing(origin);
141
142 return stdI;
143}
int i
Definition: cfEzgcd.cc:132
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
std::vector< int > gitfan_satstdSaturatingVariables
Definition: std_wrapper.cc:5
static BOOLEAN sat_vars_sp(kStrategy strat)
Definition: std_wrapper.cc:27

◆ sat_vars_sp()

static BOOLEAN sat_vars_sp ( kStrategy  strat)
static

Definition at line 27 of file std_wrapper.cc.

28{
29 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
30 // let it remain FALSE otherwise
31 if (strat->P.t_p==NULL)
32 {
33 poly p=strat->P.p;
34
35 // iterate over all terms of p and
36 // compute the minimum mm of all exponent vectors
37 int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
38 int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
40 bool nonTrivialSaturationToBeDone=true;
41 for (p=pNext(p); p!=NULL; pIter(p))
42 {
43 nonTrivialSaturationToBeDone=false;
45 for (int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
46 {
48 mm[li]=si_min(mm[li],m0[li]);
49 if (mm[li]>0) nonTrivialSaturationToBeDone=true;
50 }
51 // abort if the minimum is zero in each component
52 if (nonTrivialSaturationToBeDone==false) break;
53 }
54 if (nonTrivialSaturationToBeDone==true)
55 {
56 // std::cout << "simplifying!" << std::endl;
57 p=p_Copy(strat->P.p,currRing);
58 memset(&strat->P,0,sizeof(strat->P));
59 strat->P.tailRing = strat->tailRing;
60 strat->P.p=p;
61 while(p!=NULL)
62 {
63 for (int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
64 {
66 p_SubExp(p,li,mm[li],currRing);
67 }
69 pIter(p);
70 }
71 b = TRUE;
72 }
73 omFree(mm);
74 omFree(m0);
75 }
76 else
77 {
78 poly p=strat->P.t_p;
79
80 // iterate over all terms of p and
81 // compute the minimum mm of all exponent vectors
82 int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
83 int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
84 p_GetExpV(p,mm,strat->tailRing);
85 bool nonTrivialSaturationToBeDone=true;
86 for (p = pNext(p); p!=NULL; pIter(p))
87 {
88 nonTrivialSaturationToBeDone=false;
89 p_GetExpV(p,m0,strat->tailRing);
90 for(int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
91 {
93 mm[li]=si_min(mm[li],m0[li]);
94 if (mm[li]>0) nonTrivialSaturationToBeDone = true;
95 }
96 // abort if the minimum is zero in each component
97 if (!nonTrivialSaturationToBeDone) break;
98 }
99 if (nonTrivialSaturationToBeDone)
100 {
101 p=p_Copy(strat->P.t_p,strat->tailRing);
102 memset(&strat->P,0,sizeof(strat->P));
103 strat->P.tailRing = strat->tailRing;
104 strat->P.t_p=p;
105 while(p!=NULL)
106 {
107 for(int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
108 {
110 p_SubExp(p,li,mm[li],strat->tailRing);
111 }
112 p_Setm(p,strat->tailRing);
113 pIter(p);
114 }
115 strat->P.GetP();
116 b = TRUE;
117 }
118 omFree(mm);
119 omFree(m0);
120 }
121 return b; // return TRUE if sp was changed, FALSE if not
122}
#define TRUE
Definition: auxiliary.h:100
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
ring tailRing
Definition: kutil.h:343
#define pIter(p)
Definition: monomials.h:37
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
static long p_SubExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:611
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844

Variable Documentation

◆ gitfan_satstdSaturatingVariables

std::vector<int> gitfan_satstdSaturatingVariables

Definition at line 5 of file std_wrapper.cc.