Changeset 44cd9a in git
- Timestamp:
- Aug 21, 2013, 1:30:17 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- 849b7c0914e5ad7a169d24144d3e469708518d0b
- Parents:
- ffae30a2130f2ca69e796b942659b22f5597fc03
- git-author:
- Martin Lee <martinlee84@web.de>2013-08-21 13:30:17+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2013-08-30 13:48:37+02:00
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facAbsBiFact.cc
rffae30 r44cd9a 36 36 TIMING_DEFINE_PRINT(fac_evalpoint) 37 37 38 CFAFList uniAbsFactorize (const CanonicalForm& F )38 CFAFList uniAbsFactorize (const CanonicalForm& F, bool full) 39 39 { 40 CFFList rationalFactors= factorize (F); 41 CFFListIterator i= rationalFactors; 42 CanonicalForm LcF= rationalFactors.getFirst().factor(); 43 i++; 40 CFAFList result; 41 if (degree (F) == 1) 42 { 43 bool isRat= isOn (SW_RATIONAL); 44 On (SW_RATIONAL); 45 result= CFAFList (CFAFactor (F/Lc(F), 1, 1)); 46 result.insert (CFAFactor (Lc (F), 1, 1)); 47 if (!isRat) 48 Off (SW_RATIONAL); 49 return result; 50 } 51 CanonicalForm LcF= 1; 44 52 Variable alpha; 45 CFAFList result;46 53 CFFList QaFactors; 47 54 CFFListIterator iter; 48 for (; i.hasItem(); i++) 49 { 50 if (degree (i.getItem().factor()) == 1) 51 { 52 result.append (CFAFactor (i.getItem().factor(), 1, i.getItem().exp())); 53 continue; 54 } 55 alpha= rootOf (i.getItem().factor()); 56 QaFactors= factorize (i.getItem().factor(), alpha); 57 iter= QaFactors; 58 if (iter.getItem().factor().inCoeffDomain()) 59 { 60 LcF *= iter.getItem().factor(); 61 iter++; 62 } 63 for (;iter.hasItem(); iter++) 64 { 65 if (degree (iter.getItem().factor()) == 1) 66 { 67 result.append (CFAFactor (iter.getItem().factor(), getMipo (alpha), 68 i.getItem().exp())); 69 break; 70 } 55 alpha= rootOf (F); 56 QaFactors= factorize (F, alpha); 57 iter= QaFactors; 58 if (iter.getItem().factor().inCoeffDomain()) 59 { 60 LcF = iter.getItem().factor(); 61 iter++; 62 } 63 for (;iter.hasItem(); iter++) 64 { 65 if (full) 66 result.append (CFAFactor (iter.getItem().factor(), getMipo (alpha), 67 iter.getItem().exp())); 68 if (!full && degree (iter.getItem().factor()) == 1) 69 { 70 result.append (CFAFactor (iter.getItem().factor(), getMipo (alpha), 71 iter.getItem().exp())); 72 break; 71 73 } 72 74 } … … 271 273 F /= icontent (F); 272 274 On (SW_RATIONAL); 275 276 mpz_t * M=new mpz_t [4]; 277 mpz_init (M[0]); 278 mpz_init (M[1]); 279 mpz_init (M[2]); 280 mpz_init (M[3]); 281 282 mpz_t * S=new mpz_t [2]; 283 mpz_init (S[0]); 284 mpz_init (S[1]); 285 286 F= compress (F, M, S); 287 288 if (F.isUnivariate()) 289 { 290 if (degree (F) == 1) 291 { 292 mpz_clear (M[0]); 293 mpz_clear (M[1]); 294 mpz_clear (M[2]); 295 mpz_clear (M[3]); 296 delete [] M; 297 298 mpz_clear (S[0]); 299 mpz_clear (S[1]); 300 delete [] S; 301 if (!isRat) 302 Off (SW_RATIONAL); 303 return CFAFList (CFAFactor (G, 1, 1)); 304 } 305 CFAFList result= uniAbsFactorize (F, full); 306 if (result.getFirst().factor().inCoeffDomain()) 307 result.removeFirst(); 308 for (CFAFListIterator iter=result; iter.hasItem(); iter++) 309 iter.getItem()= CFAFactor (decompress (iter.getItem().factor(), M, S), 310 iter.getItem().minpoly(),iter.getItem().exp()); 311 mpz_clear (M[0]); 312 mpz_clear (M[1]); 313 mpz_clear (M[2]); 314 mpz_clear (M[3]); 315 delete [] M; 316 317 mpz_clear (S[0]); 318 mpz_clear (S[1]); 319 delete [] S; 320 if (!isRat) 321 Off (SW_RATIONAL); 322 return result; 323 } 324 325 if (degree (F, 1) == 1 || degree (F, 2) == 1) 326 { 327 mpz_clear (M[0]); 328 mpz_clear (M[1]); 329 mpz_clear (M[2]); 330 mpz_clear (M[3]); 331 delete [] M; 332 333 mpz_clear (S[0]); 334 mpz_clear (S[1]); 335 delete [] S; 336 if (!isRat) 337 Off (SW_RATIONAL); 338 return CFAFList (CFAFactor (G, 1, 1)); 339 } 273 340 int minTdeg, tdegF= totaldegree (F); 274 341 CanonicalForm Fp, smallestFactor; … … 305 372 On (SW_RATIONAL); 306 373 setCharacteristic(0); 374 mpz_clear (M[0]); 375 mpz_clear (M[1]); 376 mpz_clear (M[2]); 377 mpz_clear (M[3]); 378 delete [] M; 379 380 mpz_clear (S[0]); 381 mpz_clear (S[1]); 382 delete [] S; 307 383 return CFAFList (CFAFactor (G, 1, 1)); 308 384 } … … 314 390 if (isRat) 315 391 On (SW_RATIONAL); 392 mpz_clear (M[0]); 393 mpz_clear (M[1]); 394 mpz_clear (M[2]); 395 mpz_clear (M[3]); 396 delete [] M; 397 398 mpz_clear (S[0]); 399 mpz_clear (S[1]); 400 delete [] S; 316 401 return CFAFList (CFAFactor (G, 1, 1)); 317 402 } … … 729 814 { 730 815 if (full) 731 result.append (CFAFactor (i.getItem(), getMipo (alpha), 1)); 816 result.append (CFAFactor (decompress (i.getItem(), M, S), 817 getMipo (alpha), 1)); 732 818 733 819 if (totaldegree (i.getItem()) == minTdeg) 734 820 { 735 821 if (!full) 736 result= CFAFList (CFAFactor (i.getItem(), getMipo (alpha), 1)); 822 result= CFAFList (CFAFactor (decompress (i.getItem(), M, S), 823 getMipo (alpha), 1)); 737 824 found= true; 738 825 … … 754 841 Off (SW_RATIONAL); 755 842 843 mpz_clear (M[0]); 844 mpz_clear (M[1]); 845 mpz_clear (M[2]); 846 mpz_clear (M[3]); 847 delete [] M; 848 849 mpz_clear (S[0]); 850 mpz_clear (S[1]); 851 delete [] S; 852 756 853 return result; 757 854 } -
factory/facAbsBiFact.h
rffae30 r44cd9a 21 21 /// primitive wrt. any of its variables and irreducible over Q 22 22 /// 23 /// @return absFactorizeMain returns a list whose entries contain three entities: 23 /// @return absBiFactorizeMain returns a list whose entries contain three 24 /// entities: 24 25 /// an absolute irreducible factor, an irreducible univariate polynomial 25 26 /// that defines the minimal field extension over which the irreducible 26 /// factor is defined and the multiplicity of the absolute irreducible27 /// factor is defined, and the multiplicity of the absolute irreducible 27 28 /// factor 28 29 CFAFList absBiFactorizeMain (const CanonicalForm& F, ///<[in] s.a. 29 bool full= false 30 bool full= false ///<[in] true if all 31 ///< factors should be 32 ///< returned 30 33 ); 31 34 #endif … … 45 48 /// an absolute irreducible factor, an irreducible univariate polynomial 46 49 /// that defines the minimal field extension over which the irreducible 47 /// factor is defined and the multiplicity of the absolute irreducible50 /// factor is defined, and the multiplicity of the absolute irreducible 48 51 /// factor 49 CFAFList uniAbsFactorize (const CanonicalForm& F ///<[in] univariate poly over Q 52 CFAFList uniAbsFactorize (const CanonicalForm& F, ///<[in] univariate poly 53 ///< irreducible over Q 54 bool full= false ///<[in] true if all factors 55 ///< should be returned 50 56 ); 51 57
Note: See TracChangeset
for help on using the changeset viewer.