- Timestamp:
- Jun 24, 2011, 5:20:59 PM (12 years ago)
- Branches:
- (u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
- Children:
- 5e1226f141996c2f2151d550d0e897ad75686b2b
- Parents:
- fcf7587e9d782e98bec5f1ff1852bb6a0d383f83
- Location:
- libfac
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
libfac/charset/alg_factor.cc
rfcf7587 rf152c5 178 178 } 179 179 else 180 testlist= Factorize(R);180 testlist= factorize(R); 181 181 DEBOUTLN(CERR, "testlist= ", testlist); 182 182 testlist.removeFirst(); -
libfac/charset/charset.cc
rfcf7587 rf152c5 494 494 if ( degree(elem) > 1 ) // linear poly's are irreduzible 495 495 { 496 qs = Factorize(elem);496 qs = factorize(elem); 497 497 // remove a constant 498 498 if (qs.getFirst().factor().degree()==0) qs.removeFirst(); -
libfac/charset/csutil.cc
rfcf7587 rf152c5 395 395 else 396 396 { 397 sqrfreelist = Factorize(init);397 sqrfreelist = factorize(init); 398 398 //sqrfreelist.removeFirst(); 399 399 } … … 498 498 for ( CFListIterator i=ps; i. hasItem(); i++ ) 499 499 { 500 q= Factorize(i.getItem());500 q=factorize(i.getItem()); 501 501 q.removeFirst(); 502 502 // Next can be simplified ( first (already removed) elem in q is the only constant -
libfac/factor.h
rfcf7587 rf152c5 17 17 extern const char * libfac_author; 18 18 19 //// Note: second argument for Factorize is for internal use only.20 CFFList Factorize( const CanonicalForm & F, int is_SqrFree=0 ) ;21 19 CFFList Factorize( const CanonicalForm & F, const CanonicalForm & mipo, int is_SqrFree=0 ) ; 22 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly );23 20 CFFList newfactoras( const CanonicalForm & f, const CFList & as, int &success); 24 21 CFFList newcfactor( const CanonicalForm & f, const CFList & as, int &success); -
libfac/factor/Factor.cc
rfcf7587 rf152c5 58 58 if (alpha.level() <0) 59 59 { 60 if (f.isUnivariate()) 61 return factorize(f,alpha); 62 else 63 { 64 return Factorize(f,mipo); 65 } 60 return factorize(f,alpha); 66 61 } 67 62 else … … 626 621 Extension.level()); 627 622 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); 636 624 TIMING_END(evaluate_time); 637 625 return Outputlist; … … 742 730 DEBOUTLN(CERR, "Univ. Factorization over extension of degree ", 743 731 degree(getMipo(Extension,'x')) ); 744 #if 1745 732 UnivariateFactorlist = factorize2(ffuni,Extension,alpha); 746 #else747 Variable X;748 CanonicalForm mipo=getMipo(Extension,X);749 CFList as(mipo);750 UnivariateFactorlist = newfactoras( ffuni, as, 1);751 #endif752 733 } 753 734 } … … 999 980 return fdivides(F,G); 1000 981 } 1001 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly )1002 {1003 #ifndef NDEBUG1004 //printf("start Factorize2(int_flag=%d)\n",libfac_interruptflag);1005 #endif1006 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 else1015 {1016 #ifndef NDEBUG1017 //printf("variant 2(int_flag=%d)\n",libfac_interruptflag);1018 #endif1019 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 NOSTREAMIO1033 #ifndef NDEBUG1034 //printf("append trivial factor\n");1035 #endif1036 #endif1037 H.append( CFFactor( fac, d));1038 do {F/=fac; d--; } while (d>0);1039 }1040 else1041 {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 NOSTREAMIO1055 #ifndef NDEBUG1056 //out_cf("factor:",fac,"\n");1057 #endif1058 #endif1059 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 NDEBUG1075 //printf("end Factorize2(%d)\n",libfac_interruptflag);1076 #endif1077 return H;1078 }1079 982 1080 983 CFFList … … 1119 1022 //CFFList sqF=sqrFree(F); // sqrFreeZ 1120 1023 CFFList sqF=SqrFreeMV(F,minpoly); 1121 1024 if (sqF.isEmpty()) sqF=sqrFree(F); 1122 1025 CFFList G,H; 1123 1026 CanonicalForm fac; … … 1137 1040 } 1138 1041 } 1139 //Outputlist = newfactoras( F, as, 1);1140 1042 Outputlist = H; 1141 1043 } -
libfac/factor/homogfactor.cc
rfcf7587 rf152c5 26 26 void out_cf(char *s1,const CanonicalForm &f,char *s2); 27 27 28 CFFList Factorize2(CanonicalForm F, const CanonicalForm & minpoly );29 30 28 #ifdef HFACTORDEBUG 31 29 # define DEBUGOUTPUT … … 152 150 // should we do this for low degree polys g ? e.g. quadratic? 153 151 // 154 CFFList Intermediatelist;155 152 CFFList Homoglist; 156 153 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); 167 156 else 168 157 { 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()) ); 173 163 } 174 164 // Now we have uncompressed factors in Homoglist -
libfac/test.cc
rfcf7587 rf152c5 48 48 ////////////////////////////////////////////////////////////// 49 49 // 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"; 54 54 // 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 // } 66 66 }
Note: See TracChangeset
for help on using the changeset viewer.