Changeset b53ff6 in git


Ignore:
Timestamp:
Aug 26, 2014, 11:19:16 AM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
30e27f8a94644c552a6548c8b0d0b2026ceb2068
Parents:
91695f2af09f5a3a05d6d8c4ee652802f6d85b68
git-author:
Martin Lee <martinlee84@web.de>2014-08-26 11:19:16+02:00
git-committer:
Martin Lee <martinlee84@web.de>2014-08-26 12:29:12+02:00
Message:
docu for coprimality check
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cfGcdUtil.cc

    r91695f rb53ff6  
    1414#endif
    1515
    16 /// coprimality check
     16/// Coprimality Check. f and g are assumed to have the same level. If swap is
     17/// true, the main variables of f and g are swapped with Variable(1). If the
     18/// result is false, d is set to the degree of the gcd of f and g evaluated at a
     19/// random point in K^n-1. This gcd is a gcd of univariate polynomials.
    1720bool
    1821gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap, int & d )
     
    217220}
    218221
     222/**
     223 * same as balance_p ( const CanonicalForm & f, const CanonicalForm & q )
     224 * but qh= q/2 is provided, too.
     225**/
     226CanonicalForm
     227balance_p ( const CanonicalForm & f, const CanonicalForm & q, const CanonicalForm & qh )
     228{
     229    Variable x = f.mvar();
     230    CanonicalForm result = 0;
     231    CanonicalForm c;
     232    CFIterator i;
     233    for ( i = f; i.hasTerms(); i++ )
     234    {
     235        c = i.coeff();
     236        if ( c.inCoeffDomain())
     237        {
     238          if ( c > qh )
     239            result += power( x, i.exp() ) * (c - q);
     240          else
     241            result += power( x, i.exp() ) * c;
     242        }
     243        else
     244          result += power( x, i.exp() ) * balance_p(c,q,qh);
     245    }
     246    return result;
     247}
     248
    219249/** static CanonicalForm balance_p ( const CanonicalForm & f, const CanonicalForm & q )
    220250 *
     
    227257**/
    228258CanonicalForm
    229 balance_p ( const CanonicalForm & f, const CanonicalForm & q, const CanonicalForm & qh )
    230 {
    231     Variable x = f.mvar();
    232     CanonicalForm result = 0;
    233     CanonicalForm c;
    234     CFIterator i;
    235     for ( i = f; i.hasTerms(); i++ )
    236     {
    237         c = i.coeff();
    238         if ( c.inCoeffDomain())
    239         {
    240           if ( c > qh )
    241             result += power( x, i.exp() ) * (c - q);
    242           else
    243             result += power( x, i.exp() ) * c;
    244         }
    245         else
    246           result += power( x, i.exp() ) * balance_p(c,q,qh);
    247     }
    248     return result;
    249 }
    250 
    251 CanonicalForm
    252259balance_p ( const CanonicalForm & f, const CanonicalForm & q )
    253260{
Note: See TracChangeset for help on using the changeset viewer.