Changeset 0349c20 in git
- Timestamp:
- Sep 1, 2011, 3:40:30 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 38ffb7aa68530ae0bcc0c2bb95142f15951ff00c
- Parents:
- 380a9b6e945b3b23b3197f3b6692bf955b0c0301
- Files:
-
- 5 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
r380a9b6 r0349c20 1076 1076 // factory default settings: ----------------------------------------------- 1077 1077 On(SW_USE_NTL); 1078 Off(SW_USE_GCD_P);1079 1078 On(SW_USE_NTL_GCD_0); // On -> seg11 in Old/algnorm, Old/factor... 1080 1079 On(SW_USE_NTL_GCD_P); // On -> cyle in Short/brnoeth_s: fixed -
factory/GNUmakefile.in
r380a9b6 r0349c20 139 139 cf_factory.cc \ 140 140 cf_gcd.cc \ 141 cf_gcd_charp.cc \142 141 cf_gcd_smallp.cc \ 143 142 cf_generator.cc \ 144 cfGEval.cc \145 143 cf_globals.cc \ 146 144 cf_hnf.cc \ … … 186 184 fieldGCD.cc \ 187 185 ffops.cc \ 188 ffreval.cc \189 186 gf_tabutil.cc \ 190 187 gfops.cc \ … … 235 232 cf_factory.h \ 236 233 cf_generator.h \ 237 cfGEval.h \238 234 cf_globals.h \ 239 235 cf_gcd_smallp.h \ … … 273 269 fieldGCD.h \ 274 270 ffops.h \ 275 ffreval.h \276 271 ftmpl_list.h \ 277 272 ftmpl_matrix.h \ -
factory/cf_defs.h
r380a9b6 r0349c20 41 41 const int SW_USE_NTL_SORT=12; 42 42 const int SW_USE_CHINREM_GCD=13; 43 const int SW_USE_GCD_P=14; 44 const int SW_USE_QGCD=15; 45 const int SW_USE_fieldGCD=16; 46 const int SW_USE_FF_MOD_GCD=17; 43 const int SW_USE_QGCD=14; 44 const int SW_USE_fieldGCD=15; 45 const int SW_USE_FF_MOD_GCD=16; 47 46 //}}} 48 47 -
factory/cf_gcd.cc
r380a9b6 r0349c20 16 16 #include "fac_util.h" 17 17 #include "templates/ftmpl_functions.h" 18 #include "ffreval.h"19 18 #include "algext.h" 20 19 #include "fieldGCD.h" … … 32 31 33 32 static CanonicalForm cf_content ( const CanonicalForm &, const CanonicalForm & ); 34 static bool gcd_avoid_mtaildegree ( CanonicalForm &, CanonicalForm &, CanonicalForm & );35 33 static void cf_prepgcd( const CanonicalForm &, const CanonicalForm &, int &, int &, int & ); 36 34 … … 38 36 39 37 CanonicalForm chinrem_gcd(const CanonicalForm & FF,const CanonicalForm & GG); 40 CanonicalForm newGCD(CanonicalForm A, CanonicalForm B);41 38 42 39 bool … … 534 531 if ( !( pi.isUnivariate() && pi1.isUnivariate() ) ) 535 532 { 536 //out_cf("F:",f,"\n");537 //out_cf("G:",g,"\n");538 //out_cf("newGCD:",newGCD(f,g),"\n");539 if (isOn(SW_USE_GCD_P) && (getCharacteristic()>0))540 {541 return newGCD(f,g);542 }543 533 if ( gcd_test_one( pi1, pi, true ) ) 544 534 { … … 714 704 fc= EZGCD_P (fc, gc); 715 705 } 716 #endif717 else if (isOn(SW_USE_GCD_P))718 {719 fc=newGCD(fc,gc);720 }721 #ifdef HAVE_NTL722 706 else if (isOn(SW_USE_FF_MOD_GCD) && !fc_and_gc_Univariate) 723 707 { … … 1057 1041 #endif 1058 1042 1059 static bool1060 gcd_avoid_mtaildegree ( CanonicalForm & f1, CanonicalForm & g1, CanonicalForm & d1 )1061 {1062 bool rdy = true;1063 int df = f1.taildegree();1064 int dg = g1.taildegree();1065 1066 d1 = d1.genOne();1067 if ( dg == 0 )1068 {1069 if ( df == 0 )1070 return false;1071 else1072 {1073 if ( f1.degree() == df )1074 d1 = cf_content( g1, LC( f1 ) );1075 else1076 {1077 f1 /= power( f1.mvar(), df );1078 rdy = false;1079 }1080 }1081 }1082 else1083 {1084 if ( df == 0)1085 {1086 if ( g1.degree() == dg )1087 d1 = cf_content( f1, LC( g1 ) );1088 else1089 {1090 g1 /= power( g1.mvar(), dg );1091 rdy = false;1092 }1093 }1094 else1095 {1096 if ( df > dg )1097 d1 = power( f1.mvar(), dg );1098 else1099 d1 = power( f1.mvar(), df );1100 if ( f1.degree() == df )1101 {1102 if (g1.degree() == dg)1103 d1 *= gcd( LC( f1 ), LC( g1 ) );1104 else1105 {1106 g1 /= power( g1.mvar(), dg);1107 d1 *= cf_content( g1, LC( f1 ) );1108 }1109 }1110 else1111 {1112 f1 /= power( f1.mvar(), df );1113 if ( g1.degree() == dg )1114 d1 *= cf_content( f1, LC( g1 ) );1115 else1116 {1117 g1 /= power( g1.mvar(), dg );1118 rdy = false;1119 }1120 }1121 }1122 }1123 return rdy;1124 }1125 1126 1043 /* 1127 1044 * compute positions p1 and pe of optimal variables: -
factory/cf_gcd_smallp.cc
r380a9b6 r0349c20 30 30 #include "templates/ftmpl_functions.h" 31 31 #include "cf_random.h" 32 #include " ffreval.h"32 #include "cf_reval.h" 33 33 #include "facHensel.h" 34 34 … … 3996 3996 static inline 3997 3997 int Hensel_P (const CanonicalForm & UU, CFArray & G, const Evaluation & AA, 3998 const Variable & x,const CFArray& LeadCoeffs )3998 const CFArray& LeadCoeffs ) 3999 3999 { 4000 4000 CFList factors; … … 4510 4510 } 4511 4511 4512 gcdfound= Hensel_P (B*lcD, DD, b, x,lcDD);4512 gcdfound= Hensel_P (B*lcD, DD, b, lcDD); 4513 4513 4514 4514 if (gcdfound == -1) -
factory/cf_switches.h
r380a9b6 r0349c20 19 19 // 20 20 //}}} 21 const int CFSwitchesMax = 1 8;21 const int CFSwitchesMax = 17; 22 22 //}}} 23 23 -
factory/facFqBivar.cc
r380a9b6 r0349c20 2003 2003 CFList 2004 2004 increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound, 2005 int oldNumCols, int oldL, const Variable& alpha,2005 int oldNumCols, int oldL, const Variable&, 2006 2006 int precision 2007 2007 ) -
factory/facFqSquarefree.cc
r380a9b6 r0349c20 72 72 static inline 73 73 CFFList 74 sqrfPosDer (const CanonicalForm & F, const Variable & x, const int & k, 75 const Variable & alpha, CanonicalForm & c) 76 { 77 Variable buf= alpha; 74 sqrfPosDer (const CanonicalForm & F, const Variable & x, 75 CanonicalForm & c) 76 { 78 77 CanonicalForm b= deriv (F, x); 79 78 c= gcd (F, b); … … 131 130 if (degree (deriv (A, buf)) >= 0) 132 131 { 133 if (GF) 134 tmp1= sqrfPosDer (A, buf, k, alpha, tmp); 135 else if (GF == false && alpha.level() != 1) 136 tmp1= sqrfPosDer (A, buf, k, alpha, tmp); 137 else 138 tmp1= sqrfPosDer (A, buf, 1, alpha, tmp); 132 tmp1= sqrfPosDer (A, buf, tmp); 139 133 A= tmp; 140 134 for (CFFListIterator j= tmp1; j.hasItem(); j++) -
factory/fac_ezgcd.cc
r380a9b6 r0349c20 237 237 // (means: bad evaluation point). Try again with another 238 238 // evaluation point. Bug fix (?) by JS. The bad example was 239 // gcd.debug -ocr /+USE_EZGCD/@12/CB \240 // '(16*B^8-208*B^6*C+927*B^4*C^2-1512*B^2*C^3+432*C^4)' \239 // gcd.debug -ocr /+USE_EZGCD/@12/CB 240 // '(16*B^8-208*B^6*C+927*B^4*C^2-1512*B^2*C^3+432*C^4)' 241 241 // '(4*B^7*C^2-50*B^5*C^3+208*B^3*C^4-288*B*C^5)' 242 242 b.nextpoint(); -
factory/fac_multivar.cc
r380a9b6 r0349c20 401 401 return R; 402 402 } 403 404 static CFArray FpFactorizeMulti ( const CanonicalForm & arg )405 {406 DEBINCLEVEL( cerr, "FpFactorizeMulti" );407 CFMap M;408 CanonicalForm UU, U = compress( arg, M );409 CanonicalForm delta, omega, V = LC( U, 1 );410 int t = U.level();411 CFFList F = factorize( V );412 CFFListIterator I, J;413 CFArray G, lcG, D;414 int i, j, r, maxdeg;415 REvaluation A( 2, t, FFRandom() );416 CanonicalForm U0;417 CanonicalForm ft, ut, gt, d;418 modpk b;419 bool negate = false;420 421 DEBOUTLN( cerr, "-----------------------------------------------------" );422 DEBOUTLN( cerr, "trying to factorize U = " << U );423 DEBOUTLN( cerr, "U is a polynomial of level = " << arg.level() );424 DEBOUTLN( cerr, "U will be factorized with respect to variable " << Variable(1) );425 DEBOUTLN( cerr, "the leading coefficient of U with respect to that variable is " << V );426 DEBOUTLN( cerr, "which is factorized as " << F );427 428 maxdeg = 0;429 for ( i = 2; i <= t; i++ )430 {431 j = U.degree( Variable( i ) );432 if ( j > maxdeg ) maxdeg = j;433 }434 435 if ( F.getFirst().factor().inCoeffDomain() )436 {437 omega = F.getFirst().factor();438 F.removeFirst();439 if ( omega < 0 )440 {441 negate = true;442 omega = -omega;443 U = -U;444 }445 }446 else447 omega = 1;448 449 bool goodeval = false;450 r = 0;451 452 // for ( i = 0; i < 10*t; i++ )453 // A.nextpoint();454 455 while ( ! goodeval )456 {457 TIMING_START(fac_findeval);458 findEvaluation( U, V, omega, F, A, U0, delta, D, r );459 TIMING_END(fac_findeval);460 DEBOUTLN( cerr, "the evaluation point to reduce to an univariate problem is " << A );461 DEBOUTLN( cerr, "corresponding delta = " << delta );462 DEBOUTLN( cerr, " omega = " << omega );463 DEBOUTLN( cerr, " D = " << D );464 DEBOUTLN( cerr, "now factorize the univariate polynomial " << U0 );465 G = conv_to_factor_array( factorize( U0, false ) );466 printf("conv_to_factor_array\n");467 DEBOUTLN( cerr, "which factorizes into " << G );468 469 r = G.size();470 lcG = CFArray( 1, r );471 UU = U;472 //if ( goodeval )473 {474 printf("start hensel\n");475 TIMING_START(fac_hensel);476 goodeval = Hensel( UU, G, lcG, A, b, Variable(1) );477 TIMING_END(fac_hensel);478 }479 }480 for ( i = 1; i <= r; i++ )481 {482 G[i] /= icontent( G[i] );483 G[i] = M(G[i]);484 }485 // negate noch beachten !486 if ( negate )487 G[1] = -G[1];488 DEBDECLEVEL( cerr, "ZFactorMulti" );489 return G;490 }491 CFFList FpFactorizeMultivariate ( const CanonicalForm & f, bool issqrfree )492 {493 CFFList G, F, R;494 CFArray GG;495 CFFListIterator i, j;496 CFMap M;497 CanonicalForm g, cont;498 Variable v1, vm;499 int k, m, n;500 501 v1 = Variable(1);502 if ( issqrfree )503 F = CFFactor( f, 1 );504 else505 F = sqrFree( f );506 507 for ( i = F; i.hasItem(); i++ )508 {509 if ( i.getItem().factor().inCoeffDomain() )510 {511 if ( ! i.getItem().factor().isOne() )512 R.append( CFFactor( i.getItem().factor(), i.getItem().exp() ) );513 }514 else515 {516 TIMING_START(fac_content);517 g = compress( i.getItem().factor(), M );518 // now after compress g contains Variable(1)519 vm = g.mvar();520 g = swapvar( g, v1, vm );521 cont = content( g );522 g = swapvar( g / cont, v1, vm );523 cont = swapvar( cont, v1, vm );524 n = i.getItem().exp();525 TIMING_END(fac_content);526 DEBOUTLN( cerr, "now after content ..." );527 if ( g.isUnivariate() )528 {529 G = factorize( g, true );530 for ( j = G; j.hasItem(); j++ )531 if ( ! j.getItem().factor().isOne() )532 R.append( CFFactor( M( j.getItem().factor() ), n ) );533 }534 else535 {536 GG = FpFactorizeMulti( g );537 m = GG.max();538 for ( k = GG.min(); k <= m; k++ )539 if ( ! GG[k].isOne() )540 R.append( CFFactor( M( GG[k] ), n ) );541 }542 G = factorize( cont, true );543 for ( j = G; j.hasItem(); j++ )544 if ( ! j.getItem().factor().isOne() )545 R.append( CFFactor( M( j.getItem().factor() ), n ) );546 }547 }548 return R;549 } -
factory/int_cf.cc
r380a9b6 r0349c20 175 175 176 176 InternalCF* 177 InternalCF::tryMulsame( InternalCF* F, const CanonicalForm& M)177 InternalCF::tryMulsame( InternalCF*, const CanonicalForm&) 178 178 { 179 179 ASSERT1( 0, "tryMulsame() not implemented for class %s", this->classname() ); … … 182 182 183 183 InternalCF* 184 InternalCF::tryInvert ( const CanonicalForm& M, bool& fail)184 InternalCF::tryInvert ( const CanonicalForm&, bool&) 185 185 { 186 186 ASSERT1( 0, "tryInvert() not implemented for class %s", this->classname() ); … … 189 189 190 190 bool 191 InternalCF::tryDivremsamet ( InternalCF* F, InternalCF*& S, InternalCF*& T, const CanonicalForm& M, bool& fail)191 InternalCF::tryDivremsamet ( InternalCF*, InternalCF*&, InternalCF*&, const CanonicalForm&, bool&) 192 192 { 193 193 ASSERT1( 0, "tryDivremsamet() not implemented for class %s", this->classname() ); … … 196 196 197 197 bool 198 InternalCF::tryDivremcoefft ( InternalCF* F, InternalCF*& S, InternalCF*& T, bool invert, const CanonicalForm& M, bool& fail)198 InternalCF::tryDivremcoefft ( InternalCF*, InternalCF*&, InternalCF*&, bool, const CanonicalForm&, bool&) 199 199 { 200 200 ASSERT1( 0, "tryDivremcoefft() not implemented for class %s", this->classname() ); … … 203 203 204 204 InternalCF* 205 InternalCF::tryDivsame ( InternalCF* F, const CanonicalForm& M, bool& fail)205 InternalCF::tryDivsame ( InternalCF*, const CanonicalForm&, bool&) 206 206 { 207 207 ASSERT1( 0, "tryDivsame() not implemented for class %s", this->classname() ); … … 210 210 211 211 InternalCF* 212 InternalCF::tryDivcoeff ( InternalCF* F, bool invert, const CanonicalForm& M, bool& fail)212 InternalCF::tryDivcoeff ( InternalCF*, bool, const CanonicalForm&, bool&) 213 213 { 214 214 ASSERT1( 0, "tryDivcoeff() not implemented for class %s", this->classname() ); … … 217 217 218 218 InternalCF* 219 InternalCF::tryDividecoeff ( InternalCF* F, bool invert, const CanonicalForm& M, bool& fail)219 InternalCF::tryDividecoeff ( InternalCF*, bool, const CanonicalForm&, bool&) 220 220 { 221 221 ASSERT1( 0, "tryDividecoeff() not implemented for class %s", this->classname() ); -
factory/int_int.h
r380a9b6 r0349c20 46 46 public: 47 47 #ifdef HAVE_OMALLOC 48 void* operator new(size_t size)48 void* operator new(size_t) 49 49 { 50 50 void* addr; … … 52 52 return addr; 53 53 } 54 void operator delete(void* addr, size_t size)54 void operator delete(void* addr, size_t) 55 55 { 56 56 omFreeBin(addr, InternalInteger_bin); -
factory/int_poly.h
r380a9b6 r0349c20 41 41 friend class CFIterator; 42 42 #ifdef HAVE_OMALLOC 43 void* operator new(size_t size)43 void* operator new(size_t) 44 44 { 45 45 void* addr; … … 47 47 return addr; 48 48 } 49 void operator delete(void* addr, size_t size)49 void operator delete(void* addr, size_t) 50 50 { 51 51 omFreeBin(addr, term_bin); … … 142 142 #ifdef HAVE_OMALLOC 143 143 static const omBin InternalPoly_bin; 144 void* operator new(size_t size)144 void* operator new(size_t) 145 145 { 146 146 void* addr; … … 148 148 return addr; 149 149 } 150 void operator delete(void* addr, size_t size)150 void operator delete(void* addr, size_t) 151 151 { 152 152 omFreeBin(addr, InternalPoly_bin);
Note: See TracChangeset
for help on using the changeset viewer.