Changeset fbc7cb in git for kernel/kstd2.cc
- Timestamp:
- Nov 28, 2013, 8:17:04 AM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- f1cef21d1357296b505525dc298415759bdb20c8
- Parents:
- c91ffe336985180edd91ef17bf401793443ccb4d
- git-author:
- Christian Eder <ederc@mathematik.uni-kl.de>2013-11-28 08:17:04+01:00
- git-committer:
- Christian Eder <ederc@mathematik.uni-kl.de>2013-12-12 13:51:25+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd2.cc
rc91ffe3 rfbc7cb 529 529 } 530 530 } 531 } 532 533 KINLINE int ksReducePolyTailSig(LObject* PR, TObject* PW, LObject* Red) 534 { 535 BOOLEAN ret; 536 number coef; 537 538 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing()); 539 Red->HeadNormalize(); 540 /* 541 printf("------------------------\n"); 542 pWrite(Red->GetLmCurrRing()); 543 */ 544 ret = ksReducePolySig(Red, PW, 1, NULL, &coef); 545 546 547 if (!ret) 548 { 549 if (! n_IsOne(coef, currRing->cf)) 550 { 551 PR->Mult_nn(coef); 552 // HANNES: mark for Normalize 553 } 554 n_Delete(&coef, currRing->cf); 555 } 556 return ret; 531 557 } 532 558 … … 706 732 } 707 733 } 734 } 735 736 // tail reduction for SBA 737 poly redtailSba (LObject* L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize) 738 { 739 #define REDTAIL_CANONICALIZE 100 740 strat->redTailChange=FALSE; 741 if (strat->noTailReduction) return L->GetLmCurrRing(); 742 poly h, p; 743 p = h = L->GetLmTailRing(); 744 if ((h==NULL) || (pNext(h)==NULL)) 745 return L->GetLmCurrRing(); 746 747 TObject* With; 748 // placeholder in case strat->tl < 0 749 TObject With_s(strat->tailRing); 750 751 LObject Ln(pNext(h), strat->tailRing); 752 Ln.sig = L->sig; 753 Ln.sevSig = L->sevSig; 754 Ln.pLength = L->GetpLength() - 1; 755 756 pNext(h) = NULL; 757 if (L->p != NULL) pNext(L->p) = NULL; 758 L->pLength = 1; 759 760 Ln.PrepareRed(strat->use_buckets); 761 762 int cnt=REDTAIL_CANONICALIZE; 763 while(!Ln.IsNull()) 764 { 765 loop 766 { 767 Ln.SetShortExpVector(); 768 if (withT) 769 { 770 int j; 771 j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln); 772 if (j < 0) break; 773 With = &(strat->T[j]); 774 } 775 else 776 { 777 With = kFindDivisibleByInS(strat, pos, &Ln, &With_s); 778 if (With == NULL) break; 779 } 780 cnt--; 781 if (cnt==0) 782 { 783 cnt=REDTAIL_CANONICALIZE; 784 /*poly tmp=*/Ln.CanonicalizeP(); 785 if (normalize) 786 { 787 Ln.Normalize(); 788 //pNormalize(tmp); 789 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 790 } 791 } 792 if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p)))) 793 { 794 With->pNorm(); 795 } 796 strat->redTailChange=TRUE; 797 int ret = ksReducePolyTailSig(L, With, &Ln); 798 #if SBA_PRINT_REDUCTION_STEPS 799 if (ret != 3) 800 sba_reduction_steps++; 801 #endif 802 #if SBA_PRINT_OPERATIONS 803 if (ret != 3) 804 sba_operations += pLength(With->p); 805 #endif 806 if (ret) 807 { 808 // reducing the tail would violate the exp bound 809 // set a flag and hope for a retry (in bba) 810 strat->completeReduce_retry=TRUE; 811 if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL; 812 do 813 { 814 pNext(h) = Ln.LmExtractAndIter(); 815 pIter(h); 816 L->pLength++; 817 } while (!Ln.IsNull()); 818 goto all_done; 819 } 820 if (Ln.IsNull()) goto all_done; 821 if (! withT) With_s.Init(currRing); 822 } 823 pNext(h) = Ln.LmExtractAndIter(); 824 pIter(h); 825 pNormalize(h); 826 L->pLength++; 827 } 828 829 all_done: 830 Ln.Delete(); 831 if (L->p != NULL) pNext(L->p) = pNext(p); 832 833 if (strat->redTailChange) 834 { 835 L->length = 0; 836 } 837 838 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 839 //L->Normalize(); // HANNES: should have a test 840 assume(kTest_L(L)); 841 return L->GetLmCurrRing(); 708 842 } 709 843
Note: See TracChangeset
for help on using the changeset viewer.