Changeset 585bbcb in git for kernel/kspoly.cc


Ignore:
Timestamp:
Nov 27, 2005, 4:28:46 PM (17 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
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/kspoly.cc

    rf498f10 r585bbcb  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.1.1.1 2003-10-06 12:15:56 Singular Exp $ */
     4/* $Id: kspoly.cc,v 1.2 2005-11-27 15:28:44 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    116116    number bn = pGetCoeff(lm);
    117117    number an = pGetCoeff(p2);
     118#ifdef HAVE_RING2TOM
     119    if (currRing->cring == 1) {
     120      while (((long) an)%2 == 0 && ((long) bn)%2 == 0) {
     121        an = (number) (((long) an) / 2);
     122        bn = (number) (((long) bn) / 2);
     123      }
     124    }
     125#endif
    118126    int ct = ksCheckCoeff(&an, &bn);
    119127    p_SetCoeff(lm, bn,tailRing);
     
    140148  return ret;
    141149}
     150
     151#ifdef HAVE_RING2TOM
     152/***************************************************************
     153 *
     154 * Reduces PR with PW
     155 * Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR)
     156 * as above, just for rings
     157 *
     158 ***************************************************************/
     159int ksRingReducePoly(LObject* PR,
     160                 TObject* PW,
     161                 poly spNoether,
     162                 number *coef,
     163                 kStrategy strat)
     164{
     165#ifdef KDEBUG
     166  red_count++;
     167#ifdef TEST_OPT_DEBUG_RED
     168  if (TEST_OPT_DEBUG)
     169  {
     170    Print("Red %d:", red_count); PR->wrp(); Print(" with:");
     171    PW->wrp();
     172  }
     173#endif
     174#endif
     175  int ret = 0;
     176  ring tailRing = PR->tailRing;
     177  kTest_L(PR);
     178  kTest_T(PW);
     179
     180  poly p1 = PR->GetLmTailRing();
     181  poly p2 = PW->GetLmTailRing();
     182  poly t2 = pNext(p2), lm = p1;
     183  assume(p1 != NULL && p2 != NULL);
     184  p_CheckPolyRing(p1, tailRing);
     185  p_CheckPolyRing(p2, tailRing);
     186
     187  pAssume1(p2 != NULL && p1 != NULL &&
     188           p_RingDivisibleBy(p2,  p1, tailRing));
     189
     190  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
     191           (p_GetComp(p2, tailRing) == 0 &&
     192            p_MaxComp(pNext(p2),tailRing) == 0));
     193
     194  if (t2==NULL)
     195  {
     196    PR->LmDeleteAndIter();
     197    if (coef != NULL) *coef = n_Init(1, tailRing);
     198    return 0;
     199  }
     200
     201  p_ExpVectorSub(lm, p2, tailRing);
     202
     203  if (tailRing != currRing)
     204  {
     205    // check that reduction does not violate exp bound
     206    while (PW->max != NULL && !p_LmExpVectorAddIsOk(lm, PW->max, tailRing))
     207    {
     208      // undo changes of lm
     209      p_ExpVectorAdd(lm, p2, tailRing);
     210      if (strat == NULL) return 2;
     211      if (! kStratChangeTailRing(strat, PR, PW)) return -1;
     212      tailRing = strat->tailRing;
     213      p1 = PR->GetLmTailRing();
     214      p2 = PW->GetLmTailRing();
     215      t2 = pNext(p2);
     216      lm = p1;
     217      p_ExpVectorSub(lm, p2, tailRing);
     218      ret = 1;
     219    }
     220  }
     221
     222  // take care of coef buisness
     223  if (! n_IsOne(pGetCoeff(p2), tailRing))
     224  {
     225    number bn = pGetCoeff(lm);
     226    number an = pGetCoeff(p2);
     227    while (((long) an)%2 == 0 && ((long) bn)%2 == 0) {
     228      an = (number) (((long) an) / 2);
     229      bn = (number) (((long) bn) / 2);
     230    }
     231    int ct = ksCheckCoeff(&an, &bn);
     232    p_SetCoeff(lm, bn,tailRing);
     233    if ((ct == 0) || (ct == 2))
     234      PR->Tail_Mult_nn(an);
     235    if (coef != NULL) *coef = an;
     236    else n_Delete(&an, tailRing);
     237  }
     238  else
     239  {
     240    if (coef != NULL) *coef = n_Init(1, tailRing);
     241  }
     242
     243
     244  // and finally,
     245  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
     246  PR->LmDeleteAndIter();
     247#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
     248  if (TEST_OPT_DEBUG)
     249  {
     250    Print(" to: "); PR->wrp(); Print("\n");
     251  }
     252#endif
     253  return ret;
     254}
     255#endif
    142256
    143257/***************************************************************
     
    166280  poly a1 = pNext(p1), a2 = pNext(p2);
    167281  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
     282#ifdef HAVE_RING2TOM
     283  if (currRing->cring == 1) {
     284    while (((long) lc1)%2 == 0 && ((long) lc2)%2 == 0) {
     285      lc1 = (number) (((long) lc1) / 2);
     286      lc2 = (number) (((long) lc2) / 2);
     287    }
     288  }
     289#endif 
    168290  int co=0, ct = ksCheckCoeff(&lc1, &lc2);
    169291
Note: See TracChangeset for help on using the changeset viewer.