Changeset 860d71 in git


Ignore:
Timestamp:
May 11, 2012, 3:10:11 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
Children:
0d1984ff9810b1f329e5aea72c3390fe48bc5e63
Parents:
b0ca43c93260d239fb0b76a8aa762b1ea55d09a2845c26085348f7b5e0c6e14ec73d58120fe1aa80
Message:
Merge pull request #108 from mmklee/factory_clean_up_sw

Factory clean up sw
Files:
9 added
52 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    rb0ca43c r860d71  
    117117#ifdef HAVE_SPECTRUM
    118118#include <kernel/spectrum.h>
    119 #endif
    120 
    121 #ifdef HAVE_BIFAC
    122 #include <bifac.h>
    123119#endif
    124120
     
    34823478      }
    34833479      else
    3484   /*==================== bifac =================*/
    3485   #ifdef HAVE_BIFAC
    3486       if (strcmp(sys_cmd, "bifac")==0)
    3487       {
    3488         if (h->Typ()!=POLY_CMD)
    3489         {
    3490           WerrorS("`system(\"bifac\",<poly>) expected");
    3491           return TRUE;
    3492         }
    3493         if (!rField_is_Q(currRing))
    3494         {
    3495           WerrorS("coeff field must be Q");
    3496           return TRUE;
    3497         }
    3498         BIFAC B;
    3499         CFFList C;
    3500         int sw_rat=isOn(SW_RATIONAL);
    3501         On(SW_RATIONAL);
    3502         CanonicalForm F( convSingPClapP((poly)(h->Data()), currRing));
    3503         B.bifac(F, 1);
    3504         CFFList L=B.getFactors();
    3505         // construct the ring ==============================================
    3506         int i;
    3507         int lev=ExtensionLevel();
    3508         char **names=(char**)omAlloc0(lev*sizeof(char_ptr));
    3509         for(i=1;i<=lev; i++)
    3510         {
    3511           StringSetS("");
    3512           names[i-1]=omStrDup(StringAppend("a(%d)",i));
    3513         }
    3514         ring alg_ring=rDefault(0,lev,names);
    3515         ring new_ring=rCopy0(currRing); // all variable names, ordering etc.
    3516         new_ring->P=lev;
    3517         new_ring->parameter=names;
    3518         new_ring->extRing=alg_ring;
    3519         new_ring->ch=1; // WTF!!??? :(
    3520         rComplete(new_ring,TRUE);
    3521         // set the mipo ===============================================
    3522         ring save_currRing=currRing; idhdl save_currRingHdl=currRingHdl;
    3523         rChangeCurrRing(alg_ring);
    3524         ideal mipo_id=idInit(lev,1);
    3525         for (i=lev; i>0;i--)
    3526         {
    3527           CanonicalForm Mipo=getMipo(Variable(-i),Variable(i));
    3528           mipo_id->m[i-1]=convClapPSingP(Mipo);
    3529         }
    3530         idShow(mipo_id);
    3531         alg_ring->qideal=mipo_id;
    3532         rChangeCurrRing(new_ring);
    3533         for (i=lev-1; i>=0;i--)
    3534         {
    3535           poly p=pOne();
    3536           lnumber n=(lnumber)pGetCoeff(p);
    3537           // no need to delete nac 1
    3538           n->z=(napoly)mipo_id->m[i];
    3539           mipo_id->m[i]=p;
    3540         }
    3541         new_ring->qideal=id_Copy(alg_ring->qideal,new_ring);
    3542         // convert factors =============================================
    3543         ideal fac_id=idInit(L.length(),1);
    3544         CFFListIterator J=L;
    3545         i=0;
    3546         intvec *v = new intvec( L.length() );
    3547         for ( ; J.hasItem(); J++,i++ )
    3548         {
    3549           fac_id->m[i]=convClapAPSingAP( J.getItem().factor() );
    3550           (*v)[i]=J.getItem().exp();
    3551         }
    3552         idhdl hh=enterid("factors",0,LIST_CMD,&(currRing->idroot),FALSE);
    3553         lists LL=(lists)omAllocBin( slists_bin);
    3554         LL->Init(2);
    3555         LL->m[0].rtyp=IDEAL_CMD;
    3556         LL->m[0].data=(char *)fac_id;
    3557         LL->m[1].rtyp=INTVEC_CMD;
    3558         LL->m[1].data=(char *)v;
    3559         IDDATA(hh)=(char *)LL;
    3560 
    3561         rChangeCurrRing(save_currRing);
    3562         currRingHdl=save_currRingHdl;
    3563         if (!sw_rat) Off(SW_RATIONAL);
    3564 
    3565         res->data=new_ring;
    3566         res->rtyp=RING_CMD;
    3567         return FALSE;
    3568       }
    3569       else
    3570   #endif
    35713480  /*==================== gcd-varianten =================*/
    35723481  #ifdef HAVE_FACTORY
     
    35813490          Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P));
    35823491          Print("CRGCD:%d (use chinese Remainder for gcd of polynomials in char 0)\n",isOn(SW_USE_CHINREM_GCD));
    3583           Print("SPARSEMOD:%d (use SPARSEMOD for gcd of polynomials in char 0)\n",isOn(SW_USE_SPARSEMOD));
    35843492          Print("QGCD:%d (use QGCD for gcd of polynomials in alg. ext.)\n",isOn(SW_USE_QGCD));
    3585           Print("FGCD:%d (use fieldGCD for gcd of polynomials in Z/p)\n",isOn(SW_USE_fieldGCD));
    35863493#endif
    35873494          Print("homog:%d (use homog. test for factorization of polynomials)\n",singular_homog_flag);
     
    36003507          if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else
    36013508          if (strcmp(s,"CRGCD")==0) { if (d) On(SW_USE_CHINREM_GCD); else Off(SW_USE_CHINREM_GCD); } else
    3602           if (strcmp(s,"SPARSEMOD")==0) { if (d) On(SW_USE_SPARSEMOD); else Off(SW_USE_SPARSEMOD); } else
    36033509          if (strcmp(s,"QGCD")==0) { if (d) On(SW_USE_QGCD); else Off(SW_USE_QGCD); } else
    3604           if (strcmp(s,"FGCD")==0) { if (d) On(SW_USE_fieldGCD); else Off(SW_USE_fieldGCD); } else
    36053510#endif
    36063511          if (strcmp(s,"homog")==0) { if (d) singular_homog_flag=1; else singular_homog_flag=0; } else
  • Singular/misc_ip.cc

    rb0ca43c r860d71  
    10901090  On(SW_USE_CHINREM_GCD);
    10911091  //On(SW_USE_FF_MOD_GCD);
    1092   //On(SW_USE_fieldGCD);
    10931092  On(SW_USE_EZGCD_P);
    10941093  On(SW_USE_QGCD);
  • Tst/Long/ok_l.lst

    rb0ca43c r860d71  
    2222gcd0_l
    2323gcdp_l
     24gcd_univar_p_create
    2425groebner_l
    2526hnoether_l
  • Tst/Short/ok_s.lst

    rb0ca43c r860d71  
    156156gcd5test
    157157gcdp_s
     158gcd_univar_p_s
     159gcd_univar_p_alpha_s
    158160gerhard_1_32003_lp
    159161Gonnet-83_32003_dp_slim
  • factory/Makefile.am

    rb0ca43c r860d71  
    7878                facMul.cc \
    7979                facSparseHensel.cc \
    80                 fieldGCD.cc \
    8180                ffops.cc \
    8281                FLINTconvert.cc \
     
    9089                int_pp.cc \
    9190                int_rat.cc \
    92                 sm_sparsemod.cc \
    93                 sm_util.cc \
    9491                variable.cc \
    9592                NTLconvert.cc \
    96                 abs_fac.cc \
    97                 bifac.cc \
    98                 lgs.cc \
    9993                singext.cc \
    10094                parseutil.cc \
     
    163157                facMul.h \
    164158                facSparseHensel.h \
    165                 fieldGCD.h \
    166159                ffops.h \
    167160                FLINTconvert.h \
     
    175168                int_pp.h \
    176169                int_rat.h \
    177                 sm_sparsemod.h \
    178                 sm_util.h \
    179170                timing.h \
    180171                variable.h \
    181172                NTLconvert.h \
    182                 bifac.h \
    183                 bifacConfig.h \
    184                 lgs.h \
    185173                algext.h \
    186174                singext.h \
     
    261249                factory.template
    262250
    263 # FTE source files
    264 ftestsrc =      ftest/ftest_io.cc \
    265                 ftest/ftest_util.cc \
    266                 ftest/ntl_util.cc
    267 
    268 # FTE header files
    269 ftestincl =     ftest/ftest_io.h \
    270                 ftest/ftest_util.h \
    271                 ftest/ntl_util.h
    272 
    273 ftestm4src =    ftest/commonden.m4 \
    274                 ftest/degree.m4 \
    275                 ftest/deriv.m4 \
    276                 ftest/divides.m4 \
    277                 ftest/divrem.m4 \
    278                 ftest/extgcd.m4 \
    279                 ftest/factorize.m4 \
    280                 ftest/fbinops.m4 \
    281                 ftest/feval.m4 \
    282                 ftest/gcd.m4 \
    283                 ftest/gcd.ntl.m4 \
    284                 ftest/insert.m4 \
    285                 ftest/norm.m4 \
    286                 ftest/resultant.m4 \
    287                 ftest/revert.m4 \
    288                 ftest/sqrfree.m4 \
    289                 ftest/size.m4 \
    290                 ftest/totaldegree.m4
    291 
    292 ftestdistfiles = \
    293                 ftest/ftest_util.m4
    294 
    295251EXTRA_DIST =    test_install.cc \
    296252                $(templatesrc) $(hdrtemplsrc) \
    297                 $(ftestsrc) $(ftestincl) $(ftestm4src) $(ftestdistfiles) \
    298253                doxygen.cfg factory.cfg \
    299254                examples/application.cc \
  • factory/algext.cc

    rb0ca43c r860d71  
    2323#include "cf_algorithm.h"
    2424#include "algext.h"
    25 #include "fieldGCD.h"
    2625#include "cf_map.h"
    2726#include "cf_generator.h"
  • factory/cf_chinese.cc

    rb0ca43c r860d71  
    66// cf_chinese.cc - algorithms for chinese remaindering.
    77//
    8 // Used by: cf_gcd.cc, cf_linsys.cc, sm_util.cc
     8// Used by: cf_gcd.cc, cf_linsys.cc
    99//
    1010// Header file: cf_algorithm.h
  • factory/cf_defs.h

    rb0ca43c r860d71  
    2828//}}}
    2929const int SW_RATIONAL = 0;
    30 const int SW_QUOTIENT = 1;
    31 const int SW_SYMMETRIC_FF = 2;
    32 const int SW_BERLEKAMP = 3;
    33 const int SW_FAC_USE_BIG_PRIMES = 4;
    34 const int SW_FAC_QUADRATICLIFT = 5;
    35 const int SW_USE_EZGCD = 6;
    36 const int SW_USE_EZGCD_P = 7;
    37 const int SW_USE_SPARSEMOD = 8;
    38 const int SW_USE_NTL=9;
    39 const int SW_USE_NTL_GCD_0=10;
    40 const int SW_USE_NTL_GCD_P=11;
    41 const int SW_USE_NTL_SORT=12;
    42 const int SW_USE_CHINREM_GCD=13;
    43 const int SW_USE_QGCD=14;
    44 const int SW_USE_fieldGCD=15;
    45 const int SW_USE_FF_MOD_GCD=16;
     30const int SW_SYMMETRIC_FF = 1;
     31const int SW_BERLEKAMP = 2;
     32const int SW_FAC_QUADRATICLIFT = 3;
     33const int SW_USE_EZGCD = 4;
     34const int SW_USE_EZGCD_P = 5;
     35const int SW_USE_NTL=6;
     36const int SW_USE_NTL_GCD_0=7;
     37const int SW_USE_NTL_GCD_P=8;
     38const int SW_USE_NTL_SORT=9;
     39const int SW_USE_CHINREM_GCD=10;
     40const int SW_USE_QGCD=11;
     41const int SW_USE_FF_MOD_GCD=12;
    4642//}}}
    4743
  • factory/cf_gcd.cc

    rb0ca43c r860d71  
    1717#include "templates/ftmpl_functions.h"
    1818#include "algext.h"
    19 #include "fieldGCD.h"
    2019#include "cf_gcd_smallp.h"
    2120#include "cf_map_ext.h"
     
    688687// This is the dispatcher for polynomial gcd calculation.  We call either
    689688// ezgcd(), sparsemod() or gcd_poly1() in dependecy on the current
    690 // characteristic and settings of SW_USE_EZGCD and SW_USE_SPARSEMOD, resp.
     689// characteristic and settings of SW_USE_EZGCD.
    691690//
    692691// Used by gcd() and gcd_poly_univar0().
     
    724723  if ( getCharacteristic() != 0 )
    725724  {
    726     if ((!fc_and_gc_Univariate)
    727     && isOn(SW_USE_fieldGCD)
    728     && (getCharacteristic() >100))
    729     {
    730       return fieldGCD(f,g);
    731     }
    732725    #ifdef HAVE_NTL
    733     else if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P )))
     726    if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P )))
    734727    {
    735728      fc= EZGCD_P (fc, gc);
  • factory/cf_gcd_smallp.cc

    rb0ca43c r860d71  
    4141
    4242#ifdef HAVE_NTL
    43 #include <NTL/ZZ_pEX.h>
    4443#include <NTLconvert.h>
    4544#endif
     
    435434{
    436435  int p= getCharacteristic();
    437   ZZ NTLp= to_ZZ (p);
    438   ZZ_p::init (NTLp);
    439   ZZ_pX NTLirredpoly;
     436  zz_p::init (p);
     437  zz_pX NTLirredpoly;
    440438  //TODO: replace d by max_{i} (deg_x{i}(f))
    441439  int i= (int) (log ((double) ipower (d + 1, num_vars))/log ((double) p));
     
    444442    i= 2;
    445443  BuildIrred (NTLirredpoly, i*m);
    446   CanonicalForm mipo= convertNTLZZpX2CF (NTLirredpoly, Variable(1));
     444  CanonicalForm mipo= convertNTLzzpX2CF (NTLirredpoly, Variable(1));
    447445  beta= rootOf (mipo);
    448446}
     
    13351333{
    13361334  int p= getCharacteristic();
    1337   ZZ NTLp= to_ZZ (p);
    1338   ZZ_p::init (NTLp);
    1339   ZZ_pX NTLirredpoly;
     1335  zz_p::init (p);
     1336  zz_pX NTLirredpoly;
    13401337  CanonicalForm CFirredpoly;
    13411338  BuildIrred (NTLirredpoly, i + 1);
    1342   CFirredpoly= convertNTLZZpX2CF (NTLirredpoly, x);
     1339  CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x);
    13431340  return CFirredpoly;
    13441341}
  • factory/cf_map.cc

    rb0ca43c r860d71  
    66// cf_map.cc - definition of class CFMap.
    77//
    8 // Used by: cf_gcd.cc, fac_multivar.cc, sm_sparsemod.cc
     8// Used by: cf_gcd.cc, fac_multivar.cc
    99//
    1010//}}}
  • factory/cf_map_ext.cc

    rb0ca43c r860d71  
    2828
    2929#ifdef HAVE_NTL
    30 #include <NTL/ZZ_pEXFactoring.h>
    3130#include "NTLconvert.h"
    3231#endif
  • factory/cf_switches.cc

    rb0ca43c r860d71  
    3838  //On(SW_USE_EZGCD_P); // still testing
    3939  On(SW_USE_QGCD);
    40   //On(SW_USE_fieldGCD);
    4140}
    4241//}}}
  • factory/cf_switches.h

    rb0ca43c r860d71  
    1919//
    2020//}}}
    21 const int CFSwitchesMax = 17;
     21const int CFSwitchesMax = 13;
    2222//}}}
    2323
  • factory/facFqBivar.cc

    rb0ca43c r860d71  
    154154          "univariate polynomial expected or constant expected");
    155155  CFFList factorsA;
    156   ZZ p= to_ZZ (getCharacteristic());
    157   ZZ_p::init (p);
     156  zz_p::init (getCharacteristic());
    158157  if (GF)
    159158  {
     
    166165    if (getCharacteristic() > 2)
    167166    {
    168       ZZ_pX NTLMipo= convertFacCF2NTLZZpX (mipo.mapinto());
    169       ZZ_pE::init (NTLMipo);
    170       ZZ_pEX NTLA= convertFacCF2NTLZZ_pEX (buf, NTLMipo);
     167      zz_pX NTLMipo= convertFacCF2NTLzzpX (mipo.mapinto());
     168      zz_pE::init (NTLMipo);
     169      zz_pEX NTLA= convertFacCF2NTLzz_pEX (buf, NTLMipo);
    171170      MakeMonic (NTLA);
    172       vec_pair_ZZ_pEX_long NTLFactorsA= CanZass (NTLA);
    173       ZZ_pE multi= to_ZZ_pE (1);
    174       factorsA= convertNTLvec_pair_ZZpEX_long2FacCFFList (NTLFactorsA, multi,
     171      vec_pair_zz_pEX_long NTLFactorsA= CanZass (NTLA);
     172      zz_pE multi= to_zz_pE (1);
     173      factorsA= convertNTLvec_pair_zzpEX_long2FacCFFList (NTLFactorsA, multi,
    175174                                                         x, beta);
    176175    }
     
    198197    if (getCharacteristic() > 2)
    199198    {
    200       ZZ_pX NTLMipo= convertFacCF2NTLZZpX (getMipo (alpha));
    201       ZZ_pE::init (NTLMipo);
    202       ZZ_pEX NTLA= convertFacCF2NTLZZ_pEX (A, NTLMipo);
     199      zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
     200      zz_pE::init (NTLMipo);
     201      zz_pEX NTLA= convertFacCF2NTLzz_pEX (A, NTLMipo);
    203202      MakeMonic (NTLA);
    204       vec_pair_ZZ_pEX_long NTLFactorsA= CanZass (NTLA);
    205       ZZ_pE multi= to_ZZ_pE (1);
    206       factorsA= convertNTLvec_pair_ZZpEX_long2FacCFFList (NTLFactorsA, multi,
     203      vec_pair_zz_pEX_long NTLFactorsA= CanZass (NTLA);
     204      zz_pE multi= to_zz_pE (1);
     205      factorsA= convertNTLvec_pair_zzpEX_long2FacCFFList (NTLFactorsA, multi,
    207206                                                           x, alpha);
    208207    }
     
    235234    if (getCharacteristic() > 2)
    236235    {
    237       ZZ_pX NTLA= convertFacCF2NTLZZpX (A);
     236      zz_pX NTLA= convertFacCF2NTLzzpX (A);
    238237      MakeMonic (NTLA);
    239       vec_pair_ZZ_pX_long NTLFactorsA= CanZass (NTLA);
    240       ZZ_p multi= to_ZZ_p (1);
    241       factorsA= convertNTLvec_pair_ZZpX_long2FacCFFList (NTLFactorsA, multi,
     238      vec_pair_zz_pX_long NTLFactorsA= CanZass (NTLA);
     239      zz_p multi= to_zz_p (1);
     240      factorsA= convertNTLvec_pair_zzpX_long2FacCFFList (NTLFactorsA, multi,
    242241                                                          x);
    243242    }
  • factory/facFqFactorize.cc

    rb0ca43c r860d71  
    3535
    3636#ifdef HAVE_NTL
    37 #include <NTL/ZZ_pEX.h>
    3837#include "NTLconvert.h"
    3938
  • factory/fac_ezgcd.cc

    rb0ca43c r860d71  
    2525#include "cf_random.h"
    2626#include "cf_primes.h"
    27 #include "fac_distrib.h"
    2827#include "templates/ftmpl_functions.h"
    2928#include "cf_map.h"
  • factory/factory.template

    rb0ca43c r860d71  
    106106#include "facIrredTest.h"
    107107
    108 #ifdef HAVE_BIFAC
    109 /*MAKEHEADER PUBLIC ONLY*/
    110 #include "bifac.h"
    111 #endif /* HAVE_BIFAC */
    112 
    113108#endif /* ! INCL_FACTORY_H */
  • libpolys/polys/clapsing.cc

    rb0ca43c r860d71  
    7878    {
    7979      bool b1=isOn(SW_USE_QGCD);
    80       bool b2=isOn(SW_USE_fieldGCD);
    8180      if ( rField_is_Q_a(r) ) On(SW_USE_QGCD);
    82       else                   On(SW_USE_fieldGCD);
    8381      CanonicalForm mipo=convSingPFactoryP(r->cf->extRing->qideal->m[0],
    8482                                           r->cf->extRing);
     
    8886      res= convFactoryAPSingAP( gcd( F, G ),r );
    8987      if (!b1) Off(SW_USE_QGCD);
    90       if (!b2) Off(SW_USE_fieldGCD);
    9188    }
    9289    else
Note: See TracChangeset for help on using the changeset viewer.