Loading...
Searching...
No Matches
tropicalDebug.cc
Go to the documentation of this file.
#ifndef SING_NDEBUG
#include "libpolys/polys/simpleideals.h"
#include "kernel/GBEngine/kstd1.h"
#include "gfanlib/gfanlib.h"
#include "std_wrapper.h"
#include "callgfanlib_conversion.h"
#include "tropical.h"
bool checkForNonPositiveEntries(const gfan::ZVector &w)
{
for (unsigned i=0; i<w.size(); i++)
{
if (w[i].sign()<=0)
{
std::cout << "ERROR: non-positive weight in weight vector" << std::endl
<< "weight: " << w << std::endl;
return false;
}
}
return true;
}
bool checkForNonPositiveLaterEntries(const gfan::ZVector &w)
{
for (unsigned i=1; i<w.size(); i++)
{
if (w[i].sign()<=0)
{
std::cout << "ERROR: non-positive weight in weight vector later entries" << std::endl
<< "weight: " << w << std::endl;
return false;
}
}
return true;
}
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
{
ideal Is = idInit(IDELEMS(I));
nMapFunc identity = n_SetMap(r->cf,s->cf);
for (int i=0; i<IDELEMS(I); i++)
Is->m[i] = p_PermPoly(I->m[i],NULL,r,s,identity,NULL,0);
ring origin = currRing;
if (origin!=s)
rChangeCurrRing(s);
ideal stdI = gfanlib_kStd_wrapper(Is,s);
ideal stdJ = gfanlib_kStd_wrapper(J,s);
ideal NF1 = kNF(stdI,s->qideal,stdJ);
ideal NF2 = kNF(stdJ,s->qideal,stdI);
if (origin!=s)
rChangeCurrRing(origin);
bool b = true;
if (NF1 != NULL)
b = b && idIs0(NF1);
if (NF2 != NULL)
b = b && idIs0(NF2);
if (!b)
std::cout << "ERROR: input ideals not equal!" << std::endl;
id_Delete(&stdI,s);
id_Delete(&stdJ,s);
id_Delete(&NF1,s);
id_Delete(&NF2,s);
return (b);
}
bool checkWeightVector(const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder)
{
gfan::ZCone cI = maximalGroebnerCone(I,r);
if (!cI.contains(weightVector))
{
std::cout << "ERROR: weight vector not inside maximal Gröbner cone" << std::endl;
return false;
}
if (checkBorder && cI.containsRelatively(weightVector))
{
std::cout << "ERROR: weight vector in the relative interior of maximal Gröbner cone" << std::endl;
return false;
}
return true;
}
bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)
{
if (r)
{
if (r->order[0]==ringorder_dp)
return true;
int n = rVar(r);
int* w = r->wvhdl[0];
gfan::ZVector v = wvhdlEntryToZVector(n,w);
if (r->order[0]==ringorder_ws)
v = gfan::Integer((long)-1)*v;
if (!zc.contains(v))
{
std::cout << "ERROR: weight of ordering not inside Groebner cone!" << std::endl;
return false;
}
}
return true;
}
bool checkPolynomialInput(const ideal I, const ring r)
{
if (r) rTest(r);
if (I && r) id_Test(I,r);
return ((!I) || (I && r));
}
bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)
{
return zc.containsRelatively(p);
}
#endif
wvhdlEntryToZVector
gfan::ZVector wvhdlEntryToZVector(const int n, const int *wvhdl0)
Definition callgfanlib_conversion.cc:102
callgfanlib_conversion.h
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
s
const CanonicalForm int s
Definition facAbsFact.cc:51
w
const CanonicalForm & w
Definition facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3229
kstd1.h
NULL
#define NULL
Definition omList.c:12
p_PermPoly
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition p_polys.cc:4256
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
sign
static int sign(int x)
Definition ring.cc:3504
ringorder_dp
@ ringorder_dp
Definition ring.h:79
ringorder_ws
@ ringorder_ws
Definition ring.h:88
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
rTest
#define rTest(r)
Definition ring.h:794
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
simpleideals.h
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
id_Test
#define id_Test(A, lR)
Definition simpleideals.h:89
gfanlib_kStd_wrapper
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition std_wrapper.cc:6
std_wrapper.h
checkWeightVector
bool checkWeightVector(const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder)
Definition tropicalDebug.cc:74
checkPolyhedralInput
bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)
Definition tropicalDebug.cc:117
checkForNonPositiveEntries
bool checkForNonPositiveEntries(const gfan::ZVector &w)
Definition tropicalDebug.cc:13
checkOrderingAndCone
bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)
Definition tropicalDebug.cc:90
checkPolynomialInput
bool checkPolynomialInput(const ideal I, const ring r)
Definition tropicalDebug.cc:110
areIdealsEqual
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
Definition tropicalDebug.cc:41
checkForNonPositiveLaterEntries
bool checkForNonPositiveLaterEntries(const gfan::ZVector &w)
Definition tropicalDebug.cc:27
maximalGroebnerCone
gfan::ZCone maximalGroebnerCone(const ideal &I, const ring &r)
Definition tropical.cc:291
tropical.h