Changeset 42281d6 in git
- Timestamp:
- Jul 6, 2011, 7:04:52 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 13f4949d39b811d9e4ba8e8cbff2c4565ce87187
- Parents:
- ec970ef2b3d7d5253124f91a7c731ac3c7c540c3
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_algorithm.cc
rec970e r42281d6 30 30 #include "cf_iter.h" 31 31 #include "templates/ftmpl_functions.h" 32 #include "algext.h" 32 33 33 34 void out_cf(const char *s1,const CanonicalForm &f,const char *s2); … … 385 386 //}}} 386 387 388 /// same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f 389 bool 390 tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail ) 391 { 392 fail= false; 393 // trivial cases 394 if ( g.isZero() ) 395 return true; 396 else if ( f.isZero() ) 397 return false; 398 399 if (f.inCoeffDomain() || g.inCoeffDomain()) 400 { 401 // if we are in a field all elements not equal to zero are units 402 if ( f.inCoeffDomain() ) 403 { 404 CanonicalForm inv; 405 tryInvert (f, M, inv, fail); 406 return !fail; 407 } 408 else 409 { 410 return false; 411 } 412 } 413 414 // we may assume now that both levels either equal LEVELBASE 415 // or are greater zero 416 int fLevel = f.level(); 417 int gLevel = g.level(); 418 if ( (gLevel > 0) && (fLevel == gLevel) ) 419 { 420 if (degree( f ) > degree( g )) 421 return false; 422 bool dividestail= tryFdivides (f.tailcoeff(), g.tailcoeff(), M, fail); 423 424 if (fail || !dividestail) 425 return false; 426 bool dividesLC= tryFdivides (f.LC(),g.LC(), M, fail); 427 if (fail || !dividesLC) 428 return false; 429 CanonicalForm q,r; 430 bool divides= tryDivremt (g, f, q, r, M, fail); 431 if (fail || !divides) 432 return false; 433 return r.isZero(); 434 } 435 else if ( gLevel < fLevel ) 436 { 437 // g is a coefficient w.r.t. f 438 return false; 439 } 440 else 441 { 442 // either f is a coefficient w.r.t. polynomial g or both 443 // f and g are from a base domain (should be Z or Z/p^n, 444 // then) 445 CanonicalForm q, r; 446 bool divides= tryDivremt (g, f, q, r, M, fail); 447 if (fail || !divides) 448 return false; 449 return r.isZero(); 450 } 451 } 452 387 453 //{{{ CanonicalForm maxNorm ( const CanonicalForm & f ) 388 454 //{{{ docu -
factory/cf_algorithm.h
rec970e r42281d6 41 41 42 42 bool fdivides ( const CanonicalForm & f, const CanonicalForm & g ); 43 44 bool tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail ); 43 45 44 46 CanonicalForm maxNorm ( const CanonicalForm & f );
Note: See TracChangeset
for help on using the changeset viewer.