Loading...
Searching...
No Matches
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()

BOOLEAN abort_if_monomial_sp | ( | kStrategy | strat | ) |

static

Definition at line 145 of file std_wrapper.cc.

{
BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
// let it remain FALSE otherwise
if (strat->P.t_p==NULL)
{
poly p=strat->P.p;
if (pNext(p)==NULL)
{
while ((strat->Ll >= 0))
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
return FALSE;
}
}
else
{
poly p=strat->P.t_p;
if (pNext(p)==NULL)
{
while ((strat->Ll >= 0))
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
return FALSE;
}
}
return b; // return TRUE if sp was changed, FALSE if not
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
FALSE
#define FALSE
Definition auxiliary.h:97
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
skStrategy::Ll
int Ll
Definition kutil.h:350
skStrategy::P
LObject P
Definition kutil.h:301
skStrategy::L
LSet L
Definition kutil.h:326
deleteInL
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1208
pNext
#define pNext(p)
Definition monomials.h:36
NULL
#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.

{
ring origin = currRing;
if (origin != r)
rChangeCurrRing(r);
intvec* nullVector = NULL;
ideal stdI = kStd2(I,currRing->qideal,h,&nullVector,(bigintmat*)NULL); // there is still a memory leak here!!!
id_DelDiv(stdI,currRing);
idSkipZeroes(stdI);
if (nullVector!=NULL) delete nullVector;
if (origin != r)
rChangeCurrRing(origin);
return stdI;
}
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
intvec
Definition intvec.h:24
h
STATIC_VAR Poly * h
Definition janet.cc:971
kStd2
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
id_DelDiv
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...
Definition simpleideals.cc:463
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201

## gfanlib_monomialabortStd_wrapper()

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

Definition at line 172 of file std_wrapper.cc.

{
ring origin = currRing;
if (origin != r)
rChangeCurrRing(r);
ideal stdI = kStd2(I,currRing->qideal,h,NULL,(bigintmat*)NULL,0,0,NULL,abort_if_monomial_sp);
id_DelDiv(stdI,currRing);
idSkipZeroes(stdI);
if (origin != r)
rChangeCurrRing(origin);
return stdI;
}
abort_if_monomial_sp
static BOOLEAN abort_if_monomial_sp(kStrategy strat)
Definition customstd.cc:92

## gfanlib_satStd_wrapper()

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

Definition at line 124 of file std_wrapper.cc.

{
ring origin = currRing;
if (origin != r)
rChangeCurrRing(r);
int n = rVar(currRing);
gitfan_satstdSaturatingVariables = std::vector<int>(n);
for (int i=n-1; i>=0; i--)
gitfan_satstdSaturatingVariables[i] = i+1;
ideal stdI = kStd2(I,currRing->qideal,h,NULL,(bigintmat*)NULL,0,0,NULL,sat_vars_sp);
id_DelDiv(stdI,currRing);
idSkipZeroes(stdI);
if (origin != r)
rChangeCurrRing(origin);
return stdI;
}
i
int i
Definition cfEzgcd.cc:132
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
gitfan_satstdSaturatingVariables
std::vector< int > gitfan_satstdSaturatingVariables
Definition std_wrapper.cc:5
sat_vars_sp
static BOOLEAN sat_vars_sp(kStrategy strat)
Definition std_wrapper.cc:27

## sat_vars_sp()

BOOLEAN sat_vars_sp | ( | kStrategy | strat | ) |

static

Definition at line 27 of file std_wrapper.cc.

{
BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
// let it remain FALSE otherwise
if (strat->P.t_p==NULL)
{
poly p=strat->P.p;
// iterate over all terms of p and
// compute the minimum mm of all exponent vectors
int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
p_GetExpV(p,mm,currRing);
bool nonTrivialSaturationToBeDone=true;
for (p=pNext(p); p!=NULL; pIter(p))
{
nonTrivialSaturationToBeDone=false;
p_GetExpV(p,m0,currRing);
for (int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
{
int li = gitfan_satstdSaturatingVariables[i];
mm[li]=si_min(mm[li],m0[li]);
if (mm[li]>0) nonTrivialSaturationToBeDone=true;
}
// abort if the minimum is zero in each component
if (nonTrivialSaturationToBeDone==false) break;
}
if (nonTrivialSaturationToBeDone==true)
{
// std::cout << "simplifying!" << std::endl;
p=p_Copy(strat->P.p,currRing);
strat->P.Init();
strat->P.tailRing = strat->tailRing;
strat->P.p=p;
while(p!=NULL)
{
for (int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
{
int li = gitfan_satstdSaturatingVariables[i];
p_SubExp(p,li,mm[li],currRing);
}
p_Setm(p,currRing);
pIter(p);
}
b = TRUE;
}
omFree(mm);
omFree(m0);
}
else
{
poly p=strat->P.t_p;
// iterate over all terms of p and
// compute the minimum mm of all exponent vectors
int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
p_GetExpV(p,mm,strat->tailRing);
bool nonTrivialSaturationToBeDone=true;
for (p = pNext(p); p!=NULL; pIter(p))
{
nonTrivialSaturationToBeDone=false;
p_GetExpV(p,m0,strat->tailRing);
for(int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
{
int li = gitfan_satstdSaturatingVariables[i];
mm[li]=si_min(mm[li],m0[li]);
if (mm[li]>0) nonTrivialSaturationToBeDone = true;
}
// abort if the minimum is zero in each component
if (!nonTrivialSaturationToBeDone) break;
}
if (nonTrivialSaturationToBeDone)
{
p=p_Copy(strat->P.t_p,strat->tailRing);
strat->P.Init();
strat->P.tailRing = strat->tailRing;
strat->P.t_p=p;
while(p!=NULL)
{
for(int i=gitfan_satstdSaturatingVariables.size()-1; i>=0; i--)
{
int li = gitfan_satstdSaturatingVariables[i];
p_SubExp(p,li,mm[li],strat->tailRing);
}
p_Setm(p,strat->tailRing);
pIter(p);
}
strat->P.GetP();
b = TRUE;
}
omFree(mm);
omFree(m0);
}
return b; // return TRUE if sp was changed, FALSE if not
}
TRUE
#define TRUE
Definition auxiliary.h:101
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
skStrategy::tailRing
ring tailRing
Definition kutil.h:342
pIter
#define pIter(p)
Definition monomials.h:37
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
p_SubExp
static long p_SubExp(poly p, int v, long ee, ring r)
Definition p_polys.h:615
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

## Variable Documentation

## gitfan_satstdSaturatingVariables

std::vector<int> gitfan_satstdSaturatingVariables

Definition at line 5 of file std_wrapper.cc.