My Project  debian-1:4.1.1-p2+ds-4build2
Functions
adjustWeights.cc File Reference
#include "kernel/mod2.h"
#include "gfanlib/gfanlib_vector.h"
#include "tropicalDebug.h"

Go to the source code of this file.

Functions

gfan::ZVector nonvalued_adjustWeightForHomogeneity (const gfan::ZVector &w)
 
gfan::ZVector valued_adjustWeightForHomogeneity (const gfan::ZVector &w)
 
gfan::ZVector nonvalued_adjustWeightUnderHomogeneity (const gfan::ZVector &e, const gfan::ZVector &)
 
gfan::ZVector valued_adjustWeightUnderHomogeneity (const gfan::ZVector &e, const gfan::ZVector &w)
 

Function Documentation

◆ nonvalued_adjustWeightForHomogeneity()

gfan::ZVector nonvalued_adjustWeightForHomogeneity ( const gfan::ZVector &  w)

Definition at line 14 of file adjustWeights.cc.

15 {
16  /* find the smallest entry min of w */
17  gfan::Integer min=w[0];
18  for (unsigned i=1; i<w.size(); i++)
19  if (w[i]<min) min=w[i];
20 
21  if (min.sign()>0)
22  return w;
23 
24  /* compute w+(1-min)*(1,...,1) and return it */
25  gfan::ZVector v=gfan::ZVector(w.size());
26  for (unsigned i=0; i<w.size(); i++)
27  v[i]=w[i]-min+1;
29  return v;
30 }

◆ nonvalued_adjustWeightUnderHomogeneity()

gfan::ZVector nonvalued_adjustWeightUnderHomogeneity ( const gfan::ZVector &  e,
const gfan::ZVector &   
)

Definition at line 54 of file adjustWeights.cc.

55 {
56  /* since our ideal is homogeneous, we can basically do the same as before */
57  /* find the smallest entry min of w */
58  gfan::Integer min=e[0];
59  for (unsigned i=1; i<e.size(); i++)
60  if (e[i]<min) min=e[i];
61 
62  if (min.sign()>0)
63  return e;
64 
65  /* compute w+(1-min)*(1,...,1) and return it */
66  gfan::ZVector v=gfan::ZVector(e.size());
67  for (unsigned i=0; i<e.size(); i++)
68  v[i]=e[i]-min+1;
70  return v;
71 }

◆ valued_adjustWeightForHomogeneity()

gfan::ZVector valued_adjustWeightForHomogeneity ( const gfan::ZVector &  w)

Definition at line 32 of file adjustWeights.cc.

33 {
34  /* find the biggest entry max of w
35  * amongst the later entries w[1],...,w[n] */
36  gfan::Integer max=w[1];
37  for (unsigned i=2; i<w.size(); i++)
38  if (max<w[i]) max=w[i];
39 
40  /* compute -w+(1+max)*(0,1,...,1) and return it */
41  gfan::ZVector v=gfan::ZVector(w.size());
42  v[0]=-w[0];
43  for (unsigned i=1; i<w.size(); i++)
44  v[i]=-w[i]+max+1;
46  return v;
47 }

◆ valued_adjustWeightUnderHomogeneity()

gfan::ZVector valued_adjustWeightUnderHomogeneity ( const gfan::ZVector &  e,
const gfan::ZVector &  w 
)

Definition at line 73 of file adjustWeights.cc.

74 {
76 
77  /* find k such that e+k*w is strictly positive,
78  * i.e. k such that e[i]+k*w[i] is strictly positive
79  * for all i=0,...,n */
80  gfan::Integer k((long)0);
81  if (e[0].sign()<=0 && w[0].sign()>0)
82  k = gfan::Integer((long)1)-(e[0]/w[0]);
83  for (unsigned i=1; i<e.size(); i++)
84  {
85  if (e[i].sign()<=0)
86  {
87  gfan::Integer kk = gfan::Integer((long)1)-(e[i]/w[i]);
88  if (k<kk)
89  k = kk;
90  }
91  }
92 
93  /* compute e+k*w, check it for correctness and return it */
94  gfan::ZVector v = e+k*w;
96  return v;
97 }
k
int k
Definition: cfEzgcd.cc:92
sign
static int sign(int x)
Definition: ring.cc:3328
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
i
int i
Definition: cfEzgcd.cc:125
max
static int max(int a, int b)
Definition: fast_mult.cc:264
checkForNonPositiveEntries
bool checkForNonPositiveEntries(const gfan::ZVector &w)
Definition: tropicalDebug.cc:13
min
static int min(int a, int b)
Definition: fast_mult.cc:268
assume
#define assume(x)
Definition: mod2.h:390
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
checkForNonPositiveLaterEntries
bool checkForNonPositiveLaterEntries(const gfan::ZVector &w)
Definition: tropicalDebug.cc:27