Changeset b86107 in git for factory/libfac/factor/Factor.cc
- Timestamp:
- Aug 3, 2012, 1:00:23 PM (12 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- c10f46e6c7991d296a0430998c801a958c5f4036
- Parents:
- 4093f96acfcc6419c56ee983c447099c3b87a36e2d71dd455de206f556c8c2200d3bc739a4a48ebb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/libfac/factor/Factor.cc
r4093f9 rb86107 27 27 28 28 #include "alg_factor.h" 29 void out_cf(c har *s1,const CanonicalForm &f,char *s2);29 void out_cf(const char *s1,const CanonicalForm &f,const char *s2); 30 30 void out_cff(CFFList &L); 31 31 … … 52 52 * ( in factorize, alpha.level() must be < 0 ) 53 53 */ 54 static 54 55 CFFList factorize2 ( const CanonicalForm & f, 55 56 const Variable & alpha, const CanonicalForm & mipo ) … … 61 62 else 62 63 { 63 bool repl=(f.mvar() != alpha);64 64 //out_cf("f2 - factor:",f,"\n"); 65 65 //out_cf("f2 - ext:",alpha,"\n"); … … 67 67 Variable X=rootOf(mipo); 68 68 CanonicalForm F=f; 69 if (repl)F=replacevar(f,alpha,X);69 F=replacevar(f,alpha,X); 70 70 //out_cf("call - factor:",F,"\n"); 71 71 //out_cf("call - ext:",X,"\n"); … … 73 73 CFFList L=factorize(F,X); 74 74 CFFListIterator i=L; 75 if (repl)76 75 { 77 76 CFFList Outputlist; … … 82 81 i.getItem().exp())); 83 82 } 83 //out_cff(Outputlist); 84 84 return Outputlist; 85 85 } 86 else return L;87 86 } 88 87 } … … 393 392 generate_mipo( int degree_of_Extension , const Variable & Extension ){ 394 393 FFRandom gen; 395 if ( degree(Extension) > 0 ) GFRandom gen; 396 else { 397 if ( degree(Extension) == 0 ) FFRandom gen; 398 else 399 { 400 factoryError("libfac: evaluate: Extension not inFF() or inGF() !"); 401 } 402 } 394 if (degree (Extension) < 0) 395 factoryError("libfac: evaluate: Extension not inFF() or inGF() !"); 403 396 return find_irreducible( degree_of_Extension, gen, Variable(1) ); 404 397 } … … 465 458 466 459 static int 467 specializePoly(const CanonicalForm & f, Variable & Extension, int deg, SFormList & Substitutionlist, int i,int j){ 460 specializePoly(const CanonicalForm & f, Variable & Extension, int deg, SFormList & Substitutionlist, int i,int j) 461 { 468 462 Variable minpoly= Extension; 469 463 int ok,extended= degree(Extension), working_over_extension; … … 474 468 // First try: 475 469 ok = try_specializePoly(f,minpoly,deg,Substitutionlist,i,j); 476 while ( ! ok ){ // we have to extend! 470 while ( ! ok ) // we have to extend! 471 { 472 SFormList origS=Substitutionlist; 477 473 extended+= 1; 478 if ( ! working_over_extension ){ 479 minpoly= rootOf(generate_mipo( extended,Extension )); 474 if ( ! working_over_extension ) 475 { 476 if (!hasMipo(Extension)) 477 minpoly= rootOf (generate_mipo (extended, Extension)); 478 else 479 { 480 setReduce (Extension, false); 481 setMipo (minpoly, generate_mipo ( extended, Extension)); 482 setReduce (Extension, true); 483 } 480 484 Extension= minpoly; 481 485 ok= try_specializePoly(f,minpoly,deg,Substitutionlist,i,j); 486 if (!ok) 487 Substitutionlist=origS; 482 488 } 483 489 else … … 804 810 { 805 811 //out_cf("Factorize ",F,"\n"); 806 CFFList Outputlist,SqrFreeList,Intermediatelist,Outputlist2; 807 ListIterator<CFFactor> i,j; 808 CanonicalForm g=1,unit=1,r=1; 809 Variable minpoly; // dummy 810 int exp; 811 CFMap m; 812 CFFList Outputlist; 812 813 813 814 // INTERRUPTHANDLER … … 831 832 return Outputlist; 832 833 } 834 CFFList SqrFreeList,Intermediatelist,Outputlist2; 835 ListIterator<CFFactor> i,j; 836 CanonicalForm g=1,unit=1,r=1; 837 Variable minpoly; // dummy 838 int exp; 839 CFMap m; 833 840 TIMING_START(factorize_time); 834 841 // search an "optimal" main variavble
Note: See TracChangeset
for help on using the changeset viewer.