Changeset 5eb865 in git for kernel/kutil.cc
- Timestamp:
- Jun 9, 2009, 8:21:50 PM (14 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- e4be351ada16eebdaa1e48ce01115ffc5287dbd3
- Parents:
- b82abb0dc3349df20acd8231f648b8ff51bc61b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kutil.cc
rb82abb r5eb865 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.14 3 2009-06-04 08:42:06Singular Exp $ */4 /* $Id: kutil.cc,v 1.144 2009-06-09 18:21:50 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 4596 4596 return L->GetLmCurrRing(); 4597 4597 } 4598 4599 #ifdef HAVE_RINGS 4600 poly redtailBba_Z (LObject* L, int pos, kStrategy strat ) 4601 // normalize=FALSE, withT=FALSE, coeff=Z 4602 { 4603 strat->redTailChange=FALSE; 4604 if (strat->noTailReduction) return L->GetLmCurrRing(); 4605 poly h, p; 4606 p = h = L->GetLmTailRing(); 4607 if ((h==NULL) || (pNext(h)==NULL)) 4608 return L->GetLmCurrRing(); 4609 4610 TObject* With; 4611 // placeholder in case strat->tl < 0 4612 TObject With_s(strat->tailRing); 4613 4614 LObject Ln(pNext(h), strat->tailRing); 4615 Ln.pLength = L->GetpLength() - 1; 4616 4617 pNext(h) = NULL; 4618 if (L->p != NULL) pNext(L->p) = NULL; 4619 L->pLength = 1; 4620 4621 Ln.PrepareRed(strat->use_buckets); 4622 4623 int cnt=REDTAIL_CANONICALIZE; 4624 while(!Ln.IsNull()) 4625 { 4626 loop 4627 { 4628 Ln.SetShortExpVector(); 4629 With = kFindDivisibleByInS(strat, pos, &Ln, &With_s); 4630 if (With == NULL) break; 4631 cnt--; 4632 if (cnt==0) 4633 { 4634 cnt=REDTAIL_CANONICALIZE; 4635 poly tmp=Ln.CanonicalizeP(); 4636 } 4637 // we are in Z, do not Ccall pNorm 4638 strat->redTailChange=TRUE; 4639 // test divisibility of coefs: 4640 poly p_Ln=Ln.GetLmCurrRing(); 4641 poly p_With=With->GetLmCurrRing(); 4642 number z=nIntMod(pGetCoeff(p_Ln),pGetCoeff(p_With)); 4643 if (!nIsZero(z)) 4644 { 4645 // subtract z*Ln, add z.Ln to L 4646 poly m=pHead(p_Ln); 4647 pSetCoeff(m,z); 4648 poly mm=pHead(m); 4649 pNext(h) = m; 4650 pIter(h); 4651 L->pLength++; 4652 mm=pNeg(mm); 4653 if (Ln.bucket!=NULL) 4654 { 4655 int dummy=1; 4656 kBucket_Add_q(Ln.bucket,mm,&dummy); 4657 } 4658 else 4659 { 4660 if (Ln.p!=NULL) Ln.p=pAdd(Ln.p,mm); 4661 else if (Ln.t_p!=NULL) Ln.t_p=p_Add_q(Ln.t_p,mm,strat->tailRing); 4662 } 4663 } 4664 else 4665 nDelete(&z); 4666 4667 if (ksReducePolyTail(L, With, &Ln)) 4668 { 4669 // reducing the tail would violate the exp bound 4670 // set a flag and hope for a retry (in bba) 4671 strat->completeReduce_retry=TRUE; 4672 do 4673 { 4674 pNext(h) = Ln.LmExtractAndIter(); 4675 pIter(h); 4676 L->pLength++; 4677 } while (!Ln.IsNull()); 4678 goto all_done; 4679 } 4680 if (Ln.IsNull()) goto all_done; 4681 With_s.Init(currRing); 4682 } 4683 pNext(h) = Ln.LmExtractAndIter(); 4684 pIter(h); 4685 pNormalize(h); 4686 L->pLength++; 4687 } 4688 4689 all_done: 4690 Ln.Delete(); 4691 if (L->p != NULL) pNext(L->p) = pNext(p); 4692 4693 if (strat->redTailChange) 4694 { 4695 L->last = NULL; 4696 L->length = 0; 4697 } 4698 4699 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 4700 //L->Normalize(); // HANNES: should have a test 4701 kTest_L(L); 4702 return L->GetLmCurrRing(); 4703 } 4704 #endif 4598 4705 4599 4706 /*2
Note: See TracChangeset
for help on using the changeset viewer.