Changeset d772c3 in git
- Timestamp:
- Jan 30, 2008, 10:01:38 AM (15 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 9068b4e77df30887d291a2703d67ea9493994b5d
- Parents:
- 6d6383bff4329213dfc31400e874a9a1ae140664
- Location:
- kernel
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kbuckets.cc
r6d6383b rd772c3 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kbuckets.cc,v 1.3 3 2007-05-11 10:48:03wienand Exp $ */4 /* $Id: kbuckets.cc,v 1.34 2008-01-30 09:01:36 wienand Exp $ */ 5 5 6 6 #include "mod2.h" … … 595 595 { 596 596 bucket->coef[i] = p_Mult_nn(bucket->coef[i],n,r); 597 #ifdef HAVE_RING2TOM_OLD598 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 #endif604 597 } 605 598 else … … 621 614 #else 622 615 bucket->p = p_Mult_nn(bucket->p, n, bucket->bucket_ring); 623 #ifdef HAVE_RING2TOM_OLD624 if (r->cring == 1) bucket->buckets_length[i] = pLength(bucket->buckets[i]);625 #endif626 616 #endif 627 617 } -
kernel/kstd2.cc
r6d6383b rd772c3 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1.5 6 2007-11-06 16:30:20 SingularExp $ */4 /* $Id: kstd2.cc,v 1.57 2008-01-30 09:01:36 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 146 146 147 147 #ifdef HAVE_RING2TOM 148 /* Obsolute since changes to pLmDiv149 // return -1 if no divisor is found150 // number of first divisor, otherwise151 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 loop164 {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 #else171 if ( !(sevT[j] & not_sev) &&172 p_LmRingDivisibleBy(T[j].p, p, r) )173 return j;174 #endif175 j++;176 }177 }178 return -1;179 }180 181 // same as above, only with set S182 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 loop190 {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 #else198 if ( !(sev[j] & not_sev) &&199 p_LmRingDivisibleBy(S[j], p, currRing) )200 return j;201 #endif202 j++;203 }204 }205 */206 207 /* now in kutil.cc208 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 221 148 NATNUMBER factorial(NATNUMBER arg) 222 149 { … … 1011 938 loop 1012 939 { 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); 1023 941 if (j>=0) 1024 942 { -
kernel/kutil.cc
r6d6383b rd772c3 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.7 1 2007-11-09 11:31:53 SingularExp $ */4 /* $Id: kutil.cc,v 1.72 2008-01-30 09:01:36 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 2757 2757 int j=pos; 2758 2758 2759 #ifdef HAVE_RING 2TOM2759 #ifdef HAVE_RINGS 2760 2760 assume (!rField_is_Ring(currRing)); 2761 2761 #endif … … 4079 4079 } 4080 4080 } 4081 /*4082 #ifdef HAVE_RING2TOM4083 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 loop4099 {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 #else4106 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 #endif4112 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 else4121 {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 else4128 {4129 TObject* t;4130 loop4131 {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 #else4141 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 #endif4148 j++;4149 }4150 }4151 }4152 #endif4153 */4154 4081 4155 4082 poly redtail (LObject* L, int pos, kStrategy strat) … … 4504 4431 if ((strat->sl>=0) 4505 4432 #ifdef HAVE_RINGS 4506 && !rField_is_Ring(currRing)4433 && nIsUnit(pGetCoef(strat->L[strat->Ll].p) 4507 4434 #endif 4508 4435 && pIsConstant(strat->S[0])) … … 4600 4527 } 4601 4528 /*- 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)) 4603 4535 { 4604 4536 while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat); … … 4860 4792 while (j <= maxIndex) 4861 4793 { 4862 #ifdef HAVE_RING2TOM_OLD4863 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 #else4866 4794 if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)) 4867 #endif4868 4795 { 4869 4796 h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail()); -
kernel/kutil.h
r6d6383b rd772c3 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kutil.h,v 1.2 8 2007-11-09 11:31:53 SingularExp $ */6 /* $Id: kutil.h,v 1.29 2008-01-30 09:01:37 wienand Exp $ */ 7 7 /* 8 8 * ABSTRACT: kernel: utils for kStd … … 280 280 BOOLEAN * NotUsedAxis; 281 281 BOOLEAN * pairtest;/*used for enterOnePair*/ 282 #ifdef HAVE_RING2TOM283 // unsigned int * lmcomp;/*used for enterOnePairRing and chainCritRing*/284 #endif285 282 poly tail; 286 283 leftv kIdeal; … … 456 453 long ecart = LONG_MAX); 457 454 458 /*Obsolete since changes to pLmDiv459 #ifdef HAVE_RING2TOM460 // same for rings461 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 #endif471 */472 455 /*************************************************************** 473 456 * … … 556 539 kStrategy strat = NULL); 557 540 558 #ifdef HAVE_RING2TOM_OLD559 // same for rings560 int ksRingReducePoly(LObject* PR,561 TObject* PW,562 poly spNoether = NULL,563 number *coef = NULL,564 kStrategy strat = NULL);565 #endif566 567 541 // Reduces PR at Current->next with PW 568 542 // Assumes PR != NULL, Current contained in PR -
kernel/pInline1.h
r6d6383b rd772c3 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline1.h,v 1.1 3 2007-05-24 10:02:43wienand Exp $9 * Version: $Id: pInline1.h,v 1.14 2008-01-30 09:01:37 wienand Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE1_H … … 20 20 #include "structs.h" 21 21 #include "numbers.h" 22 #ifdef HAVE_RINGMODN23 // #include "febase.h"24 #endif25 22 26 23 #if PDEBUG > 0 || defined(NO_PINLINE1) … … 399 396 } 400 397 401 #ifdef HAVE_RING2TOM_OLD402 /***************************************************************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, otherwise409 // (1) Consider long vars, instead of single exponents410 // (2) Clearly, if la > lb, then FALSE411 // (3) Suppose la <= lb, and consider first bits of single exponents in l:412 // if TRUE, then value of these bits is la ^ lb413 // if FALSE, then la-lb causes an "overflow" into one of those bits, i.e.,414 // la ^ lb != la - lb415 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 OLIVER422 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 #endif431 432 398 static inline BOOLEAN _p_LmDivisibleByNoComp(poly a, ring r_a, poly b, ring r_b) 433 399 { … … 448 414 #endif 449 415 } 450 451 #ifdef HAVE_RING2TOM_OLD452 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 OLIVER459 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 #endif468 416 469 417 static inline BOOLEAN _p_LmDivisibleBy(poly a, poly b, ring r) … … 494 442 } 495 443 496 #ifdef HAVE_RING2TOM_OLD497 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 #endif506 507 444 PINLINE1 BOOLEAN p_DivisibleBy(poly a, poly b, ring r) 508 445 { … … 548 485 #endif 549 486 } 550 551 #ifdef HAVE_RING2TOM_OLD552 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_DEBUG558 _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 #else568 return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);569 #endif570 }571 #endif572 487 573 488 PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, ring r_a, -
kernel/p_Numbers.h
r6d6383b rd772c3 4 4 /*************************************************************** 5 5 * File: p_Numbers.h 6 * Purpose: macros/inline functions for number o erations6 * Purpose: macros/inline functions for number operations 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: p_Numbers.h,v 1. 2 2007-05-10 08:12:42wienand Exp $9 * Version: $Id: p_Numbers.h,v 1.3 2008-01-30 09:01:37 wienand Exp $ 10 10 *******************************************************************/ 11 11 #ifndef P_NUMBERS_H -
kernel/p_Procs_Impl.h
r6d6383b rd772c3 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_Procs_Impl.h,v 1. 7 2007-05-10 08:12:42wienand Exp $9 * Version: $Id: p_Procs_Impl.h,v 1.8 2008-01-30 09:01:38 wienand Exp $ 10 10 *******************************************************************/ 11 11 #ifndef P_PROCS_IMPL_H … … 89 89 90 90 // 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) 92 92 #ifdef HAVE_RINGS 93 93 #define ZP_COPY_FIELD(field) \ 94 (field == FieldZp || field == FieldGF || field == FieldR || field == RingGeneral)94 (field == FieldZp || field == FieldGF || field == FieldR) 95 95 #else 96 96 #define ZP_COPY_FIELD(field) \ -
kernel/polys.h
r6d6383b rd772c3 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys.h,v 1.1 4 2007-11-16 17:25:10 SingularExp $ */6 /* $Id: polys.h,v 1.15 2008-01-30 09:01:38 wienand Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate polynomials of the … … 252 252 #define pIsVector(p) (pGetComp(p)>0) 253 253 #define pGetVariables(p,e) p_GetVariables(p, e, currRing) 254 255 #ifdef HAVE_RINGS256 /*257 * Test stuff for dev OLIVER258 */259 260 // number nGetUnit(number k);261 #endif262 263 254 264 255 /*************************************************************** -
kernel/polys1.cc
r6d6383b rd772c3 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1. 29 2007-06-20 09:39:24wienand Exp $ */4 /* $Id: polys1.cc,v 1.30 2008-01-30 09:01:38 wienand Exp $ */ 5 5 6 6 /* … … 482 482 { 483 483 #ifdef HAVE_RINGS 484 if (rField_is_Ring(currRing)) { 484 if (rField_is_Ring(currRing)) 485 { 485 486 if ((ph!=NULL) && rField_has_Units(currRing)) 486 487 { … … 498 499 nDelete(&k); 499 500 } 500 return; 501 } 502 return; //TODO OLIVER 501 } 502 return; 503 503 } 504 504 #endif -
kernel/ring.cc
r6d6383b rd772c3 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1.7 0 2007-11-09 11:29:44 SingularExp $ */4 /* $Id: ring.cc,v 1.71 2008-01-30 09:01:38 wienand Exp $ */ 5 5 6 6 /* … … 269 269 } 270 270 } 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 271 289 else 272 290 {
Note: See TracChangeset
for help on using the changeset viewer.