Functions
adjustWeights.cc File Reference
#include <gfanlib/gfanlib_vector.h>
#include <kernel/mod2.h>

Go to the source code of this file.

Functions

static bool checkForNonPositiveEntries (const gfan::ZVector &w)
 
static bool checkForNonPositiveLaterEntries (const gfan::ZVector &w)
 
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

static bool checkForNonPositiveEntries ( const gfan::ZVector &  w)
static

Definition at line 6 of file adjustWeights.cc.

7 {
8  for (unsigned i=0; i<w.size(); i++)
9  {
10  if (w[i].sign()<=0)
11  {
12  std::cout << "ERROR: non-positive weight in weight vector" << std::endl
13  << "weight: " << w << std::endl;
14  return false;
15  }
16  }
17  return true;
18 }
int i
Definition: cfEzgcd.cc:123
const CanonicalForm & w
Definition: facAbsFact.cc:55
static int sign(int x)
Definition: ring.cc:3413
static bool checkForNonPositiveLaterEntries ( const gfan::ZVector &  w)
static

Definition at line 20 of file adjustWeights.cc.

21 {
22  for (unsigned i=1; i<w.size(); i++)
23  {
24  if (w[i].sign()<=0)
25  {
26  std::cout << "ERROR: non-positive weight in weight vector later entries" << std::endl
27  << "weight: " << w << std::endl;
28  return false;
29  }
30  }
31  return true;
32 }
int i
Definition: cfEzgcd.cc:123
const CanonicalForm & w
Definition: facAbsFact.cc:55
static int sign(int x)
Definition: ring.cc:3413
gfan::ZVector nonvalued_adjustWeightForHomogeneity ( const gfan::ZVector &  w)

Definition at line 40 of file adjustWeights.cc.

41 {
42  /* find the smallest entry min of w */
43  gfan::Integer min=w[0];
44  for (unsigned i=1; i<w.size(); i++)
45  if (w[i]<min) min=w[i];
46 
47  if (min.sign()>0)
48  return w;
49 
50  /* compute w+(1-min)*(1,...,1) and return it */
51  gfan::ZVector v=gfan::ZVector(w.size());
52  for (unsigned i=0; i<w.size(); i++)
53  v[i]=w[i]-min+1;
55  return v;
56 }
static int min(int a, int b)
Definition: fast_mult.cc:268
#define assume(x)
Definition: mod2.h:405
static bool checkForNonPositiveEntries(const gfan::ZVector &w)
Definition: adjustWeights.cc:6
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
const CanonicalForm & w
Definition: facAbsFact.cc:55
gfan::ZVector nonvalued_adjustWeightUnderHomogeneity ( const gfan::ZVector &  e,
const gfan::ZVector &   
)

Definition at line 80 of file adjustWeights.cc.

81 {
82  /* since our ideal is homogeneous, we can basically do the same as before */
83  /* find the smallest entry min of w */
84  gfan::Integer min=e[0];
85  for (unsigned i=1; i<e.size(); i++)
86  if (e[i]<min) min=e[i];
87 
88  if (min.sign()>0)
89  return e;
90 
91  /* compute w+(1-min)*(1,...,1) and return it */
92  gfan::ZVector v=gfan::ZVector(e.size());
93  for (unsigned i=0; i<e.size(); i++)
94  v[i]=e[i]-min+1;
96  return v;
97 }
static int min(int a, int b)
Definition: fast_mult.cc:268
#define assume(x)
Definition: mod2.h:405
static bool checkForNonPositiveEntries(const gfan::ZVector &w)
Definition: adjustWeights.cc:6
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
gfan::ZVector valued_adjustWeightForHomogeneity ( const gfan::ZVector &  w)

Definition at line 58 of file adjustWeights.cc.

59 {
60  /* find the biggest entry max of w
61  * amongst the later entries w[1],...,w[n] */
62  gfan::Integer max=w[1];
63  for (unsigned i=2; i<w.size(); i++)
64  if (max<w[i]) max=w[i];
65 
66  /* compute -w+(1+max)*(0,1,...,1) and return it */
67  gfan::ZVector v=gfan::ZVector(w.size());
68  v[0]=-w[0];
69  for (unsigned i=1; i<w.size(); i++)
70  v[i]=-w[i]+max+1;
72  return v;
73 }
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
static bool checkForNonPositiveLaterEntries(const gfan::ZVector &w)
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
const CanonicalForm & w
Definition: facAbsFact.cc:55
gfan::ZVector valued_adjustWeightUnderHomogeneity ( const gfan::ZVector &  e,
const gfan::ZVector &  w 
)

Definition at line 99 of file adjustWeights.cc.

100 {
102 
103  /* find k such that e+k*w is strictly positive,
104  * i.e. k such that e[i]+k*w[i] is strictly positive
105  * for all i=0,...,n */
106  gfan::Integer k((long)0);
107  if (e[0].sign()<=0 && w[0].sign()>0)
108  k = gfan::Integer((long)1)-(e[0]/w[0]);
109  for (unsigned i=1; i<e.size(); i++)
110  {
111  if (e[i].sign()<=0)
112  {
113  gfan::Integer kk = gfan::Integer((long)1)-(e[i]/w[i]);
114  if (k<kk)
115  k = kk;
116  }
117  }
118 
119  /* compute e+k*w, check it for correctness and return it */
120  gfan::ZVector v = e+k*w;
122  return v;
123 }
int k
Definition: cfEzgcd.cc:93
#define assume(x)
Definition: mod2.h:405
static bool checkForNonPositiveLaterEntries(const gfan::ZVector &w)
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
const CanonicalForm & w
Definition: facAbsFact.cc:55
static int sign(int x)
Definition: ring.cc:3413