My Project
Loading...
Searching...
No Matches
Functions
tropicalDebug.h File Reference
#include "libpolys/polys/simpleideals.h"
#include "gfanlib/gfanlib.h"

Go to the source code of this file.

Functions

bool checkForNonPositiveEntries (const gfan::ZVector &w)
 
bool checkForNonPositiveLaterEntries (const gfan::ZVector &w)
 
bool areIdealsEqual (ideal I, ring r, ideal J, ring s)
 
bool checkWeightVector (const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder=0)
 
bool checkOrderingAndCone (const ring r, const gfan::ZCone zc)
 
bool checkPolynomialInput (const ideal I, const ring r)
 
bool checkPolyhedralInput (const gfan::ZCone zc, const gfan::ZVector p)
 

Function Documentation

◆ areIdealsEqual()

bool areIdealsEqual ( ideal  I,
ring  r,
ideal  J,
ring  s 
)

Definition at line 41 of file tropicalDebug.cc.

42{
43 ideal Is = idInit(IDELEMS(I));
44 nMapFunc identity = n_SetMap(r->cf,s->cf);
45 for (int i=0; i<IDELEMS(I); i++)
46 Is->m[i] = p_PermPoly(I->m[i],NULL,r,s,identity,NULL,0);
47
48 ring origin = currRing;
49 if (origin!=s)
51 ideal stdI = gfanlib_kStd_wrapper(Is,s);
52 ideal stdJ = gfanlib_kStd_wrapper(J,s);
53 ideal NF1 = kNF(stdI,s->qideal,stdJ);
54 ideal NF2 = kNF(stdJ,s->qideal,stdI);
55 if (origin!=s)
56 rChangeCurrRing(origin);
57
58 bool b = true;
59 if (NF1 != NULL)
60 b = b && idIs0(NF1);
61 if (NF2 != NULL)
62 b = b && idIs0(NF2);
63 if (!b)
64 std::cout << "ERROR: input ideals not equal!" << std::endl;
65
66 id_Delete(&stdI,s);
67 id_Delete(&stdJ,s);
68 id_Delete(&NF1,s);
69 id_Delete(&NF2,s);
70 return (b);
71}
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
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:697
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
const CanonicalForm int s
Definition: facAbsFact.cc:51
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3182
#define NULL
Definition: omList.c:12
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:4130
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
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define IDELEMS(i)
Definition: simpleideals.h:23
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:6

◆ checkForNonPositiveEntries()

bool checkForNonPositiveEntries ( const gfan::ZVector &  w)

Definition at line 13 of file tropicalDebug.cc.

14{
15 for (unsigned i=0; i<w.size(); i++)
16 {
17 if (w[i].sign()<=0)
18 {
19 std::cout << "ERROR: non-positive weight in weight vector" << std::endl
20 << "weight: " << w << std::endl;
21 return false;
22 }
23 }
24 return true;
25}
const CanonicalForm & w
Definition: facAbsFact.cc:51
static int sign(int x)
Definition: ring.cc:3427

◆ checkForNonPositiveLaterEntries()

bool checkForNonPositiveLaterEntries ( const gfan::ZVector &  w)

Definition at line 27 of file tropicalDebug.cc.

28{
29 for (unsigned i=1; i<w.size(); i++)
30 {
31 if (w[i].sign()<=0)
32 {
33 std::cout << "ERROR: non-positive weight in weight vector later entries" << std::endl
34 << "weight: " << w << std::endl;
35 return false;
36 }
37 }
38 return true;
39}

◆ checkOrderingAndCone()

bool checkOrderingAndCone ( const ring  r,
const gfan::ZCone  zc 
)

Definition at line 90 of file tropicalDebug.cc.

91{
92 if (r)
93 {
94 if (r->order[0]==ringorder_dp)
95 return true;
96 int n = rVar(r);
97 int* w = r->wvhdl[0];
98 gfan::ZVector v = wvhdlEntryToZVector(n,w);
99 if (r->order[0]==ringorder_ws)
100 v = gfan::Integer((long)-1)*v;
101 if (!zc.contains(v))
102 {
103 std::cout << "ERROR: weight of ordering not inside Groebner cone!" << std::endl;
104 return false;
105 }
106 }
107 return true;
108}
gfan::ZVector wvhdlEntryToZVector(const int n, const int *wvhdl0)
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
@ ringorder_dp
Definition: ring.h:78
@ ringorder_ws
Definition: ring.h:86
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592

◆ checkPolyhedralInput()

bool checkPolyhedralInput ( const gfan::ZCone  zc,
const gfan::ZVector  p 
)

Definition at line 117 of file tropicalDebug.cc.

118{
119 return zc.containsRelatively(p);
120}
int p
Definition: cfModGcd.cc:4078

◆ checkPolynomialInput()

bool checkPolynomialInput ( const ideal  I,
const ring  r 
)

Definition at line 110 of file tropicalDebug.cc.

111{
112 if (r) rTest(r);
113 if (I && r) id_Test(I,r);
114 return ((!I) || (I && r));
115}
#define rTest(r)
Definition: ring.h:782
#define id_Test(A, lR)
Definition: simpleideals.h:87

◆ checkWeightVector()

bool checkWeightVector ( const ideal  I,
const ring  r,
const gfan::ZVector &  weightVector,
bool  checkBorder = 0 
)

Definition at line 74 of file tropicalDebug.cc.

75{
76 gfan::ZCone cI = maximalGroebnerCone(I,r);
77 if (!cI.contains(weightVector))
78 {
79 std::cout << "ERROR: weight vector not inside maximal Gröbner cone" << std::endl;
80 return false;
81 }
82 if (checkBorder && cI.containsRelatively(weightVector))
83 {
84 std::cout << "ERROR: weight vector in the relative interior of maximal Gröbner cone" << std::endl;
85 return false;
86 }
87 return true;
88}
gfan::ZCone maximalGroebnerCone(const ideal &I, const ring &r)
Definition: tropical.cc:291