Changeset e73082 in git


Ignore:
Timestamp:
Jul 10, 2020, 10:59:54 AM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
92ca340b57708a644bf8460eb08f23f4c5a25c1e
Parents:
8ef929c017bd275741976e337ce6a61e6fec53d9
Message:
factory: factorize char 0, univariate (w/o FLINT, w/o NTL)
Location:
factory
Files:
5 edited
4 moved

Legend:

Unmodified
Added
Removed
  • factory/Makefile.am

    r8ef929 re73082  
    6767                fac_berlekamp.cc \
    6868                fac_cantzass.cc \
     69                fac_univar.cc \
    6970                facFqBivar.cc \
    7071                facFqBivarUtil.cc \
     
    8687                int_poly.cc \
    8788                int_rat.cc \
     89                int_pp.cc \
    8890                variable.cc \
    8991                NTLconvert.cc \
     
    149151                fac_berlekamp.h \
    150152                fac_cantzass.h \
     153                fac_univar.h \
    151154                facFqBivar.h \
    152155                facFqBivarUtil.h \
     
    168171                int_poly.h \
    169172                int_rat.h \
     173                int_pp.h \
    170174                timing.h \
    171175                variable.h \
  • factory/cf_char.cc

    r8ef929 re73082  
    1717#include "cf_primes.h"
    1818#include "cf_util.h"
     19#include "int_pp.h"
    1920
    2021STATIC_VAR int theCharacteristic = 0;
     
    4344}
    4445
     46#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
     47void setCharacteristic( int c, int n )
     48{
     49    ASSERT( c > 1 && n > 0, "illegal characteristic" );
     50    setCharacteristic( c );
     51    InternalPrimePower::setPrimePower( c, n );
     52    CFFactory::settype( PrimePowerDomain );
     53}
     54#endif
     55
     56
    4557void setCharacteristic( int c, int n, char name )
    4658{
  • factory/cf_defs.h

    r8ef929 re73082  
    2121
    2222#define UndefinedDomain 32000
     23#define PrimePowerDomain 5
    2324#define GaloisFieldDomain 4
    2425#define FiniteFieldDomain 3
     
    4950static const int SW_BERLEKAMP=10;
    5051
     52static const int SW_FAC_QUADRATICLIFT=11;
    5153/*ENDPUBLIC*/
    5254
  • factory/cf_factor.cc

    r8ef929 re73082  
    3333#include "fac_berlekamp.h"
    3434#include "fac_cantzass.h"
     35#include "fac_univar.h"
    3536
    3637#include "int_int.h"
     
    504505#endif
    505506#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
    506       // Use Factory without NTL
    507       {  // Use Factory without NTL
     507      // Use Factory without NTL: char p, univariate
     508      {
    508509        if ( isOn( SW_BERLEKAMP ) )
    509510          F=FpFactorizeUnivariateB( f, issqrfree );
     
    601602      goto end_char0;
    602603      #else
    603       factoryError ("univariate factorization over Z depends on NTL/FLINT(missing)");
    604       return CFFList (CFFactor (f, 1));
     604      {
     605        //Use Factory without NTL: char 0, univariate
     606        F = ZFactorizeUnivariate( fz, issqrfree );
     607        goto end_char0;
     608      }
    605609      #endif
    606610    }
  • factory/cf_switches.h

    r8ef929 re73082  
    2020 *
    2121**/
    22 const int CFSwitchesMax = 11;
     22const int CFSwitchesMax = 12;
    2323
    2424/** class CFSwitches
  • factory/fac_univar.cc

    r8ef929 re73082  
    1818#include "cf_primes.h"
    1919#include "fac_sqrfree.h"
    20 
     20#include "cfUnivarGcd.h"
     21
     22#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
    2123TIMING_DEFINE_PRINT(fac_choosePrimes)
    2224TIMING_DEFINE_PRINT(fac_facModPrimes)
     
    215217}
    216218
     219bool isSqrFreeZ ( const CanonicalForm & f )
     220{
     221    return gcd( f, f.deriv() ).degree() == 0;
     222}
     223
     224bool isSqrFreeFp( const CanonicalForm & f )
     225{
     226  CFFList F = sqrFreeFp( f );
     227  return ( F.length() == 1 && F.getFirst().exp() == 1 );
     228}
     229
     230bool isSqrFree ( const CanonicalForm & f )
     231{
     232//    ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );
     233    if ( getCharacteristic() == 0 )
     234        return isSqrFreeZ( f );
     235    else
     236        return isSqrFreeFp( f );
     237}
     238
    217239
    218240static int choosePrimes ( int * p, const CanonicalForm & f )
     
    249271    int i, j, save;
    250272    int p = pk.getp(), k = pk.getk();
    251     int no_iter = (int)(log( (double)k )/log(2.0)+2);
     273    int no_iter = SI_LOG2(k)+2;
    252274    int * kvals = new int[no_iter];
    253275
     
    278300        {
    279301            j--;
    280             setCharacteristic( p, kvals[j+1] );
     302            setCharacteristic( p, kvals[j+1]);
    281303            DEBOUTLN( cerr, "lifting from p^" << kvals[j+1] << " to p^" << kvals[j] );
    282304            c = mapinto( c );
     
    542564    return ZF;
    543565}
     566#endif
  • factory/int_pp.cc

    r8ef929 re73082  
    1313#include "imm.h"
    1414
     15#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
    1516mpz_t InternalPrimePower::primepow;
    1617mpz_t InternalPrimePower::primepowhalf;
     
    408409}
    409410//}}}
     411#endif
Note: See TracChangeset for help on using the changeset viewer.