Changeset b90a36 in git
- Timestamp:
- Jul 15, 2014, 5:53:46 PM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 88355ebe9326d86d566d6c175b82b315be5b63ed
- Parents:
- 8b00cafb736eed4e74873c4326a7c6d326b488af
- git-author:
- Martin Lee <martinlee84@web.de>2014-07-15 17:53:46+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2014-07-17 12:07:11+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facMul.cc
r8b00ca rb90a36 230 230 mulFLINTQTrunc (const CanonicalForm& F, const CanonicalForm& G, int m) 231 231 { 232 if (F.inCoeffDomain() || G.inCoeffDomain()) 233 return mod (F*G, power (Variable (1), m)); 232 if (F.inCoeffDomain() && G.inCoeffDomain()) 233 return F*G; 234 if (F.inCoeffDomain()) 235 return mod (F*G, power (G.mvar(), m)); 236 if (G.inCoeffDomain()) 237 return mod (F*G, power (F.mvar(), m)); 234 238 Variable alpha; 235 239 if (hasFirstAlgVar (F, alpha) || hasFirstAlgVar (G, alpha)) … … 257 261 } 258 262 259 CanonicalForm uniReverse (const CanonicalForm& F, int d )263 CanonicalForm uniReverse (const CanonicalForm& F, int d, const Variable& x) 260 264 { 261 265 if (d == 0) 262 266 return F; 263 267 if (F.inCoeffDomain()) 264 return F*power (Variable (1),d); 265 Variable x= Variable (1); 268 return F*power (x,d); 266 269 CanonicalForm result= 0; 267 270 CFIterator i= F; … … 275 278 276 279 CanonicalForm 277 newtonInverse (const CanonicalForm& F, const int n )280 newtonInverse (const CanonicalForm& F, const int n, const Variable& x) 278 281 { 279 282 int l= ilog2(n); 280 283 281 CanonicalForm g= F [0]; 282 284 CanonicalForm g; 285 if (F.inCoeffDomain()) 286 g= F; 287 else 288 g= F [0]; 289 290 if (!F.inCoeffDomain()) 291 ASSERT (F.mvar() == x, "main variable of F and x differ"); 283 292 ASSERT (!g.isZero(), "expected a unit"); 284 293 285 294 if (!g.isOne()) 286 295 g = 1/g; 287 Variable x= Variable (1);288 296 CanonicalForm result; 289 297 int exp= 0; … … 328 336 CanonicalForm& R) 329 337 { 338 ASSERT (F.level() == G.level(), "F and G have different level"); 330 339 CanonicalForm A= F; 331 340 CanonicalForm B= G; 332 Variable x= Variable (1);333 int degA= degree (A , x);334 int degB= degree (B , x);341 Variable x= A.mvar(); 342 int degA= degree (A); 343 int degB= degree (B); 335 344 int m= degA - degB; 336 345 … … 346 355 else 347 356 { 348 R= uniReverse (A, degA); 349 350 CanonicalForm revB= uniReverse (B, degB); 351 CanonicalForm buf= revB; 352 revB= newtonInverse (revB, m + 1); 357 R= uniReverse (A, degA, x); 358 359 CanonicalForm revB= uniReverse (B, degB, x); 360 revB= newtonInverse (revB, m + 1, x); 353 361 Q= mulFLINTQTrunc (R, revB, m + 1); 354 Q= uniReverse (Q, m );362 Q= uniReverse (Q, m, x); 355 363 356 364 R= A - mulNTL (Q, B); … … 361 369 newtonDiv (const CanonicalForm& F, const CanonicalForm& G, CanonicalForm& Q) 362 370 { 371 ASSERT (F.level() == G.level(), "F and G have different level"); 363 372 CanonicalForm A= F; 364 373 CanonicalForm B= G; 365 Variable x= Variable (1);366 int degA= degree (A , x);367 int degB= degree (B , x);374 Variable x= A.mvar(); 375 int degA= degree (A); 376 int degB= degree (B); 368 377 int m= degA - degB; 369 378 … … 378 387 else 379 388 { 380 CanonicalForm R= uniReverse (A, degA); 381 382 CanonicalForm revB= uniReverse (B, degB); 383 revB= newtonInverse (revB, m + 1); 389 CanonicalForm R= uniReverse (A, degA, x); 390 CanonicalForm revB= uniReverse (B, degB, x); 391 revB= newtonInverse (revB, m + 1, x); 384 392 Q= mulFLINTQTrunc (R, revB, m + 1); 385 Q= uniReverse (Q, m );393 Q= uniReverse (Q, m, x); 386 394 } 387 395 }
Note: See TracChangeset
for help on using the changeset viewer.