Changeset 7cb467 in git


Ignore:
Timestamp:
Feb 5, 2015, 1:03:22 AM (9 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
14168dd1bd4daa95e0d692cc9a107490c19d7c3f
Parents:
08b7c2ac6141d36536d3eb58dd62e9ad4be529da
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-05 01:03:22+01:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:06+01:00
Message:
chg: improved weight adjusting algorithm
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/gfanlib/adjustWeights.cc

    r08b7c2a r7cb467  
    8181 * w containing only positive weights
    8282 **/
    83 gfan::ZVector nonvalued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &w)
     83gfan::ZVector nonvalued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &/*w*/)
    8484{
    85   assume(checkForNonPositiveEntries(w));
    86   /* find k such that e+k*w is strictly positive,
    87    * i.e. k such that e[i]+k*w[i] is strictly positive
    88    * for all i=0,...,n
    89    * note that the division is rounded towards zero,
    90    * hence we increment the value by 1 */
    91   gfan::Integer k((long)0);
    92   if (e[0].sign()<=0)
    93     k = gfan::Integer((long)1)-(e[0]/w[0]);
     85  /* since ideal is homogeneous, we can basically do the same as before */
     86  gfan::Integer min=e[0];
    9487  for (unsigned i=1; i<e.size(); i++)
    95   {
    96     if (e[i].sign()<=0)
    97     {
    98       gfan::Integer kk = gfan::Integer((long)1)-(e[i]/w[i]);
    99       if (k<kk)
    100         k = kk;
    101     }
    102   }
    103   /* compute e+k*w, check it for correctness and return it */
    104   gfan::ZVector v = e+k*w;
     88    if (e[i]<min) min=e[i];
     89
     90  if (min.sign()>0)
     91    return e;
     92
     93  /* compute w+(1-min)*(1,...,1) and return it */
     94  gfan::ZVector v=gfan::ZVector(e.size());
     95  for (unsigned i=0; i<e.size(); i++)
     96    v[i]=e[i]-min+1;
    10597  assume(checkForNonPositiveEntries(v));
    10698  return v;
Note: See TracChangeset for help on using the changeset viewer.