Changeset c1b52b in git


Ignore:
Timestamp:
Jul 9, 2020, 4:54:28 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
22f43fd13906a985efeddb80031ed3478830660e412d19ec6555b98b2f553cc1ea8cf1b7115c830e
Parents:
afa77551770f2019ad99556a95d1327e8a25c616
Message:
factory: factorize char p, univariate (w/o FLINT, w/o NTL)
Location:
factory
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • factory/Makefile.am

    rafa7755 rc1b52b  
    6565                fac_sqrfree.cc \
    6666                fac_util.cc \
     67                fac_berlekamp.cc \
     68                fac_cantzass.cc \
    6769                facFqBivar.cc \
    6870                facFqBivarUtil.cc \
     
    145147                fac_sqrfree.h \
    146148                fac_util.h \
     149                fac_berlekamp.h \
     150                fac_cantzass.h \
    147151                facFqBivar.h \
    148152                facFqBivarUtil.h \
  • factory/cf_defs.h

    rafa7755 rc1b52b  
    4646/// set to 1 to use Flints gcd over Q/Z
    4747static const int SW_USE_FL_GCD_0=9;
     48/// set to 1 to use Factorys Berlekamp alg.
     49static const int SW_BERLEKAMP=10;
    4850
    4951/*ENDPUBLIC*/
  • factory/cf_factor.cc

    rafa7755 rc1b52b  
    3131#include "singext.h"
    3232#include "cf_util.h"
     33#include "fac_berlekamp.h"
     34#include "fac_cantzass.h"
    3335
    3436#include "int_int.h"
     
    439441#endif
    440442      {
    441         // use FLINT
     443        // use FLINT: char p, univariate
    442444        nmod_poly_t f1;
    443445        convertFacCF2nmod_poly_t (f1, f);
     
    453455#endif
    454456#ifdef HAVE_NTL
    455       {
     457      { // NTL char 2, univariate
    456458        if (getCharacteristic()==2)
    457459        {
     
    478480#ifdef HAVE_NTL
    479481      {
    480         // use NTL
     482        // use NTL char p, univariate
    481483        if (fac_NTL_char != getCharacteristic())
    482484        {
     
    503505#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
    504506      // Use Factory without NTL
    505       factoryError ("univariate factorization depends on FLINT/NTL(missing)");
    506       return CFFList (CFFactor (f, 1));
     507      {  // Use Factory without NTL
     508        if ( isOn( SW_BERLEKAMP ) )
     509          F=FpFactorizeUnivariateB( f, issqrfree );
     510        else
     511          F=FpFactorizeUnivariateCZ( f, issqrfree, 0, Variable(), Variable() );
     512        return F;
     513      }
    507514#endif
    508515    }
  • factory/cf_switches.h

    rafa7755 rc1b52b  
    2020 *
    2121**/
    22 const int CFSwitchesMax = 10;
     22const int CFSwitchesMax = 11;
    2323
    2424/** class CFSwitches
  • factory/fac_sqrfree.cc

    rafa7755 rc1b52b  
    150150}
    151151
     152#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
     153static int divexp = 1;
     154
     155static void divexpfunc ( CanonicalForm &, int & e )
     156{
     157    e /= divexp;
     158}
     159
     160CFFList sqrFreeFp ( const CanonicalForm & f )
     161{
     162    CanonicalForm t0 = f, t, v, w, h;
     163    CanonicalForm leadcf = t0.lc();
     164    Variable x = f.mvar();
     165    CFFList F;
     166    int p = getCharacteristic();
     167    int k, e = 1;
     168
     169    if ( ! leadcf.isOne() )
     170        t0 /= leadcf;
     171
     172    divexp = p;
     173    while ( t0.degree(x) > 0 )
     174    {
     175        t = gcd( t0, t0.deriv() );
     176        v = t0 / t;
     177        k = 0;
     178        while ( v.degree(x) > 0 )
     179        {
     180            k = k+1;
     181            if ( k % p == 0 )
     182            {
     183                t /= v;
     184                k = k+1;
     185            }
     186            w = gcd( t, v );
     187            h = v / w;
     188            v = w;
     189            t /= v;
     190            if ( h.degree(x) > 0 )
     191                F.append( CFFactor( h/h.lc(), e*k ) );
     192        }
     193        t0 = apply( t, divexpfunc );
     194        e = p * e;
     195    }
     196    if ( ! leadcf.isOne() )
     197    {
     198        if ( !F.isEmpty() && (F.getFirst().exp() == 1) )
     199        {
     200            leadcf = F.getFirst().factor() * leadcf;
     201            F.removeFirst();
     202        }
     203        F.insert( CFFactor( leadcf, 1 ) );
     204    }
     205    return F;
     206}
     207#endif
  • factory/fac_sqrfree.h

    rafa7755 rc1b52b  
    2222                       );
    2323
     24CFFList sqrFreeFp ( const CanonicalForm & f );
    2425#endif /* ! INCL_FAC_SQRFREE_H */
Note: See TracChangeset for help on using the changeset viewer.