Changeset f152c5 in git for libfac


Ignore:
Timestamp:
Jun 24, 2011, 5:20:59 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
5e1226f141996c2f2151d550d0e897ad75686b2b
Parents:
fcf7587e9d782e98bec5f1ff1852bb6a0d383f83
Message:
removed Factorize2

git-svn-id: file:///usr/local/Singular/svn/trunk@14303 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
libfac
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • libfac/charset/alg_factor.cc

    rfcf7587 rf152c5  
    178178      }
    179179      else
    180         testlist= Factorize(R);
     180        testlist= factorize(R);
    181181      DEBOUTLN(CERR, "testlist= ", testlist);
    182182      testlist.removeFirst();
  • libfac/charset/charset.cc

    rfcf7587 rf152c5  
    494494    if ( degree(elem) > 1 ) // linear poly's are irreduzible
    495495    {
    496       qs = Factorize(elem);
     496      qs = factorize(elem);
    497497      // remove a constant
    498498      if (qs.getFirst().factor().degree()==0) qs.removeFirst();
  • libfac/charset/csutil.cc

    rfcf7587 rf152c5  
    395395  else
    396396  {
    397     sqrfreelist = Factorize(init);
     397    sqrfreelist = factorize(init);
    398398    //sqrfreelist.removeFirst();
    399399  }
     
    498498  for ( CFListIterator i=ps; i. hasItem(); i++ )
    499499  {
    500     q=Factorize(i.getItem());
     500    q=factorize(i.getItem());
    501501    q.removeFirst();
    502502    // Next can be simplified ( first (already removed) elem in q is the only constant
  • libfac/factor.h

    rfcf7587 rf152c5  
    1717extern const char * libfac_author;
    1818
    19 //// Note: second argument for Factorize is for internal use only.
    20 CFFList Factorize( const CanonicalForm & F, int is_SqrFree=0 ) ;
    2119CFFList Factorize( const CanonicalForm & F, const CanonicalForm & mipo, int is_SqrFree=0 ) ;
    22 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly );
    2320CFFList newfactoras( const CanonicalForm & f, const CFList & as, int &success);
    2421CFFList newcfactor( const CanonicalForm & f, const CFList & as, int &success);
  • libfac/factor/Factor.cc

    rfcf7587 rf152c5  
    5858  if (alpha.level() <0)
    5959  {
    60     if (f.isUnivariate())
    61       return factorize(f,alpha);
    62     else
    63     {
    64       return Factorize(f,mipo);
    65     }
     60    return factorize(f,alpha);
    6661  }
    6762  else
     
    626621                Extension.level());
    627622      TIMING_START(evaluate_time);
    628      #if 1
    629      Outputlist = factorize2(F,Extension,alpha);
    630      #else
    631       Variable X;
    632       CanonicalForm mipo=getMipo(Extension,X);
    633       CFList as(mipo);
    634       Outputlist = newfactoras( F, as, 1);
    635      #endif
     623      Outputlist = factorize2(F,Extension,alpha);
    636624      TIMING_END(evaluate_time);
    637625      return Outputlist;
     
    742730      DEBOUTLN(CERR, "Univ. Factorization over extension of degree ",
    743731               degree(getMipo(Extension,'x')) );
    744      #if 1
    745732      UnivariateFactorlist = factorize2(ffuni,Extension,alpha);
    746      #else
    747       Variable X;
    748       CanonicalForm mipo=getMipo(Extension,X);
    749       CFList as(mipo);
    750       UnivariateFactorlist = newfactoras( ffuni, as, 1);
    751      #endif
    752733    }
    753734  }
     
    999980   return fdivides(F,G);
    1000981}
    1001 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly )
    1002 {
    1003 #ifndef NDEBUG
    1004   //printf("start Factorize2(int_flag=%d)\n",libfac_interruptflag);
    1005 #endif
    1006   CFFList G,H;
    1007   CanonicalForm fac;
    1008   int d,e;
    1009   ListIterator<CFFactor> i,k;
    1010   libfac_interruptflag=0;
    1011   CFFList iF=Factorize(F,minpoly);
    1012   if ((libfac_interruptflag==0)&&(!iF.isEmpty()))
    1013     H=iF;
    1014   else
    1015   {
    1016 #ifndef NDEBUG
    1017     //printf("variant 2(int_flag=%d)\n",libfac_interruptflag);
    1018 #endif
    1019     libfac_interruptflag=0;
    1020     iF=Factorize(F);
    1021     if (libfac_interruptflag==0)
    1022     {
    1023       i = iF;
    1024       while( i.hasItem())
    1025       {
    1026         d = i.getItem().exp();
    1027         fac = i.getItem().factor();
    1028         if (fdivides(fac,F))
    1029         {
    1030           if ((getNumVars(fac)==0)||(fac.degree()<=1))
    1031           {
    1032 #ifndef NOSTREAMIO
    1033 #ifndef NDEBUG
    1034             //printf("append trivial factor\n");
    1035 #endif
    1036 #endif
    1037             H.append( CFFactor( fac, d));
    1038             do {F/=fac; d--; } while (d>0);
    1039           }
    1040           else
    1041           {
    1042             G = Factorize( fac, minpoly);
    1043             if (libfac_interruptflag!=0)
    1044             {
    1045               libfac_interruptflag=0;
    1046               k = G;
    1047               while( k.hasItem())
    1048               {
    1049                 fac = k.getItem().factor();
    1050                 int dd = k.getItem().exp()*d;
    1051                 e=0;
    1052                 while ((!fac.isZero())&& fdivides2(fac,F,minpoly) && (dd>0))
    1053                 {
    1054 #ifndef NOSTREAMIO
    1055 #ifndef NDEBUG
    1056                   //out_cf("factor:",fac,"\n");
    1057 #endif
    1058 #endif
    1059                   e++;dd--;
    1060                   F/=fac;
    1061                 }
    1062                 if (e>0) H.append( CFFactor( fac , e ) );
    1063                 ++k;
    1064               }
    1065             }
    1066           }
    1067         }
    1068         ++i;
    1069       }
    1070     }
    1071   }
    1072   //Outputlist = newfactoras( F, as, 1);
    1073   if((isOn(SW_USE_NTL_SORT))&&(!H.isEmpty())) H.sort(cmpCF);
    1074 #ifndef NDEBUG
    1075   //printf("end Factorize2(%d)\n",libfac_interruptflag);
    1076 #endif
    1077   return H;
    1078 }
    1079982
    1080983CFFList
     
    11191022        //CFFList sqF=sqrFree(F); // sqrFreeZ
    11201023        CFFList sqF=SqrFreeMV(F,minpoly);
    1121         if (sqF.isEmpty()) sqF=sqrFree(F);
     1024        if (sqF.isEmpty()) sqF=sqrFree(F);
    11221025        CFFList G,H;
    11231026        CanonicalForm fac;
     
    11371040          }
    11381041        }
    1139         //Outputlist = newfactoras( F, as, 1);
    11401042        Outputlist = H;
    11411043      }
  • libfac/factor/homogfactor.cc

    rfcf7587 rf152c5  
    2626void out_cf(char *s1,const CanonicalForm &f,char *s2);
    2727
    28 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly );
    29 
    3028#ifdef HFACTORDEBUG
    3129#  define DEBUGOUTPUT
     
    152150  // should we do this for low degree polys g ? e.g. quadratic?
    153151  //
    154   CFFList Intermediatelist;
    155152  CFFList Homoglist;
    156153  CFFListIterator j;
    157   if ( getCharacteristic() > 0 )
    158   {
    159      CFMap n;
    160      if (minpoly.isZero())
    161        Intermediatelist = Factorize(compress(F,n), 1);
    162      else
    163        Intermediatelist = Factorized(compress(F,n), minpoly, Mainvar);
    164      for ( j=Intermediatelist; j.hasItem(); j++ )
    165        Homoglist.append(CFFactor( n(j.getItem().factor()), j.getItem().exp()) );
    166   }
     154  if (minpoly.isZero())
     155    Homoglist = factorize(F, 1);
    167156  else
    168157  {
    169      if (minpoly.isZero())
    170        Homoglist = factorize(F);
    171      else
    172        Homoglist = Factorize2(F,minpoly);
     158    CFFList Intermediatelist;
     159    CFMap n;
     160    Intermediatelist = Factorized(compress(F,n), minpoly, Mainvar);
     161    for ( j=Intermediatelist; j.hasItem(); j++ )
     162      Homoglist.append(CFFactor( n(j.getItem().factor()), j.getItem().exp()) );
    173163  }
    174164  // Now we have uncompressed factors in Homoglist
  • libfac/test.cc

    rfcf7587 rf152c5  
    4848//////////////////////////////////////////////////////////////
    4949//    COUT << " f = ";
    50     CIN >> f;
    51     COUT << f  << " mod " << charac << " = " ;
    52     Factorlist= Factorize( f,0 );
    53      COUT << Factorlist ;//<< "\n";
     50//    CIN >> f;
     51//    COUT << f  << " mod " << charac << " = " ;
     52//    Factorlist= Factorize( f,0 );
     53//     COUT << Factorlist ;//<< "\n";
    5454// Ueberpruefen:
    55     g=1;
    56     for ( CFFListIterator i=Factorlist ; i.hasItem(); i++){
    57         copy = i.getItem();
    58         if ( getNumVars(copy.factor()) > 0 )
    59              for ( int j=1; j<=copy.exp(); j++)
    60              g *= copy.factor();
    61         else g *= copy.factor();
    62     }
    63     if ( (f-g) != f.genZero() ){
    64         CERR << "\nList and f differ: f= " << f << "  g= " << g << "\n";
    65     }
     55//    g=1;
     56//    for ( CFFListIterator i=Factorlist ; i.hasItem(); i++){
     57//      copy = i.getItem();
     58//      if ( getNumVars(copy.factor()) > 0 )
     59//           for ( int j=1; j<=copy.exp(); j++)
     60//           g *= copy.factor();
     61//      else g *= copy.factor();
     62 //   }
     63//    if ( (f-g) != f.genZero() ){
     64//      CERR << "\nList and f differ: f= " << f << "  g= " << g << "\n";
     65 //   }
    6666}
Note: See TracChangeset for help on using the changeset viewer.