Changeset 585bbcb in git for kernel/kstd2.cc


Ignore:
Timestamp:
Nov 27, 2005, 4:28:46 PM (18 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
6a972af1108afd9ad6a0a74a519e0b3107421d16
Parents:
f498f1081627c853c4d77077fcaa2ea32d82a711
Message:
Makefile.in:
--> rmodulo2m.[h/cc] in HEADERS / CXXSOURCES eingetragen

kspoly.cc:
--> ksReducePoly beachtet Nullteiler
--> ksRingReducePoly (neu)
--> ksCreateSpoly beachtet Nullteiler

kstd1.cc:
--> use strat->red = redRing2toM if currRing->cring == 1

kstd2.cc:
--> kRingFindDivisibleByInT (neu)
--> kRingFindDivisibleByInS (neu)
--> redRing2toM (neu)

kutil.cc:
--> kRingFindDivisibleByInS (neu)
--> redTailBba beachtet Nullteiler und andere Strategien (zum Teil)

kutil.h:
--> int redRing2toM (LObject* h,kStrategy strat); (neu)
--> Dekl. von kRingFind* und ksRingReducePoly

numbers.cc:
--> Unterstützung für Z/2^m

pDebug.cc:
--> p_DebugLmDivisibleByNoComp beachtet coeff für Ringe

pInline1.h:
--> *LmRing* Teilbarkeit mit Beachtung des Koeff

p_Minus_mm_Mult_qq__T.cc:
--> Term*Term = 0 möglich

polys.cc:
--> nGetUnit (neu)
--> pNorm beachtet Nullteiler

polys.h:
--> nGetUnit (neu)

polys1.cc:
--> pCleardenom: in case of ring, just do a pNorm
--> pContent: in case of ring do nothing

pp_Mult_mm__T.cc:
--> Term*Term = 0 möglich bei KoeffRing

ring.cc:
--> rSetOption: setze intStrategy

ring.h:
--> rField_is_Ring_2toM (neu)
--> alle anderen Fkt. angepasst

ringgb.cc, ringgb.h: test container in Zshg. mit extra.cc

structs.h:
--> ring->cring property (neu) cring = 0 bei Körpern, cring = 1 bei Z/2^m


git-svn-id: file:///usr/local/Singular/svn/trunk@8813 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd2.cc

    rf498f10 r585bbcb  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.3 2005-10-17 13:42:48 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.4 2005-11-27 15:28:44 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    103103  }
    104104}
     105
     106#ifdef HAVE_RING2TOM
     107// return -1 if no divisor is found
     108//        number of first divisor, otherwise
     109int kRingFindDivisibleByInT(const TSet &T, const unsigned long* sevT,
     110                        const int tl, const LObject* L, const int start)
     111{
     112  unsigned long not_sev = ~L->sev;
     113  int j = start;
     114  poly p;
     115  ring r;
     116  L->GetLm(p, r);
     117
     118  pAssume(~not_sev == p_GetShortExpVector(p, r));
     119
     120  {
     121    loop
     122    {
     123      if (j > tl) return -1;
     124#if defined(PDEBUG) || defined(PDIV_DEBUG)
     125      if (p_LmRingShortDivisibleBy(T[j].p, sevT[j],
     126                               p, not_sev, r))
     127        return j;
     128#else
     129      if ( !(sevT[j] & not_sev) &&
     130           p_LmRingDivisibleBy(T[j].p, p, r) )
     131        return j;
     132#endif
     133      j++;
     134    }
     135  }
     136  return -1;
     137}
     138
     139// same as above, only with set S
     140int kRingFindDivisibleByInS(const polyset &S, const unsigned long* sev, const int sl, LObject* L)
     141{
     142  unsigned long not_sev = ~L->sev;
     143  poly p = L->GetLmCurrRing();
     144  int j = 0;
     145  //PrintS("FindDiv: p="); wrp(p); PrintLn();
     146  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
     147  loop
     148  {
     149    //PrintS("FindDiv: S[j]="); wrp(S[j]); PrintLn();
     150    if (j > sl) return -1;
     151#if defined(PDEBUG) || defined(PDIV_DEBUG)
     152    if (p_LmRingShortDivisibleBy(S[j], sev[j],
     153                             p, not_sev, currRing))
     154        return j;
     155#else
     156    if ( !(sev[j] & not_sev) &&
     157         p_LmRingDivisibleBy(S[j], p, currRing) )
     158      return j;
     159#endif
     160    j++;
     161  }
     162}
     163
     164/*2
     165*  reduction procedure for the ring Z/2^m
     166*/
     167int redRing2toM (LObject* h,kStrategy strat)
     168{
     169//  PrintS("redRing2toM");
     170//  PrintLn();
     171  if (strat->tl<0) return 1;
     172  int at,d,i;
     173  int j = 0;
     174  int pass = 0;
     175  assume(h->pFDeg() == h->FDeg);
     176  long reddeg = h->GetpFDeg();
     177
     178  h->SetShortExpVector();
     179  loop
     180  {
     181    j = kRingFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
     182    if (j < 0) return 1;
     183
     184#ifdef KDEBUG
     185    if (TEST_OPT_DEBUG)
     186    {
     187      PrintS("red:");
     188      h->wrp();
     189      PrintS(" with ");
     190      strat->T[j].wrp();
     191    }
     192#endif
     193
     194    ksRingReducePoly(h, &(strat->T[j]), NULL, NULL, strat);
     195
     196#ifdef KDEBUG
     197    if (TEST_OPT_DEBUG)
     198    {
     199      PrintS("\nto ");
     200      h->wrp();
     201      PrintLn();
     202    }
     203#endif
     204
     205    if (h->GetLmTailRing() == NULL)
     206    {
     207      if (h->lcm!=NULL) pLmFree(h->lcm);
     208#ifdef KDEBUG
     209      h->lcm=NULL;
     210#endif
     211      return 0;
     212    }
     213    h->SetShortExpVector();
     214    d = h->SetpFDeg();
     215    /*- try to reduce the s-polynomial -*/
     216    pass++;
     217    if (!K_TEST_OPT_REDTHROUGH &&
     218        (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
     219    {
     220      h->SetLmCurrRing();
     221      at = strat->posInL(strat->L,strat->Ll,h,strat);
     222      if (at <= strat->Ll)
     223      {
     224#if 0
     225        if (kRingFindDivisibleByInS(strat->S, strat->sevS, strat->sl, h) < 0)
     226          return 1;
     227#endif
     228#ifdef KDEBUG
     229        if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
     230#endif
     231        enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
     232        h->Clear();
     233        return -1;
     234      }
     235    }
     236    else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d != reddeg))
     237    {
     238      Print(".%d",d);mflush();
     239      reddeg = d;
     240    }
     241  }
     242}
     243#endif
    105244
    106245/*2
     
    417556  loop
    418557  {
    419     j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
     558#ifdef HAVE_RING2TOM
     559    if (currRing->cring == 1) {
     560      j=kRingFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
     561    }
     562    else
     563#endif
     564      j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
    420565    if (j>=0)
    421566    {
     
    520665#ifdef KDEBUG
    521666    loop_count++;
     667#ifdef HAVE_RING2TOM
     668    if (TEST_OPT_DEBUG) PrintS("--- next step ---\n");
     669#endif   
    522670    if (TEST_OPT_DEBUG) messageSets(strat);
    523671#endif
Note: See TracChangeset for help on using the changeset viewer.