Changeset f9b796e in git
- Timestamp:
- Jan 24, 2012, 5:47:03 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 6fd83c451371ff612e9c1323bb1f472466b5933c
- Parents:
- 3af6b6d1da095923676c7d275f300a6c82b2f46d
- git-author:
- Martin Lee <martinlee84@web.de>2012-01-24 17:47:03+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-10 14:16:43+01:00
- Location:
- factory
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facBivar.h
r3af6b6 rf9b796e 41 41 #ifdef HAVE_NTL 42 42 inline 43 CFList ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 44 const Variable& v 45 ) 43 CFList 44 ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 45 const Variable& v ///< [in] algebraic variable 46 ) 46 47 { 47 48 CFMap N; … … 94 95 /// multiplicity, the first element is the leading coefficient. 95 96 inline 96 CFFList ratBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 97 const Variable& v 98 ) 97 CFFList 98 ratBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 99 const Variable& v, ///< [in] algebraic variable 100 bool substCheck= true ///< [in] enables substitute check 101 ) 99 102 { 100 103 CFMap N; 101 104 CanonicalForm F= compress (G, N); 105 106 if (substCheck) 107 { 108 bool foundOne= false; 109 int * substDegree= new int [F.level()]; 110 for (int i= 1; i <= F.level(); i++) 111 { 112 substDegree[i-1]= substituteCheck (F, Variable (i)); 113 if (substDegree [i-1] > 1) 114 { 115 foundOne= true; 116 subst (F, F, substDegree[i-1], Variable (i)); 117 } 118 } 119 if (foundOne) 120 { 121 CFFList result= ratBiFactorize (F, v, false); 122 CFFList newResult, tmp; 123 CanonicalForm tmp2; 124 newResult.insert (result.getFirst()); 125 result.removeFirst(); 126 for (CFFListIterator i= result; i.hasItem(); i++) 127 { 128 tmp2= i.getItem().factor(); 129 for (int j= 1; j <= F.level(); j++) 130 { 131 if (substDegree[j-1] > 1) 132 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 133 } 134 tmp= ratBiFactorize (tmp2, v, false); 135 tmp.removeFirst(); 136 for (CFFListIterator j= tmp; j.hasItem(); j++) 137 newResult.append (CFFactor (j.getItem().factor(), 138 j.getItem().exp()*i.getItem().exp())); 139 } 140 decompress (newResult, N); 141 delete [] substDegree; 142 return newResult; 143 } 144 delete [] substDegree; 145 } 146 102 147 CanonicalForm LcF= Lc (F); 103 148 CanonicalForm contentX= content (F, 1); -
factory/facFactorize.h
r3af6b6 rf9b796e 35 35 #ifdef HAVE_NTL 36 36 inline 37 CFList ratSqrfFactorize (const CanonicalForm & G, ///< [in] a multivariate poly 38 const Variable& v 39 ) 37 CFList 38 ratSqrfFactorize (const CanonicalForm & G, ///<[in] a multivariate poly 39 const Variable& v ///<[in] algebraic variable 40 ) 40 41 { 41 42 if (getNumVars (G) == 2) … … 58 59 /// multiplicity, the first element is the leading coefficient. 59 60 inline 60 CFFList ratFactorize (const CanonicalForm& G, ///< [in] a multivariate poly 61 const Variable& v 62 ) 61 CFFList 62 ratFactorize (const CanonicalForm& G, ///<[in] a multivariate poly 63 const Variable& v, ///<[in] algebraic variable 64 bool substCheck= true ///<[in] enables substitute check 65 ) 63 66 { 64 67 if (getNumVars (G) == 2) … … 68 71 } 69 72 CanonicalForm F= G; 73 74 if (substCheck) 75 { 76 bool foundOne= false; 77 int * substDegree= new int [F.level()]; 78 for (int i= 1; i <= F.level(); i++) 79 { 80 if (degree (F, i) > 0) 81 { 82 substDegree[i-1]= substituteCheck (F, Variable (i)); 83 if (substDegree [i-1] > 1) 84 { 85 foundOne= true; 86 subst (F, F, substDegree[i-1], Variable (i)); 87 } 88 } 89 else 90 substDegree[i-1]= -1; 91 } 92 if (foundOne) 93 { 94 CFFList result= ratFactorize (F, v, false); 95 CFFList newResult, tmp; 96 CanonicalForm tmp2; 97 newResult.insert (result.getFirst()); 98 result.removeFirst(); 99 for (CFFListIterator i= result; i.hasItem(); i++) 100 { 101 tmp2= i.getItem().factor(); 102 for (int j= 1; j <= G.level(); j++) 103 { 104 if (substDegree[j-1] > 1) 105 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 106 } 107 tmp= ratFactorize (tmp2, v, false); 108 tmp.removeFirst(); 109 for (CFFListIterator j= tmp; j.hasItem(); j++) 110 newResult.append (CFFactor (j.getItem().factor(), 111 j.getItem().exp()*i.getItem().exp())); 112 } 113 delete [] substDegree; 114 return newResult; 115 } 116 delete [] substDegree; 117 } 118 70 119 CanonicalForm LcF= Lc (F); 71 120 if (isOn (SW_RATIONAL)) -
factory/facFqBivar.h
r3af6b6 rf9b796e 200 200 /// @sa FqBiFactorize(), GFBiFactorize() 201 201 inline 202 CFFList FpBiFactorize (const CanonicalForm & G ///< [in] a bivariate poly 203 ) 202 CFFList 203 FpBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 204 bool substCheck= true ///< [in] enables substitute check 205 ) 204 206 { 205 207 ExtensionInfo info= ExtensionInfo (false); 206 208 CFMap N; 207 209 CanonicalForm F= compress (G, N); 210 211 if (substCheck) 212 { 213 bool foundOne= false; 214 int * substDegree= new int [F.level()]; 215 for (int i= 1; i <= F.level(); i++) 216 { 217 substDegree[i-1]= substituteCheck (F, Variable (i)); 218 if (substDegree [i-1] > 1) 219 { 220 foundOne= true; 221 subst (F, F, substDegree[i-1], Variable (i)); 222 } 223 } 224 if (foundOne) 225 { 226 CFFList result= FpBiFactorize (F, false); 227 CFFList newResult, tmp; 228 CanonicalForm tmp2; 229 newResult.insert (result.getFirst()); 230 result.removeFirst(); 231 for (CFFListIterator i= result; i.hasItem(); i++) 232 { 233 tmp2= i.getItem().factor(); 234 for (int j= 1; j <= F.level(); j++) 235 { 236 if (substDegree[j-1] > 1) 237 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 238 } 239 tmp= FpBiFactorize (tmp2, false); 240 tmp.removeFirst(); 241 for (CFFListIterator j= tmp; j.hasItem(); j++) 242 newResult.append (CFFactor (j.getItem().factor(), 243 j.getItem().exp()*i.getItem().exp())); 244 } 245 decompress (newResult, N); 246 delete [] substDegree; 247 return newResult; 248 } 249 delete [] substDegree; 250 } 251 208 252 CanonicalForm LcF= Lc (F); 209 253 CanonicalForm contentX= content (F, 1); … … 238 282 { 239 283 pthRoot= maxpthRoot (pthRoot, p, l); 240 result= FpBiFactorize (pthRoot );284 result= FpBiFactorize (pthRoot, false); 241 285 result.removeFirst(); 242 286 for (CFFListIterator i= result; i.hasItem(); i++) … … 260 304 if (degree (A) > 0) 261 305 { 262 resultRoot= FpBiFactorize (A );306 resultRoot= FpBiFactorize (A, false); 263 307 resultRoot.removeFirst(); 264 308 for (CFFListIterator i= resultRoot; i.hasItem(); i++) … … 280 324 /// @sa FpBiFactorize(), FqBiFactorize() 281 325 inline 282 CFFList FqBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 283 const Variable & alpha ///< [in] algebraic variable 284 ) 326 CFFList 327 FqBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 328 const Variable & alpha, ///< [in] algebraic variable 329 bool substCheck= true ///< [in] enables substitute check 330 ) 285 331 { 286 332 ExtensionInfo info= ExtensionInfo (alpha, false); 287 333 CFMap N; 288 334 CanonicalForm F= compress (G, N); 335 336 if (substCheck) 337 { 338 bool foundOne= false; 339 int * substDegree= new int [F.level()]; 340 for (int i= 1; i <= F.level(); i++) 341 { 342 substDegree[i-1]= substituteCheck (F, Variable (i)); 343 if (substDegree [i-1] > 1) 344 { 345 foundOne= true; 346 subst (F, F, substDegree[i-1], Variable (i)); 347 } 348 } 349 if (foundOne) 350 { 351 CFFList result= FqBiFactorize (F, alpha, false); 352 CFFList newResult, tmp; 353 CanonicalForm tmp2; 354 newResult.insert (result.getFirst()); 355 result.removeFirst(); 356 for (CFFListIterator i= result; i.hasItem(); i++) 357 { 358 tmp2= i.getItem().factor(); 359 for (int j= 1; j <= F.level(); j++) 360 { 361 if (substDegree[j-1] > 1) 362 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 363 } 364 tmp= FqBiFactorize (tmp2, alpha, false); 365 tmp.removeFirst(); 366 for (CFFListIterator j= tmp; j.hasItem(); j++) 367 newResult.append (CFFactor (j.getItem().factor(), 368 j.getItem().exp()*i.getItem().exp())); 369 } 370 decompress (newResult, N); 371 delete [] substDegree; 372 return newResult; 373 } 374 delete [] substDegree; 375 } 376 289 377 CanonicalForm LcF= Lc (F); 290 378 CanonicalForm contentX= content (F, 1); … … 321 409 { 322 410 pthRoot= maxpthRoot (pthRoot, q, l); 323 result= FqBiFactorize (pthRoot, alpha );411 result= FqBiFactorize (pthRoot, alpha, false); 324 412 result.removeFirst(); 325 413 for (CFFListIterator i= result; i.hasItem(); i++) … … 343 431 if (degree (A) > 0) 344 432 { 345 resultRoot= FqBiFactorize (A, alpha );433 resultRoot= FqBiFactorize (A, alpha, false); 346 434 resultRoot.removeFirst(); 347 435 for (CFFListIterator i= resultRoot; i.hasItem(); i++) … … 363 451 /// @sa FpBiFactorize(), FqBiFactorize() 364 452 inline 365 CFFList GFBiFactorize (const CanonicalForm & G ///< [in] a bivariate poly 366 ) 453 CFFList 454 GFBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly 455 bool substCheck= true ///< [in] enables substitute check 456 ) 367 457 { 368 458 ASSERT (CFFactory::gettype() == GaloisFieldDomain, … … 371 461 CFMap N; 372 462 CanonicalForm F= compress (G, N); 463 464 if (substCheck) 465 { 466 bool foundOne= false; 467 int * substDegree= new int [F.level()]; 468 for (int i= 1; i <= F.level(); i++) 469 { 470 substDegree[i-1]= substituteCheck (F, Variable (i)); 471 if (substDegree [i-1] > 1) 472 { 473 foundOne= true; 474 subst (F, F, substDegree[i-1], Variable (i)); 475 } 476 } 477 if (foundOne) 478 { 479 CFFList result= GFBiFactorize (F, false); 480 CFFList newResult, tmp; 481 CanonicalForm tmp2; 482 newResult.insert (result.getFirst()); 483 result.removeFirst(); 484 for (CFFListIterator i= result; i.hasItem(); i++) 485 { 486 tmp2= i.getItem().factor(); 487 for (int j= 1; j <= F.level(); j++) 488 { 489 if (substDegree[j-1] > 1) 490 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 491 } 492 tmp= GFBiFactorize (tmp2, false); 493 tmp.removeFirst(); 494 for (CFFListIterator j= tmp; j.hasItem(); j++) 495 newResult.append (CFFactor (j.getItem().factor(), 496 j.getItem().exp()*i.getItem().exp())); 497 } 498 decompress (newResult, N); 499 delete [] substDegree; 500 return newResult; 501 } 502 delete [] substDegree; 503 } 504 373 505 CanonicalForm LcF= Lc (F); 374 506 CanonicalForm contentX= content (F, 1); … … 404 536 { 405 537 pthRoot= maxpthRoot (pthRoot, q, l); 406 result= GFBiFactorize (pthRoot );538 result= GFBiFactorize (pthRoot, false); 407 539 result.removeFirst(); 408 540 for (CFFListIterator i= result; i.hasItem(); i++) … … 426 558 if (degree (A) > 0) 427 559 { 428 resultRoot= GFBiFactorize (A );560 resultRoot= GFBiFactorize (A, false); 429 561 resultRoot.removeFirst(); 430 562 for (CFFListIterator i= resultRoot; i.hasItem(); i++) -
factory/facFqFactorize.h
r3af6b6 rf9b796e 96 96 /// @sa FqFactorize(), GFFactorize() 97 97 inline 98 CFFList FpFactorize (const CanonicalForm& F ///< [in] a multivariate poly 98 CFFList FpFactorize (const CanonicalForm& G,///< [in] a multivariate poly 99 bool substCheck= true ///< [in] enables substitute check 99 100 ) 100 101 { 101 if (getNumVars (F) == 2) 102 return FpBiFactorize (F); 102 if (getNumVars (G) == 2) 103 return FpBiFactorize (G, substCheck); 104 105 CanonicalForm F= G; 106 if (substCheck) 107 { 108 bool foundOne= false; 109 int * substDegree= new int [F.level()]; 110 for (int i= 1; i <= F.level(); i++) 111 { 112 if (degree (F, i) > 0) 113 { 114 substDegree[i-1]= substituteCheck (F, Variable (i)); 115 if (substDegree [i-1] > 1) 116 { 117 foundOne= true; 118 subst (F, F, substDegree[i-1], Variable (i)); 119 } 120 } 121 else 122 substDegree[i-1]= -1; 123 } 124 if (foundOne) 125 { 126 CFFList result= FpFactorize (F, false); 127 CFFList newResult, tmp; 128 CanonicalForm tmp2; 129 newResult.insert (result.getFirst()); 130 result.removeFirst(); 131 for (CFFListIterator i= result; i.hasItem(); i++) 132 { 133 tmp2= i.getItem().factor(); 134 for (int j= 1; j <= G.level(); j++) 135 { 136 if (substDegree[j-1] > 1) 137 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 138 } 139 tmp= FpFactorize (tmp2, false); 140 tmp.removeFirst(); 141 for (CFFListIterator j= tmp; j.hasItem(); j++) 142 newResult.append (CFFactor (j.getItem().factor(), 143 j.getItem().exp()*i.getItem().exp())); 144 } 145 delete [] substDegree; 146 return newResult; 147 } 148 delete [] substDegree; 149 } 150 103 151 ExtensionInfo info= ExtensionInfo (false); 104 152 Variable a= Variable (1); … … 113 161 { 114 162 pthRoot= maxpthRoot (pthRoot, p, l); 115 result= FpFactorize (pthRoot );163 result= FpFactorize (pthRoot, false); 116 164 result.removeFirst(); 117 165 for (CFFListIterator i= result; i.hasItem(); i++) … … 128 176 if (degree (A) > 0) 129 177 { 130 resultRoot= FpFactorize (A );178 resultRoot= FpFactorize (A, false); 131 179 resultRoot.removeFirst(); 132 180 result= Union (result, resultRoot); … … 142 190 /// @sa FpFactorize(), GFFactorize() 143 191 inline 144 CFFList FqFactorize (const CanonicalForm& F, ///< [in] a multivariate poly 145 const Variable& alpha ///< [in] algebraic variable 192 CFFList FqFactorize (const CanonicalForm& G, ///< [in] a multivariate poly 193 const Variable& alpha, ///< [in] algebraic variable 194 bool substCheck= true ///< [in] enables substitute check 146 195 ) 147 196 { 148 if (getNumVars (F) == 2) 149 return FqBiFactorize (F, alpha); 197 if (getNumVars (G) == 2) 198 return FqBiFactorize (G, alpha, substCheck); 199 200 CanonicalForm F= G; 201 if (substCheck) 202 { 203 bool foundOne= false; 204 int * substDegree= new int [F.level()]; 205 for (int i= 1; i <= F.level(); i++) 206 { 207 if (degree (F, i) > 0) 208 { 209 substDegree[i-1]= substituteCheck (F, Variable (i)); 210 if (substDegree [i-1] > 1) 211 { 212 foundOne= true; 213 subst (F, F, substDegree[i-1], Variable (i)); 214 } 215 } 216 else 217 substDegree[i-1]= -1; 218 } 219 if (foundOne) 220 { 221 CFFList result= FqFactorize (F, alpha, false); 222 CFFList newResult, tmp; 223 CanonicalForm tmp2; 224 newResult.insert (result.getFirst()); 225 result.removeFirst(); 226 for (CFFListIterator i= result; i.hasItem(); i++) 227 { 228 tmp2= i.getItem().factor(); 229 for (int j= 1; j <= G.level(); j++) 230 { 231 if (substDegree[j-1] > 1) 232 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 233 } 234 tmp= FqFactorize (tmp2, alpha, false); 235 tmp.removeFirst(); 236 for (CFFListIterator j= tmp; j.hasItem(); j++) 237 newResult.append (CFFactor (j.getItem().factor(), 238 j.getItem().exp()*i.getItem().exp())); 239 } 240 delete [] substDegree; 241 return newResult; 242 } 243 delete [] substDegree; 244 } 245 150 246 ExtensionInfo info= ExtensionInfo (alpha, false); 151 247 CanonicalForm LcF= Lc (F); … … 160 256 { 161 257 pthRoot= maxpthRoot (pthRoot, q, l); 162 result= FqFactorize (pthRoot, alpha );258 result= FqFactorize (pthRoot, alpha, false); 163 259 result.removeFirst(); 164 260 for (CFFListIterator i= result; i.hasItem(); i++) … … 175 271 if (degree (A) > 0) 176 272 { 177 resultRoot= FqFactorize (A, alpha );273 resultRoot= FqFactorize (A, alpha, false); 178 274 resultRoot.removeFirst(); 179 275 result= Union (result, resultRoot); … … 189 285 /// @sa FpFactorize(), FqFactorize() 190 286 inline 191 CFFList GFFactorize (const CanonicalForm& F ///< [in] a multivariate poly 287 CFFList GFFactorize (const CanonicalForm& G, ///< [in] a multivariate poly 288 bool substCheck= true ///< [in] enables substitute check 192 289 ) 193 290 { 194 291 ASSERT (CFFactory::gettype() == GaloisFieldDomain, 195 292 "GF as base field expected"); 196 if (getNumVars (F) == 2) 197 return GFBiFactorize (F); 293 if (getNumVars (G) == 2) 294 return GFBiFactorize (G, substCheck); 295 296 CanonicalForm F= G; 297 if (substCheck) 298 { 299 bool foundOne= false; 300 int * substDegree= new int [F.level()]; 301 for (int i= 1; i <= F.level(); i++) 302 { 303 if (degree (F, i) > 0) 304 { 305 substDegree[i-1]= substituteCheck (F, Variable (i)); 306 if (substDegree [i-1] > 1) 307 { 308 foundOne= true; 309 subst (F, F, substDegree[i-1], Variable (i)); 310 } 311 } 312 else 313 substDegree[i-1]= -1; 314 } 315 if (foundOne) 316 { 317 CFFList result= GFFactorize (F, false); 318 CFFList newResult, tmp; 319 CanonicalForm tmp2; 320 newResult.insert (result.getFirst()); 321 result.removeFirst(); 322 for (CFFListIterator i= result; i.hasItem(); i++) 323 { 324 tmp2= i.getItem().factor(); 325 for (int j= 1; j <= G.level(); j++) 326 { 327 if (substDegree[j-1] > 1) 328 tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j)); 329 } 330 tmp= GFFactorize (tmp2, false); 331 tmp.removeFirst(); 332 for (CFFListIterator j= tmp; j.hasItem(); j++) 333 newResult.append (CFFactor (j.getItem().factor(), 334 j.getItem().exp()*i.getItem().exp())); 335 } 336 delete [] substDegree; 337 return newResult; 338 } 339 delete [] substDegree; 340 } 341 198 342 Variable a= Variable (1); 199 343 ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false); … … 209 353 { 210 354 pthRoot= maxpthRoot (pthRoot, q, l); 211 result= GFFactorize (pthRoot );355 result= GFFactorize (pthRoot, false); 212 356 result.removeFirst(); 213 357 for (CFFListIterator i= result; i.hasItem(); i++) … … 224 368 if (degree (A) > 0) 225 369 { 226 resultRoot= GFFactorize (A );370 resultRoot= GFFactorize (A, false); 227 371 resultRoot.removeFirst(); 228 372 result= Union (result, resultRoot);
Note: See TracChangeset
for help on using the changeset viewer.