Changeset 8c3e8c in git


Ignore:
Timestamp:
Jul 3, 2020, 2:40:19 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
cbdf0e507d7f2e431e05eeee9c7e8a7437d2c9c8
Parents:
175dfbe8022a34e8c7eab0e37ca15b932dbcb243
Message:
factory: find_irreducible
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_irred.cc

    r175dfb r8c3e8c  
    2727}
    2828
    29 CanonicalForm
    30 find_irreducible ( int deg, CFRandom & gen, const Variable & x )
    31 {
    32     CanonicalForm result;
    33     int i;
    34     do {
    35         result = power( x, deg );
    36         for ( i = deg-1; i >= 0; i-- )
    37             result += gen.generate() * power( x, i );
    38     } while ( ! is_irreducible( result ) );
    39     return result;
    40 }
    41 
    4229#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    4330/// computes a random monic irreducible univariate polynomial in x over Fp of
     
    6552  return CFirredpoly;
    6653}
     54#else
     55CanonicalForm
     56find_irreducible ( int deg, CFRandom & gen, const Variable & x )
     57{
     58    CanonicalForm result;
     59    int i;
     60    do {
     61        result = power( x, deg );
     62        for ( i = deg-1; i >= 0; i-- )
     63            result += gen.generate() * power( x, i );
     64    } while ( ! is_irreducible( result ) );
     65    return result;
     66}
    6767#endif
  • factory/facAlgFuncUtil.cc

    r175dfb r8c3e8c  
    9090generateMipo (int degOfExt)
    9191{
    92 #ifndef HAVE_NTL
     92#if defined(HAVE_NTL) || defined(HAVE_FLINT)
     93  return randomIrredpoly (degOfExt, Variable (1));
     94#else
    9395  FFRandom gen;
    9496  return find_irreducible (degOfExt, gen, Variable (1));
    95 #else
    96   return randomIrredpoly (degOfExt, Variable (1));
    9797#endif
    9898}
Note: See TracChangeset for help on using the changeset viewer.