Changeset d772c3 in git


Ignore:
Timestamp:
Jan 30, 2008, 10:01:38 AM (16 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b21a664aa22dc6e196223af8a74ad4885e83547c')
Children:
9068b4e77df30887d291a2703d67ea9493994b5d
Parents:
6d6383bff4329213dfc31400e874a9a1ae140664
Message:
kbuckets.cc, kstd2.cc, kutil.*, pInline1.h,polys.h :
müll entfernt

kutil.cc:
pIsConstant needs extra nIsUnit in case of rings

p_Procs_Impl.h:
Rings do not have automatic easy number copying

ring.cc:
print ausgabe für ringe


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

Legend:

Unmodified
Added
Removed
  • kernel/kbuckets.cc

    r6d6383b rd772c3  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kbuckets.cc,v 1.33 2007-05-11 10:48:03 wienand Exp $ */
     4/* $Id: kbuckets.cc,v 1.34 2008-01-30 09:01:36 wienand Exp $ */
    55
    66#include "mod2.h"
     
    595595      {
    596596        bucket->coef[i] = p_Mult_nn(bucket->coef[i],n,r);
    597 #ifdef HAVE_RING2TOM_OLD
    598         if (r->cring == 1 && (long) bucket->coef[i] == 0) {
    599           bucket->coef[i] = NULL;
    600           bucket->buckets[i] = NULL;
    601           bucket->buckets_length[i] = 0;
    602         }
    603 #endif
    604597      }
    605598      else
     
    621614#else
    622615  bucket->p = p_Mult_nn(bucket->p, n, bucket->bucket_ring);
    623 #ifdef HAVE_RING2TOM_OLD
    624   if (r->cring == 1) bucket->buckets_length[i] = pLength(bucket->buckets[i]);
    625 #endif
    626616#endif
    627617}
  • kernel/kstd2.cc

    r6d6383b rd772c3  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.56 2007-11-06 16:30:20 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.57 2008-01-30 09:01:36 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    146146
    147147#ifdef HAVE_RING2TOM
    148 /*        Obsolute since changes to pLmDiv
    149 // return -1 if no divisor is found
    150 //        number of first divisor, otherwise
    151 int kRingFindDivisibleByInT(const TSet &T, const unsigned long* sevT,
    152                         const int tl, const LObject* L, const int start)
    153 {
    154   unsigned long not_sev = ~L->sev;
    155   int j = start;
    156   poly p;
    157   ring r;
    158   L->GetLm(p, r);
    159 
    160   pAssume(~not_sev == p_GetShortExpVector(p, r));
    161 
    162   {
    163     loop
    164     {
    165       if (j > tl) return -1;
    166 #if defined(PDEBUG) || defined(PDIV_DEBUG)
    167       if (p_LmRingShortDivisibleBy(T[j].p, sevT[j],
    168                                p, not_sev, r))
    169         return j;
    170 #else
    171       if ( !(sevT[j] & not_sev) &&
    172            p_LmRingDivisibleBy(T[j].p, p, r) )
    173         return j;
    174 #endif
    175       j++;
    176     }
    177   }
    178   return -1;
    179 }
    180 
    181 // same as above, only with set S
    182 int kRingFindDivisibleByInS(const polyset &S, const unsigned long* sev, const int sl, LObject* L)
    183 {
    184   unsigned long not_sev = ~L->sev;
    185   poly p = L->GetLmCurrRing();
    186   int j = 0;
    187   //PrintS("FindDiv: p="); wrp(p); PrintLn();
    188   pAssume(~not_sev == p_GetShortExpVector(p, currRing));
    189   loop
    190   {
    191     //PrintS("FindDiv: S[j]="); wrp(S[j]); PrintLn();
    192     if (j > sl) return -1;
    193 #if defined(PDEBUG) || defined(PDIV_DEBUG)
    194     if (p_LmRingShortDivisibleBy(S[j], sev[j],
    195                              p, not_sev, currRing))
    196         return j;
    197 #else
    198     if ( !(sev[j] & not_sev) &&
    199          p_LmRingDivisibleBy(S[j], p, currRing) )
    200       return j;
    201 #endif
    202     j++;
    203   }
    204 }
    205 */
    206 
    207 /* now in kutil.cc
    208 long twoPow(long arg)
    209 {
    210   long t = arg;
    211   long result = 1;
    212   while (t > 0)
    213   {
    214     result = 2 * result;
    215     t--;
    216   }
    217   return result;
    218 }
    219 */
    220 
    221148NATNUMBER factorial(NATNUMBER arg)
    222149{
     
    1011938  loop
    1012939  {
    1013 /* Obsolete since change in pLmDiv
    1014 #ifdef HAVE_RING2TOM
    1015     if (currRing->cring == 1)
    1016     {
    1017       j=kRingFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
    1018     }
    1019     else
    1020 #endif
    1021 */
    1022       j=kFindDivisibleByInS(strat,&max_ind,&P);
     940    j=kFindDivisibleByInS(strat,&max_ind,&P);
    1023941    if (j>=0)
    1024942    {
  • kernel/kutil.cc

    r6d6383b rd772c3  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.71 2007-11-09 11:31:53 Singular Exp $ */
     4/* $Id: kutil.cc,v 1.72 2008-01-30 09:01:36 wienand Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    27572757  int j=pos;
    27582758
    2759 #ifdef HAVE_RING2TOM
     2759#ifdef HAVE_RINGS
    27602760  assume (!rField_is_Ring(currRing));
    27612761#endif
     
    40794079  }
    40804080}
    4081 /*
    4082 #ifdef HAVE_RING2TOM
    4083 TObject*
    4084 kRingFindDivisibleByInS(kStrategy strat, int pos, LObject* L, TObject *T,
    4085                     long ecart)
    4086 {
    4087   int j = 0;
    4088   const unsigned long not_sev = ~L->sev;
    4089   const unsigned long* sev = strat->sevS;
    4090   poly p;
    4091   ring r;
    4092   L->GetLm(p, r);
    4093 
    4094   assume(~not_sev == p_GetShortExpVector(p, r));
    4095 
    4096   if (r == currRing)
    4097   {
    4098     loop
    4099     {
    4100       if (j > pos) return NULL;
    4101 #if defined(PDEBUG) || defined(PDIV_DEBUG)
    4102       if (p_LmRingShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
    4103           (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
    4104         break;
    4105 #else
    4106       if (!(sev[j] & not_sev) &&
    4107           (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
    4108           p_LmRingDivisibleBy(strat->S[j], p, r))
    4109         break;
    4110 
    4111 #endif
    4112       j++;
    4113     }
    4114     // if called from NF, T objects do not exist:
    4115     if (strat->tl < 0 || strat->S_2_R[j] == -1)
    4116     {
    4117       T->Set(strat->S[j], r, strat->tailRing);
    4118       return T;
    4119     }
    4120     else
    4121     {
    4122       assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL &&
    4123               strat->S_2_T(j)->p == strat->S[j]);
    4124       return strat->S_2_T(j);
    4125     }
    4126   }
    4127   else
    4128   {
    4129     TObject* t;
    4130     loop
    4131     {
    4132       if (j > pos) return NULL;
    4133       assume(strat->S_2_R[j] != -1);
    4134 #if defined(PDEBUG) || defined(PDIV_DEBUG)
    4135       t = strat->S_2_T(j);
    4136       assume(t != NULL && t->t_p != NULL && t->tailRing == r);
    4137       if (p_LmRingShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
    4138           (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
    4139         return t;
    4140 #else
    4141       if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
    4142       {
    4143         t = strat->S_2_T(j);
    4144         assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
    4145         if (p_LmRingDivisibleBy(t->t_p, p, r)) return t;
    4146       }
    4147 #endif
    4148       j++;
    4149     }
    4150   }
    4151 }
    4152 #endif
    4153 */
    41544081
    41554082poly redtail (LObject* L, int pos, kStrategy strat)
     
    45044431  if ((strat->sl>=0)
    45054432#ifdef HAVE_RINGS
    4506        && !rField_is_Ring(currRing)
     4433       && nIsUnit(pGetCoef(strat->L[strat->Ll].p)
    45074434#endif
    45084435       && pIsConstant(strat->S[0]))
     
    46004527  }
    46014528  /*- test, if a unit is in F -*/
    4602   if ((strat->Ll>=0) && pIsConstant(strat->L[strat->Ll].p))
     4529
     4530  if ((strat->Ll>=0)
     4531#ifdef HAVE_RINGS
     4532       && nIsUnit(pGetCoef(strat->L[strat->Ll].p)
     4533#endif
     4534       && pIsConstant(strat->L[strat->Ll].p))
    46034535  {
    46044536    while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
     
    48604792  while (j <= maxIndex)
    48614793  {
    4862 #ifdef HAVE_RING2TOM_OLD
    4863     if ((currRing->cring == 1 && pLmRingShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)) ||
    4864         (currRing->cring == 0 && pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)))
    4865 #else
    48664794    if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
    4867 #endif
    48684795    {
    48694796      h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
  • kernel/kutil.h

    r6d6383b rd772c3  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.28 2007-11-09 11:31:53 Singular Exp $ */
     6/* $Id: kutil.h,v 1.29 2008-01-30 09:01:37 wienand Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    280280  BOOLEAN * NotUsedAxis;
    281281  BOOLEAN * pairtest;/*used for enterOnePair*/
    282 #ifdef HAVE_RING2TOM
    283 //  unsigned int * lmcomp;/*used for enterOnePairRing and chainCritRing*/
    284 #endif
    285282  poly tail;
    286283  leftv kIdeal;
     
    456453                    long ecart = LONG_MAX);
    457454
    458 /*Obsolete since changes to pLmDiv
    459 #ifdef HAVE_RING2TOM
    460 // same for rings
    461 int kRingFindDivisibleByInT(const TSet &T, const unsigned long* sevT,
    462                         const int tl, const LObject* L, const int start=0);
    463 int kRingFindDivisibleByInS(const polyset &S, const unsigned long* sev,
    464                         const int sl, LObject* L);
    465 
    466 
    467 TObject*
    468 kRingFindDivisibleByInS(kStrategy strat, int pos, LObject* L, TObject *T,
    469                     long ecart = LONG_MAX);
    470 #endif
    471 */
    472455/***************************************************************
    473456 *
     
    556539                 kStrategy strat = NULL);
    557540
    558 #ifdef HAVE_RING2TOM_OLD
    559 // same for rings
    560 int ksRingReducePoly(LObject* PR,
    561                  TObject* PW,
    562                  poly spNoether = NULL,
    563                  number *coef = NULL,
    564                  kStrategy strat = NULL);
    565 #endif
    566 
    567541// Reduces PR at Current->next with PW
    568542// Assumes PR != NULL, Current contained in PR
  • kernel/pInline1.h

    r6d6383b rd772c3  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline1.h,v 1.13 2007-05-24 10:02:43 wienand Exp $
     9 *  Version: $Id: pInline1.h,v 1.14 2008-01-30 09:01:37 wienand Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE1_H
     
    2020#include "structs.h"
    2121#include "numbers.h"
    22 #ifdef HAVE_RINGMODN
    23 // #include "febase.h"
    24 #endif
    2522
    2623#if PDEBUG > 0 || defined(NO_PINLINE1)
     
    399396}
    400397
    401 #ifdef HAVE_RING2TOM_OLD
    402 /***************************************************************
    403  *
    404  * divisibility for rings (considers coefficients)
    405  *
    406  ***************************************************************/
    407 // return: FALSE, if there exists i, such that a->exp[i] > b->exp[i]
    408 //         TRUE, otherwise
    409 // (1) Consider long vars, instead of single exponents
    410 // (2) Clearly, if la > lb, then FALSE
    411 // (3) Suppose la <= lb, and consider first bits of single exponents in l:
    412 //     if TRUE, then value of these bits is la ^ lb
    413 //     if FALSE, then la-lb causes an "overflow" into one of those bits, i.e.,
    414 //               la ^ lb != la - lb
    415 static inline BOOLEAN _p_LmRingDivisibleByNoComp(poly a, poly b, ring r)
    416 {
    417   BOOLEAN mDiv = _p_LmDivisibleByNoComp(a, b, r);
    418   if (mDiv) {
    419     long lside = (long) p_GetCoeff(a,r);
    420     long rside = (long) p_GetCoeff(b,r);
    421     // Später durch bitvergleiche viel schneller  TODO OLIVER
    422     while (lside%2 == 0 && rside%2 == 0) {
    423       lside = lside / 2;
    424       rside = rside / 2;
    425     }
    426     return (lside%2 != 0);     // Is lside, i.e. LC(a), a unit?
    427   }
    428   return FALSE;
    429 }
    430 #endif
    431 
    432398static inline BOOLEAN _p_LmDivisibleByNoComp(poly a, ring r_a, poly b, ring r_b)
    433399{
     
    448414#endif
    449415}
    450 
    451 #ifdef HAVE_RING2TOM_OLD
    452 static inline BOOLEAN _p_LmRingDivisibleByNoComp(poly a, ring r_a, poly b, ring r_b)
    453 {
    454   BOOLEAN mDiv = _p_LmDivisibleByNoComp(a, r_a, b, r_b);
    455   if (mDiv) {
    456     long lside = (long) p_GetCoeff(a, r_a);
    457     long rside = (long) p_GetCoeff(b, r_b);
    458     // Später durch bitvergleiche viel schneller TODO OLIVER
    459     while (lside%2 == 0 && rside%2 == 0) {
    460       lside = lside / 2;
    461       rside = rside / 2;
    462     }
    463     return (lside%2 != 0);
    464   }
    465   return FALSE;
    466 }
    467 #endif
    468416
    469417static inline BOOLEAN _p_LmDivisibleBy(poly a, poly b, ring r)
     
    494442}
    495443
    496 #ifdef HAVE_RING2TOM_OLD
    497 PINLINE1 BOOLEAN p_LmRingDivisibleBy(poly a, poly b, ring r)
    498 {
    499   p_LmCheckPolyRing1(b, r);
    500   pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
    501   if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
    502     return _p_LmRingDivisibleByNoComp(a, b, r);
    503   return FALSE;
    504 }
    505 #endif
    506 
    507444PINLINE1 BOOLEAN p_DivisibleBy(poly a, poly b, ring r)
    508445{
     
    548485#endif
    549486}
    550 
    551 #ifdef HAVE_RING2TOM_OLD
    552 PINLINE1 BOOLEAN p_LmRingShortDivisibleBy(poly a, unsigned long sev_a,
    553                                           poly b, unsigned long not_sev_b, ring r)
    554 {
    555   p_LmCheckPolyRing1(a, r);
    556   p_LmCheckPolyRing1(b, r);
    557 #ifndef PDIV_DEBUG
    558   _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
    559   _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
    560 
    561   if (sev_a & not_sev_b)
    562   {
    563     pAssume1(_p_LmRingDivisibleByNoComp(a, b, r) == FALSE);
    564     return FALSE;
    565   }
    566   return p_LmRingDivisibleBy(a, b, r);
    567 #else
    568   return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
    569 #endif
    570 }
    571 #endif
    572487
    573488PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, ring r_a,
  • kernel/p_Numbers.h

    r6d6383b rd772c3  
    44/***************************************************************
    55 *  File:    p_Numbers.h
    6  *  Purpose: macros/inline functions for number oerations
     6 *  Purpose: macros/inline functions for number operations
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_Numbers.h,v 1.2 2007-05-10 08:12:42 wienand Exp $
     9 *  Version: $Id: p_Numbers.h,v 1.3 2008-01-30 09:01:37 wienand Exp $
    1010 *******************************************************************/
    1111#ifndef P_NUMBERS_H
  • kernel/p_Procs_Impl.h

    r6d6383b rd772c3  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 12/00
    9  *  Version: $Id: p_Procs_Impl.h,v 1.7 2007-05-10 08:12:42 wienand Exp $
     9 *  Version: $Id: p_Procs_Impl.h,v 1.8 2008-01-30 09:01:38 wienand Exp $
    1010 *******************************************************************/
    1111#ifndef P_PROCS_IMPL_H
     
    8989
    9090// Predicate which returns true if alloc/copy/free of numbers is
    91 // like that of Zp
     91// like that of Zp (rings should use GMP in future)
    9292#ifdef HAVE_RINGS
    9393#define ZP_COPY_FIELD(field) \
    94   (field == FieldZp || field == FieldGF || field == FieldR || field == RingGeneral)
     94  (field == FieldZp || field == FieldGF || field == FieldR)
    9595#else
    9696#define ZP_COPY_FIELD(field) \
  • kernel/polys.h

    r6d6383b rd772c3  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.14 2007-11-16 17:25:10 Singular Exp $ */
     6/* $Id: polys.h,v 1.15 2008-01-30 09:01:38 wienand Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    252252#define   pIsVector(p)      (pGetComp(p)>0)
    253253#define   pGetVariables(p,e)  p_GetVariables(p, e, currRing)
    254 
    255 #ifdef HAVE_RINGS
    256 /*
    257  * Test stuff for dev OLIVER
    258  */
    259  
    260 // number nGetUnit(number k);
    261 #endif
    262 
    263254
    264255/***************************************************************
  • kernel/polys1.cc

    r6d6383b rd772c3  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.29 2007-06-20 09:39:24 wienand Exp $ */
     4/* $Id: polys1.cc,v 1.30 2008-01-30 09:01:38 wienand Exp $ */
    55
    66/*
     
    482482{
    483483#ifdef HAVE_RINGS
    484   if (rField_is_Ring(currRing)) {
     484  if (rField_is_Ring(currRing))
     485  {
    485486    if ((ph!=NULL) && rField_has_Units(currRing))
    486487    {
     
    498499        nDelete(&k);
    499500      }
    500      return;
    501     }
    502     return;  //TODO OLIVER
     501    }
     502    return;
    503503  }
    504504#endif
  • kernel/ring.cc

    r6d6383b rd772c3  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.70 2007-11-09 11:29:44 Singular Exp $ */
     4/* $Id: ring.cc,v 1.71 2008-01-30 09:01:38 wienand Exp $ */
    55
    66/*
     
    269269    }
    270270  }
     271#ifdef HAVE_RINGS
     272  else if (rField_is_Ring(r))
     273  {
     274    PrintS("//   coeff. ring is : ");
     275#ifdef HAVE_RINGZ
     276    if (rField_is_Ring_Z(r)) PrintS("Integers\n");
     277#endif
     278#ifdef HAVE_RINGMODN
     279    if (rField_is_Ring_ModN(r)) Print("Z/%d\n", r->ringflaga);
     280#endif
     281#ifdef HAVE_RING2TOM
     282    if (rField_is_Ring_2toM(r)) Print("Z/2^%d\n", r->ringflagb);
     283#endif
     284#ifdef HAVE_RINGPTOM
     285    if (rField_is_Ring_PtoM(r)) Print("Z/%d^%d\n", r->ringflaga, r->ringflagb);
     286#endif
     287  }
     288#endif
    271289  else
    272290  {
Note: See TracChangeset for help on using the changeset viewer.