Changeset 76a7114 in git
- Timestamp:
- Jan 30, 2006, 10:06:18 AM (18 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- ae2e227aeba249ea683ac81f35b40451d859514e
- Parents:
- a725daea0d4b710813033cd5906ef1c1f3437cd3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/fac_ezgcd.cc
ra725dae r76a7114 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: fac_ezgcd.cc,v 1.2 5 2005-12-16 11:21:30 SingularExp $ */2 /* $Id: fac_ezgcd.cc,v 1.26 2006-01-30 09:06:18 pohl Exp $ */ 3 3 4 4 #include <config.h> … … 17 17 #include "ftmpl_functions.h" 18 18 19 //#define OPTIMALVAR 120 21 19 static void findeval( const CanonicalForm & F, const CanonicalForm & G, CanonicalForm & Fb, CanonicalForm & Gb, CanonicalForm & Db, REvaluation & b, int delta, int degF, int degG ); 22 20 … … 29 27 static modpk enlargeBound ( const CanonicalForm & F, const CanonicalForm & Lb, const CanonicalForm & Db, const modpk & pk ); 30 28 31 #ifdef OPTIMALVAR32 static Variable ezgcd_getOptimalVar( const CanonicalForm & FF, const CanonicalForm & GG );33 34 35 CanonicalForm ezgcd( const CanonicalForm & FF, const CanonicalForm & GG )36 {37 CanonicalForm F,G;38 REvaluation b;39 Variable Z=ezgcd_getOptimalVar(FF,GG);40 //Test: return Z;41 if(Z==Variable(1))42 return ezgcd( FF, GG, b, false );43 F=swapvar(FF,Z,Variable(1));44 G=swapvar(GG,Z,Variable(1));45 return swapvar(ezgcd( F, G, b, false ),Z,Variable(1));46 }47 #else48 29 CanonicalForm 49 30 ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG ) … … 52 33 return ezgcd( FF, GG, b, false ); 53 34 } 54 #endif55 35 56 36 static CanonicalForm … … 390 370 return modpk( p, i ); 391 371 } 392 393 #ifdef OPTIMALVAR394 static Variable ezgcd_getOptimalVar( const CanonicalForm & FF, const CanonicalForm & GG )395 {396 int ii,tt,d,s,dd,so;397 CanonicalForm F,G;398 Variable opt=Variable(1);399 tt=FF.level();400 if(GG.level()<tt)401 tt=GG.level();402 if(tt<3 /*(FF.level()<3)||(GG.level()<3)*/)403 return opt;404 REvaluation bz=REvaluation(2,tmax(FF.level(),GG.level()),IntRandom(1));405 CanonicalForm Fbz=bz(FF);406 CanonicalForm Gbz=bz(GG);407 CanonicalForm Dbz0=gcd(Fbz,Gbz);408 dd=degree(Dbz0);409 so=-1;410 for(ii=2;ii<=tt;ii++)411 {412 //bz.nextpoint();413 F=swapvar(FF,Variable(ii),Variable(1));414 G=swapvar(GG,Variable(ii),Variable(1));415 Fbz=bz(F);416 Gbz=bz(G);417 CanonicalForm Dbz=gcd(Fbz,Gbz);418 d=degree(Dbz);419 if(d==dd)420 {421 s=size(Dbz);422 if (so==-1)423 {424 so=size(Dbz0);425 }426 if(s>so)427 {428 so=s;429 opt=Variable(ii);430 Dbz0=Dbz;431 }432 }433 else if(d>dd)434 {435 dd=d;436 so=-1;437 opt=Variable(ii);438 Dbz0=Dbz;439 }440 }441 return opt;442 }443 #endif
Note: See TracChangeset
for help on using the changeset viewer.