Changeset 5eb865 in git


Ignore:
Timestamp:
Jun 9, 2009, 8:21:50 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
e4be351ada16eebdaa1e48ce01115ffc5287dbd3
Parents:
b82abb0dc3349df20acd8231f648b8ff51bc61b6
Message:
*hannes: redtail for Z


git-svn-id: file:///usr/local/Singular/svn/trunk@11891 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/kInline.cc

    rb82abb r5eb865  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: kInline.cc,v 1.15 2009-03-18 16:56:02 Singular Exp $
     9 *  Version: $Id: kInline.cc,v 1.16 2009-06-09 18:21:50 Singular Exp $
    1010 *******************************************************************/
    1111#ifndef KINLINE_CC
     
    10861086}
    10871087
     1088#ifdef HAVE_RINGS
     1089KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat)
     1090{
     1091  LObject L(p, currRing, strat->tailRing);
     1092  return redtailBba_Z(&L, pos, strat);
     1093}
     1094#endif
     1095
    10881096KINLINE poly redtailBba(TObject *T, int pos,kStrategy strat)
    10891097{
  • kernel/kstd2.cc

    rb82abb r5eb865  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.87 2009-06-04 08:15:45 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.88 2009-06-09 18:21:50 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    12211221  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
    12221222  {
    1223     BITSET save=test;
    1224     test &= ~Sy_bit(OPT_INTSTRATEGY);
    12251223    if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
    1226     p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
    1227     test=save;
     1224    #ifdef HAVE_RINGS
     1225    if (rField_is_Ring())
     1226    {
     1227      p = redtailBba_Z(p,max_ind,strat);
     1228    }
     1229    else
     1230    #endif
     1231    {
     1232      BITSET save=test;
     1233      test &= ~Sy_bit(OPT_INTSTRATEGY);
     1234      p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
     1235      test=save;
     1236    }
    12281237  }
    12291238  /*- release temp data------------------------------- -*/
     
    12771286  /*- compute------------------------------------------------------- -*/
    12781287  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
     1288  BITSET save=test;
     1289  test &= ~Sy_bit(OPT_INTSTRATEGY);
    12791290  for (i=IDELEMS(q)-1; i>=0; i--)
    12801291  {
     
    12851296      if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
    12861297      {
    1287         BITSET save=test;
    1288         test &= ~Sy_bit(OPT_INTSTRATEGY);
    12891298        if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
    1290         p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
    1291         test=save;
     1299        #ifdef HAVE_RINGS
     1300        if (rField_is_Ring())
     1301        {
     1302          p = redtailBba_Z(p,max_ind,strat);
     1303        }
     1304        else
     1305        #endif
     1306        {
     1307          p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
     1308        }
    12921309      }
    12931310      res->m[i]=p;
     
    12971314  }
    12981315  /*- release temp data------------------------------- -*/
     1316  test=save;
    12991317  omfree(strat->sevS);
    13001318  omfree(strat->ecartS);
  • kernel/kutil.cc

    rb82abb r5eb865  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.143 2009-06-04 08:42:06 Singular Exp $ */
     4/* $Id: kutil.cc,v 1.144 2009-06-09 18:21:50 Singular Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    45964596  return L->GetLmCurrRing();
    45974597}
     4598
     4599#ifdef HAVE_RINGS
     4600poly 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
    45984705
    45994706/*2
  • kernel/kutil.h

    rb82abb r5eb865  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.44 2009-05-06 12:53:48 Singular Exp $ */
     6/* $Id: kutil.h,v 1.45 2009-06-09 18:21:50 Singular Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    401401             LObject* L,const kStrategy strat);
    402402KINLINE poly redtailBba (poly p,int pos,kStrategy strat,BOOLEAN normalize=FALSE);
     403#ifdef HAVE_RINGS
     404KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat);
     405poly redtailBba_Z (LObject* L, int pos, kStrategy strat );
     406#endif
    403407poly redtailBba (LObject *L, int pos,kStrategy strat,
    404408                 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE);
Note: See TracChangeset for help on using the changeset viewer.