Changeset 14b353 in git


Ignore:
Timestamp:
Jan 15, 2008, 1:36:50 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
91cb92b542294f362bdf9a8f1e38daa61e83dcc9
Parents:
b6e288f4c0fa89ce14c94afd004ec80ab76e77db
Message:
*hannes: more tests


git-svn-id: file:///usr/local/Singular/svn/trunk@10506 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_factor.cc

    rb6e288 r14b353  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_factor.cc,v 1.36 2008-01-07 13:33:10 Singular Exp $ */
     2/* $Id: cf_factor.cc,v 1.37 2008-01-15 12:36:50 Singular Exp $ */
    33
    44//{{{ docu
     
    397397  if ( getCharacteristic() > 0 )
    398398  {
    399     ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );
    400     #ifdef HAVE_NTL
    401     if (isOn(SW_USE_NTL) && (isPurePoly(f)))
    402     {
    403       // USE NTL
    404       if (getCharacteristic()!=2)
    405       {
    406         // set remainder
    407         if (fac_NTL_char!=getCharacteristic())
     399    if ( f.isUnivariate() )
     400    {
     401      #ifdef HAVE_NTL
     402      if (isOn(SW_USE_NTL) && (isPurePoly(f)))
     403      {
     404        // USE NTL
     405        if (getCharacteristic()!=2)
    408406        {
    409           fac_NTL_char=getCharacteristic();
     407          // set remainder
     408          if (fac_NTL_char!=getCharacteristic())
     409          {
     410            fac_NTL_char=getCharacteristic();
     411            #ifdef NTL_ZZ
     412            ZZ r;
     413            r=getCharacteristic();
     414            ZZ_pContext ccc(r);
     415            #else
     416            zz_pContext ccc(getCharacteristic());
     417            #endif
     418            ccc.restore();
     419            #ifdef NTL_ZZ
     420            ZZ_p::init(r);
     421            #else
     422            zz_p::init(getCharacteristic());
     423            #endif
     424          }
     425          // convert to NTL
    410426          #ifdef NTL_ZZ
    411           ZZ r;
    412           r=getCharacteristic();
    413           ZZ_pContext ccc(r);
     427          ZZ_pX f1=convertFacCF2NTLZZpX(f);
     428          ZZ_p leadcoeff = LeadCoeff(f1);
    414429          #else
    415           zz_pContext ccc(getCharacteristic());
     430          zz_pX f1=convertFacCF2NTLzzpX(f);
     431          zz_p leadcoeff = LeadCoeff(f1);
    416432          #endif
    417           ccc.restore();
     433          //make monic
     434          f1=f1 / LeadCoeff(f1);
     435
     436          // factorize
    418437          #ifdef NTL_ZZ
    419           ZZ_p::init(r);
     438          vec_pair_ZZ_pX_long factors;
    420439          #else
    421           zz_p::init(getCharacteristic());
     440          vec_pair_zz_pX_long factors;
    422441          #endif
     442          CanZass(factors,f1);
     443
     444          // convert back to factory
     445          #ifdef NTL_ZZ
     446          F=convertNTLvec_pair_ZZpX_long2FacCFFList(factors,leadcoeff,f.mvar());
     447          #else
     448          F=convertNTLvec_pair_zzpX_long2FacCFFList(factors,leadcoeff,f.mvar());
     449          #endif
     450          //test_cff(F,f);
    423451        }
    424         // convert to NTL
    425         #ifdef NTL_ZZ
    426         ZZ_pX f1=convertFacCF2NTLZZpX(f);
    427         ZZ_p leadcoeff = LeadCoeff(f1);
    428         #else
    429         zz_pX f1=convertFacCF2NTLzzpX(f);
    430         zz_p leadcoeff = LeadCoeff(f1);
    431         #endif
    432         //make monic
    433         f1=f1 / LeadCoeff(f1);
    434 
    435         // factorize
    436         #ifdef NTL_ZZ
    437         vec_pair_ZZ_pX_long factors;
    438         #else
    439         vec_pair_zz_pX_long factors;
    440         #endif
    441         CanZass(factors,f1);
    442 
    443         // convert back to factory
    444         #ifdef NTL_ZZ
    445         F=convertNTLvec_pair_ZZpX_long2FacCFFList(factors,leadcoeff,f.mvar());
    446         #else
    447         F=convertNTLvec_pair_zzpX_long2FacCFFList(factors,leadcoeff,f.mvar());
    448         #endif
    449         //test_cff(F,f);
     452        else
     453        {
     454          // Specialcase characteristic==2
     455          if (fac_NTL_char!=2)
     456          {
     457            fac_NTL_char=2;
     458            zz_p::init(2);
     459          }
     460          // convert to NTL using the faster conversion routine for characteristic 2
     461          GF2X f1=convertFacCF2NTLGF2X(f);
     462          // no make monic necessary in GF2
     463          //factorize
     464          vec_pair_GF2X_long factors;
     465          CanZass(factors,f1);
     466
     467          // convert back to factory again using the faster conversion routine for vectors over GF2X
     468          F=convertNTLvec_pair_GF2X_long2FacCFFList(factors,LeadCoeff(f1),f.mvar());
     469        }
    450470      }
    451471      else
    452       {
    453         // Specialcase characteristic==2
    454         if (fac_NTL_char!=2)
    455         {
    456           fac_NTL_char=2;
    457           zz_p::init(2);
    458         }
    459         // convert to NTL using the faster conversion routine for characteristic 2
    460         GF2X f1=convertFacCF2NTLGF2X(f);
    461         // no make monic necessary in GF2
    462         //factorize
    463         vec_pair_GF2X_long factors;
    464         CanZass(factors,f1);
    465 
    466         // convert back to factory again using the faster conversion routine for vectors over GF2X
    467         F=convertNTLvec_pair_GF2X_long2FacCFFList(factors,LeadCoeff(f1),f.mvar());
     472      #endif
     473      {  // Use Factory without NTL
     474        if ( isOn( SW_BERLEKAMP ) )
     475          F=FpFactorizeUnivariateB( f, issqrfree );
     476        else
     477          F=FpFactorizeUnivariateCZ( f, issqrfree, 0, Variable(), Variable() );
    468478      }
    469479    }
    470480    else
    471     #endif
    472     {  // Use Factory without NTL
    473       if ( isOn( SW_BERLEKAMP ) )
    474          F=FpFactorizeUnivariateB( f, issqrfree );
    475       else
    476         F=FpFactorizeUnivariateCZ( f, issqrfree, 0, Variable(), Variable() );
     481    {
     482        // char p, not univariate
     483        printf("factorize char p, not univariate\n");
    477484    }
    478485  }
Note: See TracChangeset for help on using the changeset viewer.