Changeset e2e4be in git


Ignore:
Timestamp:
Nov 15, 2012, 2:18:16 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a0adc352c26b5251da621e2cb0af660bff3364a5
Parents:
a64b0ebe60fbdf0eb713f74e6e4932492b5058b3
git-author:
Martin Lee <martinlee84@web.de>2012-11-15 14:18:16+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-11-16 13:13:24+01:00
Message:
chg: replaced balance by balance_p
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    ra64b0e re2e4be  
    463463//}}}
    464464
    465 //{{{ static CanonicalForm balance ( const CanonicalForm & f, const CanonicalForm & q )
     465//{{{ static CanonicalForm balance_p ( const CanonicalForm & f, const CanonicalForm & q )
    466466//{{{ docu
    467467//
    468 // balance() - map f from positive to symmetric representation
     468// balance_p() - map f from positive to symmetric representation
    469469//   mod q.
    470470//
     
    476476//}}}
    477477static CanonicalForm
     478balance_p ( const CanonicalForm & f, const CanonicalForm & q )
     479{
     480    Variable x = f.mvar();
     481    CanonicalForm result = 0, qh = q / 2;
     482    CanonicalForm c;
     483    CFIterator i;
     484    for ( i = f; i.hasTerms(); i++ )
     485    {
     486        c = i.coeff();
     487        if ( c.inCoeffDomain())
     488        {
     489          if ( c > qh )
     490            result += power( x, i.exp() ) * (c - q);
     491          else
     492            result += power( x, i.exp() ) * c;
     493        }
     494        else
     495          result += power( x, i.exp() ) * balance_p(c,q);
     496    }
     497    return result;
     498}
     499
     500/*static CanonicalForm
    478501balance ( const CanonicalForm & f, const CanonicalForm & q )
    479502{
     
    490513    }
    491514    return result;
    492 }
     515}*/
    493516//}}}
    494517
     
    566589    {
    567590      // now balance D mod q
    568       D = pp( balance( D, q ) );
     591      D = pp( balance_p( D, q ) );
    569592      if ( fdivides( D, f ) && fdivides( D, g ) )
    570593        return D * c;
     
    12041227    delete [] degsg;
    12051228}*/
    1206 
    1207 
    1208 static CanonicalForm
    1209 balance_p ( const CanonicalForm & f, const CanonicalForm & q )
    1210 {
    1211     Variable x = f.mvar();
    1212     CanonicalForm result = 0, qh = q / 2;
    1213     CanonicalForm c;
    1214     CFIterator i;
    1215     for ( i = f; i.hasTerms(); i++ )
    1216     {
    1217         c = i.coeff();
    1218         if ( c.inCoeffDomain())
    1219         {
    1220           if ( c > qh )
    1221             result += power( x, i.exp() ) * (c - q);
    1222           else
    1223             result += power( x, i.exp() ) * c;
    1224         }
    1225         else
    1226           result += power( x, i.exp() ) * balance_p(c,q);
    1227     }
    1228     return result;
    1229 }
    12301229
    12311230TIMING_DEFINE_PRINT(chinrem_termination)
Note: See TracChangeset for help on using the changeset viewer.