Changeset 5be1b7 in git
 Timestamp:
 Mar 3, 2003, 4:25:27 PM (21 years ago)
 Branches:
 (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
 Children:
 cb40b51ec2aa14c677131f66fbdf396121f4e949
 Parents:
 6cf1919180db9e6de9ce32ce1d9103622b929d39
 Location:
 Singular
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

Singular/kbuckets.cc
r6cf1919 r5be1b7 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kbuckets.cc,v 1.2 4 20011009 16:36:06Singular Exp $ */4 /* $Id: kbuckets.cc,v 1.25 20030303 15:24:28 Singular Exp $ */ 5 5 6 6 #include "mod2.h" … … 15 15 #include "p_Procs.h" 16 16 17 #ifdef HAVE_COEF_BUCKETS 18 #define USE_COEF_BUCKETS 19 #endif 20 21 #ifdef USE_COEF_BUCKETS 22 #define MULTIPLY_BUCKET(B,I) do \ 23 { if (B>coef[I]!=NULL) \ 24 { \ 25 B>buckets[I]=p_Mult_q(B>buckets[I],B>coef[I],B>bucket_ring); \ 26 B>coef[I]=NULL; \ 27 } \ 28 } while(0) 29 #else 30 #define MULTIPLY_BUCKET(B,I) 31 #endif 17 32 static omBin kBucket_bin = omGetSpecBin(sizeof(kBucket)); 18 33 … … 48 63 BOOLEAN kbTest_i(kBucket_pt bucket, int i) 49 64 { 65 #ifdef USE_COEF_BUCKETS 66 assume(bucket>coef[0]==NULL); 67 if ((bucket>coef[i]!=NULL) && (bucket>buckets[i]==NULL)) 68 { 69 dReportError("Bucket %d coef not NULL", i); 70 } 71 if (bucket>coef[i]!=NULL) 72 _p_Test(bucket>coef[i],bucket>bucket_ring,PDEBUG); 73 #endif 50 74 pFalseReturn(p_Test(bucket>buckets[i], bucket>bucket_ring)); 51 75 if (bucket>buckets_length[i] != pLength(bucket>buckets[i])) … … 81 105 { 82 106 dReportError("Bucket %d larger than lm", i); 107 return FALSE; 108 } 109 if (!p_Test(bucket>buckets[i],bucket>bucket_ring)) 110 { 111 dReportError("Bucket %d is not =0(4)", i); 83 112 return FALSE; 84 113 } … … 131 160 { 132 161 if (bucket>buckets[i] != NULL) 162 { 133 163 p_Delete(&(bucket>buckets[i]), bucket>bucket_ring); 164 #ifdef USE_COEF_BUCKETS 165 if (bucket>coef[i]!=NULL) 166 p_Delete(&(bucket>coef[i]), bucket>bucket_ring); 167 #endif 168 } 134 169 } 135 170 omFreeBin(bucket, kBucket_bin); … … 163 198 } 164 199 #endif 200 MULTIPLY_BUCKET(bucket,i); 165 201 pNext(lm) = bucket>buckets[i]; 166 202 bucket>buckets[i] = lm; … … 214 250 int kBucketCanonicalize(kBucket_pt bucket) 215 251 { 252 kbTest(bucket); 216 253 poly p = bucket>buckets[1]; 217 254 poly lm; … … 219 256 bucket>buckets[1] = NULL; 220 257 bucket>buckets_length[1] = 0; 258 ring r=bucket>bucket_ring; 221 259 222 260 223 261 for (i=2; i<=bucket>buckets_used; i++) 224 262 { 263 #ifdef USE_COEF_BUCKETS 264 if (bucket>coef[i]!=NULL) 265 { 266 p = p_Plus_mm_Mult_qq(p, bucket>coef[i], bucket>buckets[i], 267 pl, bucket>buckets_length[i], r); 268 p_Delete(&bucket>coef[i],r); 269 p_Delete(&bucket>buckets[i],r); 270 } 271 else 225 272 p = p_Add_q(p, bucket>buckets[i], 226 pl, bucket>buckets_length[i], bucket>bucket_ring); 273 pl, bucket>buckets_length[i], r); 274 #else 275 q = p_Add_q(q, bucket>buckets[i], 276 pl, bucket>buckets_length[i], r); 277 #endif 227 278 bucket>buckets[i] = NULL; 228 279 bucket>buckets_length[i] = 0; … … 250 301 bucket>buckets_used = i; 251 302 assume(pLength(p) == (int) pl); 303 kbTest(bucket); 252 304 return i; 253 305 } … … 263 315 bucket>buckets_length[i] = 0; 264 316 bucket>buckets_used = 0; 317 #ifdef USE_COEF_BUCKETS 318 bucket>coef[i]=NULL; 319 #endif 265 320 } 266 321 else … … 333 388 for (i=0; i<= bucket>buckets_used; i++) 334 389 if (bucket>buckets[i] != NULL) 390 { 391 MULTIPLY_BUCKET(bucket,i); 335 392 bucket>buckets[i] = p_shallow_copy_delete(bucket>buckets[i], 336 393 bucket>bucket_ring, 337 394 new_tailRing, 338 395 new_tailBin); 396 } 339 397 #else 340 398 bucket>p = p_shallow_copy_delete(p, … … 355 413 { 356 414 #ifndef HAVE_PSEUDO_BUCKETS 415 kbTest(bucket); 416 ring r=bucket>bucket_ring; 357 417 int i; 358 418 359 419 for (i=0; i<= bucket>buckets_used; i++) 420 { 360 421 if (bucket>buckets[i] != NULL) 361 bucket>buckets[i] = p_Mult_nn(bucket>buckets[i], n, bucket>bucket_ring); 422 { 423 #ifdef USE_COEF_BUCKETS 424 if (i<2) 425 bucket>buckets[i] = p_Mult_nn(bucket>buckets[i], n, r); 426 else 427 if (bucket>coef[i]!=NULL) 428 { 429 bucket>coef[i] = p_Mult_nn(bucket>coef[i],n,r); 430 } 431 else 432 { 433 bucket>coef[i] = p_NSet(n_Copy(n,bucket>bucket_ring),r); 434 } 435 #else 436 bucket>buckets[i] = p_Mult_nn(bucket>buckets[i], n, r); 437 #endif 438 } 439 } 440 kbTest(bucket); 362 441 #else 363 442 bucket>p = p_Mult_nn(bucket>p, n, bucket>bucket_ring); … … 392 471 while (bucket>buckets[i] != NULL) 393 472 { 473 //MULTIPLY_BUCKET(bucket,i); 474 #ifdef USE_COEF_BUCKETS 475 if (bucket>coef[i]!=NULL) 476 { 477 q = p_Plus_mm_Mult_qq(q, bucket>coef[i], bucket>buckets[i], 478 l1, bucket>buckets_length[i], r); 479 p_Delete(&bucket>coef[i],r); 480 p_Delete(&bucket>buckets[i],r); 481 } 482 else 394 483 q = p_Add_q(q, bucket>buckets[i], 395 484 l1, bucket>buckets_length[i], r); 485 #else 486 q = p_Add_q(q, bucket>buckets[i], 487 l1, bucket>buckets_length[i], r); 488 #endif 396 489 bucket>buckets[i] = NULL; 397 490 bucket>buckets_length[i] = 0; … … 439 532 i = pLogLength(l1); 440 533 441 if (i <= bucket>buckets_used && bucket>buckets[i] != NULL) 442 { 534 if ((i <= bucket>buckets_used) && (bucket>buckets[i] != NULL)) 535 { 536 assume(pLength(bucket>buckets[i])==bucket>buckets_length[i]); 537 //#ifdef USE_COEF_BUCKETS 538 // if(bucket>coef[i]!=NULL) 539 // { 540 // poly mult=p_Mult_mm(bucket>coef[i],m,r); 541 // bucket>coef[i]=NULL; 542 // p1 = p_Minus_mm_Mult_qq(bucket>buckets[i], mult, p1, 543 // bucket>buckets_length[i], l1, 544 // spNoether, r); 545 // } 546 // else 547 //#endif 548 MULTIPLY_BUCKET(bucket,i); 443 549 p1 = p_Minus_mm_Mult_qq(bucket>buckets[i], m, p1, 444 550 bucket>buckets_length[i], l1, … … 465 571 while (bucket>buckets[i] != NULL) 466 572 { 573 //kbTest(bucket); 574 MULTIPLY_BUCKET(bucket,i); 467 575 p1 = p_Add_q(p1, bucket>buckets[i], 468 576 l1, bucket>buckets_length[i], r); … … 483 591 spNoether, r); 484 592 #endif 485 kbTest(bucket);486 593 } 487 594 488 595 ////////////////////////////////////////////////////////////////////////// 489 596 /// 490 /// Bpoly == Bpoly m*p; where m is a monom597 /// Bpoly == Bpoly + m*p; where m is a monom 491 598 /// Does not destroy p and m 492 599 /// assume (l <= 0  pLength(p) == l) … … 515 622 if (i <= bucket>buckets_used && bucket>buckets[i] != NULL) 516 623 { 624 MULTIPLY_BUCKET(bucket,i); 517 625 p1 = p_Plus_mm_Mult_qq(bucket>buckets[i], m, p1, 518 626 bucket>buckets_length[i], l1, r); … … 529 637 while (bucket>buckets[i] != NULL) 530 638 { 639 MULTIPLY_BUCKET(bucket,i); 531 640 p1 = p_Add_q(p1, bucket>buckets[i], 532 641 l1, bucket>buckets_length[i], r); … … 550 659 if (q == NULL) return append; 551 660 poly lm; 552 do661 loop 553 662 { 554 663 lm = kBucketGetLm(bucket); … … 565 674 } 566 675 } 567 while (1);568 676 } 569 677 … … 573 681 // Return as a polynomial *p with length *l 574 682 // In other words, afterwards 575 // Bpoly = =Bpoly  (poly consisting of all monomials with component comp)683 // Bpoly = Bpoly  (poly consisting of all monomials with component comp) 576 684 // and components of monomials of *p are all 0 577 685 // … … 596 704 if (bucket>buckets[i] != NULL) 597 705 { 706 MULTIPLY_BUCKET(bucket,i); 598 707 pTakeOutComp(&(bucket>buckets[i]), comp, &q, &lq); 599 708 if (q != NULL) … … 630 739 if (bucket>buckets[i] != NULL) 631 740 { 741 MULTIPLY_BUCKET(bucket,i); 632 742 pDecrOrdTakeOutComp(&(bucket>buckets[i]), comp, order, &q, &lq); 633 743 if (q != NULL) 
Singular/p_kBucketSetLm__T.cc
r6cf1919 r5be1b7 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_kBucketSetLm__T.cc,v 1. 2 20010827 14:47:31Singular Exp $9 * Version: $Id: p_kBucketSetLm__T.cc,v 1.3 20030303 15:25:27 Singular Exp $ 10 10 *******************************************************************/ 11 #undef USE_COEF_BUCKETS 12 #ifdef HAVE_COEF_BUCKETS 13 #define USE_COEF_BUCKETS 14 #endif 11 15 16 #ifdef USE_COEF_BUCKETS 17 #define MULTIPLY_BUCKET(B,I) do \ 18 { if (B>coef[I]!=NULL) \ 19 { \ 20 B>buckets[I]=p_Mult_q(B>buckets[I],B>coef[I],B>bucket_ring); \ 21 B>coef[I]=NULL; \ 22 } \ 23 } while(0) 24 #else 25 #define MULTIPLY_BUCKET(B,I) 26 #endif 12 27 LINKAGE void p_kBucketSetLm(kBucket_pt bucket) 13 28 { … … 28 43 if (bucket>buckets[i] != NULL) 29 44 { 45 MULTIPLY_BUCKET(bucket,i); 30 46 p = bucket>buckets[j]; 31 47 if (j == 0) … … 53 69 Equal: 54 70 { 71 MULTIPLY_BUCKET(bucket,i); 55 72 number tn = pGetCoeff(p); 56 73 pSetCoeff0(p, n_Add(pGetCoeff(bucket>buckets[i]), tn, r));
Note: See TracChangeset
for help on using the changeset viewer.