Changeset d4cb43b in git
- Timestamp:
- Jan 30, 2002, 3:33:07 PM (22 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- c658ed43f0faca30bee15dba7bad146606a58727
- Parents:
- 70981176bc24302d6a91e9beb7523f2aec93937a
- Location:
- Singular
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/kstd1.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd1.cc,v 1.8 5 2001-08-28 11:49:48Singular Exp $ */4 /* $Id: kstd1.cc,v 1.86 2002-01-30 14:33:01 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 682 682 * in the case of looking for the pure powers 683 683 */ 684 int posInL10 ( LSet const set, int length, LObject* p,kStrategy conststrat)684 int posInL10 (const LSet set,const int length, LObject* p,const kStrategy strat) 685 685 { 686 686 int j,dp,dL; -
Singular/kstd2.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1.7 5 2001-08-27 14:47:05Singular Exp $ */4 /* $Id: kstd2.cc,v 1.76 2002-01-30 14:33:02 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 33 33 // number of first divisor, otherwise 34 34 int kFindDivisibleByInT(const TSet &T, const unsigned long* sevT, 35 const int tl, const LObject* L, int start)35 const int tl, const LObject* L, const int start) 36 36 { 37 37 unsigned long not_sev = ~L->sev; … … 601 601 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart); 602 602 603 // reduce the tail and norma ilze poly603 // reduce the tail and normalize poly 604 604 if (TEST_OPT_INTSTRATEGY) 605 605 { -
Singular/longalg.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: longalg.cc,v 1.6 3 2002-01-10 12:33:21Singular Exp $ */4 /* $Id: longalg.cc,v 1.64 2002-01-30 14:33:02 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: algebraic numbers … … 52 52 static number (*nacGcd)(number a, number b, const ring r); 53 53 static number (*nacLcm)(number a, number b, const ring r); 54 static void (*nacDelete)(number *a, ring r);54 static void (*nacDelete)(number *a, const ring r); 55 55 number (*nacInit)(int i); 56 56 static int (*nacInt)(number &n); … … 253 253 } 254 254 255 void nap_Delete(napoly *p, ring r)255 void nap_Delete(napoly *p, const ring r) 256 256 { 257 257 napoly w, h = *p; … … 1370 1370 * deletes p 1371 1371 */ 1372 void naDelete(number *p, ring r)1372 void naDelete(number *p, const ring r) 1373 1373 { 1374 1374 lnumber l = (lnumber) * p; … … 2061 2061 * result =gcd(a,b) 2062 2062 */ 2063 number naGcd(number a, number b, ring r)2063 number naGcd(number a, number b, const ring r) 2064 2064 { 2065 2065 lnumber x, y; … … 2355 2355 * and in result->z the lcm(a->z,b->n) 2356 2356 */ 2357 number naLcm(number la, number lb, ring r)2357 number naLcm(number la, number lb, const ring r) 2358 2358 { 2359 2359 lnumber result; -
Singular/longalg.h
r7098117 rd4cb43b 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: longalg.h,v 1.2 8 2002-01-10 12:33:22Singular Exp $ */6 /* $Id: longalg.h,v 1.29 2002-01-30 14:33:03 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: algebraic numbers … … 47 47 #define napLength(p) pLength((poly)p) 48 48 napoly napNeg(napoly a); 49 void naDelete (number *p, ring r);49 void naDelete (number *p, const ring r); 50 50 #else /* LONGALGNEW */ 51 51 void naDelete (number *p, const ring r); -
Singular/misc.cc
r7098117 rd4cb43b 303 303 { 304 304 char * name; 305 intsetval;306 intresetval;305 unsigned setval; 306 unsigned resetval; 307 307 }; 308 308 … … 701 701 else 702 702 PrintLn(); 703 } 703 } 704 704 hh=IDNEXT(hh); 705 705 } … … 726 726 Print("%s::%s, typ %s level %d data %x\n", 727 727 IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2),IDDATA(h2)); 728 } 728 } 729 729 h2=IDNEXT(h2); 730 730 } -
Singular/mpr_base.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpr_base.cc,v 1.2 7 2001-08-27 14:47:12Singular Exp $ */4 /* $Id: mpr_base.cc,v 1.28 2002-01-30 14:33:04 Singular Exp $ */ 5 5 6 6 /* … … 2445 2445 } 2446 2446 2447 resVector *resMatrixDense::getMVector( int i)2447 resVector *resMatrixDense::getMVector(const int i) 2448 2448 { 2449 2449 assume( i >= 0 && i < numVectors ); … … 3160 3160 } 3161 3161 3162 int uResultant::nextPrime( int i )3162 int uResultant::nextPrime( const int i ) 3163 3163 { 3164 3164 int init=i; 3165 i +=2;3166 int j= IsPrime( i );3165 int ii=i+2; 3166 int j= IsPrime( ii ); 3167 3167 while ( j <= init ) 3168 3168 { 3169 i +=2;3170 j= IsPrime( i );3169 ii+=2; 3170 j= IsPrime( ii ); 3171 3171 } 3172 3172 return j; -
Singular/numbers.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: numbers.cc,v 1.4 3 2001-08-24 14:10:09Singular Exp $ */4 /* $Id: numbers.cc,v 1.44 2002-01-30 14:33:04 Singular Exp $ */ 5 5 6 6 /* … … 79 79 int ndParDeg(number n) { return 0; } 80 80 81 number ndGcd(number a, number b, ring r) { return r->cf->nInit(1); }81 number ndGcd(number a, number b, const ring r) { return r->cf->nInit(1); } 82 82 83 83 number ndIntMod(number a, number b) { return nInit(0); } -
Singular/numbers.h
r7098117 rd4cb43b 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: numbers.h,v 1.2 7 2001-03-22 19:11:08Singular Exp $ */6 /* $Id: numbers.h,v 1.28 2002-01-30 14:33:05 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: interface to coefficient aritmetics … … 70 70 void ndDelete(number* d, const ring r); 71 71 void nDummy2(number &d); 72 number ndGcd(number a, number b );72 number ndGcd(number a, number b, const ring r); 73 73 number ndCopy(number a); 74 74 number nd_Copy(number a, ring r); -
Singular/pInline0.h
r7098117 rd4cb43b 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline0.h,v 1. 8 2001-08-27 14:47:20Singular Exp $9 * Version: $Id: pInline0.h,v 1.9 2002-01-30 14:33:05 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE0_H … … 112 112 } 113 113 114 BOOLEAN p_IsConstantPoly( poly p,ring r)114 BOOLEAN p_IsConstantPoly(const poly p, const ring r) 115 115 { 116 while(p!=NULL) 116 poly pp=p; 117 while(pp!=NULL) 117 118 { 118 if (! p_LmIsConstantComp(p , r))119 if (! p_LmIsConstantComp(pp, r)) 119 120 return FALSE; 120 pIter(p );121 pIter(pp); 121 122 } 122 123 return TRUE; … … 182 183 183 184 #endif // PINLINE_CC 185 -
Singular/p_Procs_Generate.cc
r7098117 rd4cb43b 8 8 * Author: obachman (Olaf Bachmann) 9 9 * Created: 8/00 10 * Version: $Id: p_Procs_Generate.cc,v 1. 5 2001-08-27 14:47:28Singular Exp $10 * Version: $Id: p_Procs_Generate.cc,v 1.6 2002-01-30 14:33:05 Singular Exp $ 11 11 *******************************************************************/ 12 12 … … 243 243 #ifdef p_Procs_Static 244 244 int j; 245 printf(" 246 /*************************************************************** 247 Names of procs for RDEBUG */248 #ifdef RDEBUG\n");245 printf("\n" 246 "/***************************************************************\n" 247 "Names of procs for RDEBUG */\n" 248 "#ifdef RDEBUG\n"); 249 249 250 250 for (i=0; i<p_Unknown_Proc; i++) … … 264 264 printf("\n};\n"); 265 265 } 266 printf(" 267 #endif // RDEBUG 268 269 270 /***************************************************************/ 271 /* Tables for lookup of procedures: */\n"); 266 printf("\n #endif // RDEBUG\n\n" 267 "/***************************************************************/\n" 268 "/* Tables for lookup of procedures: */\n"); 272 269 273 270 for (i=0; i<p_Unknown_Proc; i++) -
Singular/p_Procs_Impl.h
r7098117 rd4cb43b 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 12/00 9 * Version: $Id: p_Procs_Impl.h,v 1. 6 2001-10-09 16:36:16Singular Exp $9 * Version: $Id: p_Procs_Impl.h,v 1.7 2002-01-30 14:33:05 Singular Exp $ 10 10 *******************************************************************/ 11 11 #ifndef P_PROCS_IMPL_H … … 13 13 14 14 /*************************************************************** 15 * 15 * 16 16 * Configurations 17 * 17 * 18 18 *******************************************************************/ 19 19 20 20 /*************************************************************** 21 21 Here is how it works: 22 At run-time, SetProcs is used to choose the appropriate PolyProcs 22 At run-time, SetProcs is used to choose the appropriate PolyProcs 23 23 based on the ring properies. 24 At generate-time, SetProcs is used to generate all 24 At generate-time, SetProcs is used to generate all 25 25 possible PolyProcs. 26 Which PolyProcs are generated/used can be controled by values of 26 Which PolyProcs are generated/used can be controled by values of 27 27 HAVE_FAST_P_PROCS, HAVE_FAST_LENGTH, HAVE_FAST_ORD, and FAST_FIELD 28 28 29 29 At generate-time, the file p_Procs.inc is generated, 30 30 which provides implementations of the p_Procs, based on … … 32 32 macros. 33 33 34 At run-time, a fast proc is set/choosen if found/generated, else 34 At run-time, a fast proc is set/choosen if found/generated, else 35 35 a general proc is set/choosen. 36 36 *******************************************************************/ … … 52 52 // 2 -- plus special cases for FieldQ 53 53 // nothing else is implemented, yet 54 #ifndef HAVE_FAST_FIELD 54 #ifndef HAVE_FAST_FIELD 55 55 #define HAVE_FAST_FIELD 0 56 56 #endif … … 62 62 // 3 -- special cases for length <= 4 63 63 // 4 -- special cases for length <= 8 64 #ifndef HAVE_FAST_LENGTH 64 #ifndef HAVE_FAST_LENGTH 65 65 #define HAVE_FAST_LENGTH 0 66 66 #endif … … 72 72 // 3 -- special ords for with n_min <= 3 73 73 // 4 -- special for all ords 74 #ifndef HAVE_FAST_ORD 74 #ifndef HAVE_FAST_ORD 75 75 #define HAVE_FAST_ORD 0 76 76 #endif 77 77 78 78 // Define HAVE_FAST_ZERO_ORD to: 79 // 0 -- no zero ords are considered 79 // 0 -- no zero ords are considered 80 80 // 1 -- only ZeroOrds for OrdPosNomogPosZero, OrdNomogPosZero, OrdPomogNegZero 81 81 // 2 -- ZeroOrds for all 82 #ifndef HAVE_FAST_ZERO_ORD 82 #ifndef HAVE_FAST_ZERO_ORD 83 83 #define HAVE_FAST_ZERO_ORD 0 84 84 #endif … … 94 94 95 95 /*************************************************************** 96 * 96 * 97 97 * Definitions of our fields, lengths, ords, procs we work with 98 * 98 * 99 99 *******************************************************************/ 100 100 … … 106 106 { 107 107 FieldGeneral = 0, 108 FieldZp, 108 FieldZp, 109 109 FieldQ, 110 110 FieldR, … … 117 117 #endif 118 118 FieldUnknown 119 } ;119 } p_Field; 120 120 typedef enum p_Length // Length of exponent vector in words 121 121 { 122 122 LengthGeneral = 0, // n >= 1 123 LengthEight, // n == 8 123 LengthEight, // n == 8 124 124 LengthSeven, 125 125 LengthSix, … … 130 130 LengthOne, 131 131 LengthUnknown 132 } ;133 typedef enum p_Ord 134 { 135 OrdGeneral = 0, 136 // ordsgn 132 } p_Length; 133 typedef enum p_Ord 134 { 135 OrdGeneral = 0, 136 // ordsgn 137 137 // 0 1 i n-1 n n_min Example 138 138 OrdPomog, // + + + + + 1 (lp,C) … … 172 172 173 173 OrdUnknown 174 } ;174 } p_Ord; 175 175 176 176 typedef enum p_Proc … … 192 192 p_kBucketSetLm_Proc, 193 193 p_Unknown_Proc 194 } ;194 } p_Proc; 195 195 196 196 static inline char* p_FieldEnum_2_String(p_Field field) … … 199 199 { 200 200 case FieldGeneral: return "FieldGeneral"; 201 case FieldZp: return "FieldZp"; 201 case FieldZp: return "FieldZp"; 202 202 case FieldQ: return "FieldQ"; 203 203 case FieldR: return "FieldR"; … … 218 218 switch(length) 219 219 { 220 case LengthGeneral: return "LengthGeneral"; 221 case LengthEight: return "LengthEight"; 220 case LengthGeneral: return "LengthGeneral"; 221 case LengthEight: return "LengthEight"; 222 222 case LengthSeven: return "LengthSeven"; 223 223 case LengthSix: return "LengthSix"; … … 236 236 switch(ord) 237 237 { 238 case OrdGeneral: return "OrdGeneral"; 239 case OrdPomog: return "OrdPomog"; 240 case OrdNomog: return "OrdNomog"; 241 case OrdNegPomog: return "OrdNegPomog"; 242 case OrdPomogNeg: return "OrdPomogNeg"; 243 case OrdPosNomog: return "OrdPosNomog"; 244 case OrdNomogPos: return "OrdNomogPos"; 245 case OrdPosPosNomog: return "OrdPosPosNomog"; 246 case OrdPosNomogPos: return "OrdPosNomogPos"; 247 case OrdNegPosNomog: return "OrdNegPosNomog"; 238 case OrdGeneral: return "OrdGeneral"; 239 case OrdPomog: return "OrdPomog"; 240 case OrdNomog: return "OrdNomog"; 241 case OrdNegPomog: return "OrdNegPomog"; 242 case OrdPomogNeg: return "OrdPomogNeg"; 243 case OrdPosNomog: return "OrdPosNomog"; 244 case OrdNomogPos: return "OrdNomogPos"; 245 case OrdPosPosNomog: return "OrdPosPosNomog"; 246 case OrdPosNomogPos: return "OrdPosNomogPos"; 247 case OrdNegPosNomog: return "OrdNegPosNomog"; 248 248 #ifdef HAVE_LENGTH_DIFF 249 case OrdNegPomogZero: return "OrdNegPomogZero"; 250 case OrdPomogNegZero: return "OrdPomogNegZero"; 251 case OrdPomogZero: return "OrdPomogZero"; 252 case OrdNomogZero: return "OrdNomogZero"; 253 case OrdNomogPosZero: return "OrdNomogPosZero"; 254 case OrdPosNomogZero: return "OrdPosNomogZero"; 249 case OrdNegPomogZero: return "OrdNegPomogZero"; 250 case OrdPomogNegZero: return "OrdPomogNegZero"; 251 case OrdPomogZero: return "OrdPomogZero"; 252 case OrdNomogZero: return "OrdNomogZero"; 253 case OrdNomogPosZero: return "OrdNomogPosZero"; 254 case OrdPosNomogZero: return "OrdPosNomogZero"; 255 255 case OrdPosPosNomogZero: return "OrdPosPosNomogZero"; 256 256 case OrdPosNomogPosZero: return "OrdPosNomogPosZero"; … … 304 304 case p_Merge_q_Proc: 305 305 return 1; 306 306 307 307 default: 308 308 return 0; … … 318 318 case p_Neg_Proc: 319 319 return 0; 320 320 321 321 default: 322 322 return 1; 323 323 } 324 324 } 325 325 326 326 // returns string specifying the module into which the p_Proc 327 327 // should go … … 338 338 339 339 /*************************************************************** 340 * 341 * 340 * 341 * 342 342 * Deal with OrdZero 343 * 343 * 344 344 *******************************************************************/ 345 345 #ifdef HAVE_LENGTH_DIFF … … 365 365 case OrdPosPosNomogZero: return OrdPosPosNomog; 366 366 case OrdNegPosNomogZero: return OrdNegPosNomog; 367 default: 367 default: 368 368 if (strict) return OrdGeneral; 369 369 else if (ord == OrdPomogNegZero) return OrdPomogNeg; … … 384 384 385 385 /*************************************************************** 386 * 387 * Filters which are applied to field/length/ord, before a proc is 386 * 387 * Filters which are applied to field/length/ord, before a proc is 388 388 * choosen 389 * 389 * 390 390 *******************************************************************/ 391 391 #ifdef p_Procs_Static 392 static inline void StaticKernelFilter(p_Field &field, p_Length &length, 392 static inline void StaticKernelFilter(p_Field &field, p_Length &length, 393 393 p_Ord &ord, const p_Proc proc) 394 394 { … … 407 407 { 408 408 if (HAVE_FAST_P_PROCS >= 5) return; 409 409 410 410 if (HAVE_FAST_P_PROCS < 3 && field == FieldQ) 411 411 field = FieldGeneral; 412 412 413 413 if ((HAVE_FAST_P_PROCS == 0) || 414 414 (HAVE_FAST_P_PROCS <= 4 && field != FieldZp && field != FieldQ && … … 420 420 return; 421 421 } 422 if (HAVE_FAST_P_PROCS == 1 || 422 if (HAVE_FAST_P_PROCS == 1 || 423 423 (HAVE_FAST_P_PROCS == 4 && field != FieldZp && proc != p_Merge_q_Proc)) 424 424 ord = OrdGeneral; … … 427 427 static inline void FastFieldFilter(p_Field &field) 428 428 { 429 if (HAVE_FAST_FIELD <= 0 || 429 if (HAVE_FAST_FIELD <= 0 || 430 430 (HAVE_FAST_FIELD == 1 && field != FieldZp) || 431 431 (field != FieldZp && field != FieldQ)) 432 432 field = FieldGeneral; 433 433 } 434 434 435 435 static inline void FastLengthFilter(p_Length &length) 436 436 { … … 457 457 if (IsZeroOrd(ord)) 458 458 { 459 if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero && 460 ord != OrdNomogPosZero && 459 if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero && 460 ord != OrdNomogPosZero && 461 461 ord != OrdPomogNegZero)) || 462 462 (HAVE_FAST_ZERO_ORD <= 0)) … … 484 484 } 485 485 486 static inline void pp_Mult_mm_Noether_Filter(p_Field &field, 486 static inline void pp_Mult_mm_Noether_Filter(p_Field &field, 487 487 p_Length &length, p_Ord &ord) 488 488 { 489 if (ord == OrdPomog 489 if (ord == OrdPomog 490 490 || ord == OrdPomogZero 491 || (ord == OrdPomogNeg && length > LengthTwo) 491 || (ord == OrdPomogNeg && length > LengthTwo) 492 492 #ifdef HAVE_LENGTH_DIFF 493 493 || (ord == OrdPomogZero) … … 502 502 } 503 503 } 504 505 static inline void FastProcFilter(p_Proc proc, p_Field &field, 504 505 static inline void FastProcFilter(p_Proc proc, p_Field &field, 506 506 p_Length &length, p_Ord &ord) 507 507 { … … 512 512 p_Add_q__Filter(length, ord); 513 513 break; 514 514 515 515 case p_Copy_Proc: 516 516 case p_Delete_Proc: 517 517 NCopy__Filter(field); 518 518 break; 519 519 520 520 case pp_Mult_mm_Noether_Proc: 521 521 pp_Mult_mm_Noether_Filter(field, length, ord); … … 531 531 } 532 532 break; 533 533 534 534 default: break; 535 535 } … … 554 554 ord > ORD_MAX_N_3) // i.e. OrdNomogPosZero and below 555 555 return 0; 556 556 557 557 if (length >= LengthTwo && // i.e. 1 or 2 558 558 ord > ORD_MAX_N_2) // i.e. PosNomog and below 559 559 return 0; 560 560 561 if (length == LengthOne && 561 if (length == LengthOne && 562 562 ord > ORD_MAX_N_1) // i.e. PosPomogZero and below 563 563 return 0; … … 569 569 } 570 570 571 571 572 572 static inline int index(p_Length length, p_Ord ord) 573 573 { … … 593 593 case p_Neg_Proc: 594 594 return field; 595 595 596 596 case p_ShallowCopyDelete_Proc: 597 597 return length; 598 598 599 599 case p_Copy_Proc: 600 600 case pp_Mult_mm_Proc: … … 610 610 case p_kBucketSetLm_Proc: 611 611 return index(field, length, ord); 612 612 613 613 case p_Merge_q_Proc: 614 614 return index(length, ord); 615 615 616 616 default: 617 617 assume(0); … … 623 623 624 624 /*************************************************************** 625 * 626 * Macros for setting procs -- these are used for 625 * 626 * Macros for setting procs -- these are used for 627 627 * generation and setting 628 628 * … … 639 639 } \ 640 640 while (0) \ 641 641 642 642 #define SetProcs(field, length, ord) \ 643 643 do \ -
Singular/syz2.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz2.cc,v 1.2 3 2001-08-27 14:47:42Singular Exp $ */4 /* $Id: syz2.cc,v 1.24 2002-01-30 14:33:06 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 82 82 while ((l>0) && ((syzstr->resPairs[index])[l-1].lcm==NULL)) l--; 83 83 rr = l-1; 84 while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) || 84 while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) || 85 85 ((syzstr->resPairs[index])[rr].order>actdeg))) rr--; 86 r2 = rr+1; 86 r2 = rr+1; 87 87 while ((rr>=0) && ((syzstr->resPairs[index])[rr].order==actdeg) 88 88 && ((syzstr->resPairs[index])[rr].syzind<0)) … … 117 117 if (tcp!=NULL) 118 118 { 119 while ((tcp!=NULL) && 119 while ((tcp!=NULL) && 120 120 ((tcp->first_poly!=i)||(tcp->second_poly!=r1))) tcp = tcp->next; 121 121 } … … 128 128 j = 0; 129 129 while (j<i) 130 { 130 { 131 131 if (nP->m[j]!=NULL) 132 132 { … … 169 169 while ((ti<l) && (((syzstr->resPairs[index])[ti].ind1!=j)|| 170 170 ((syzstr->resPairs[index])[ti].ind2!=i))) ti++; 171 if (ti<l) 171 if (ti<l) 172 172 { 173 173 #ifdef SHOW_SPRFL … … 292 292 { 293 293 SObject tso; 294 memset(&tso,0,sizeof(tso)); 294 295 int l=(*syzstr->Tl)[index]; 295 296 … … 566 567 while (kk>=0) 567 568 { 568 if (toGo==0) 569 if (toGo==0) 569 570 { 570 571 while (kk>=0) … … 612 613 q = kBucketGetLm(syzstr->bucket); 613 614 j = 0; 614 while (j<kres) 615 while (j<kres) 615 616 { 616 if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q)) 617 if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q)) 617 618 && ((redset[j].ind1!=tso.ind1) || (redset[j].ind2!=tso.ind2))) 618 619 { … … 756 757 i = 0; 757 758 delete spl1; 758 spl1 = ivStrip(spl2); 759 spl1 = ivStrip(spl2); 759 760 delete spl2; 760 761 if (spl1!=NULL) … … 763 764 kk = (*spl1)[i]-1; 764 765 } 765 } 766 } 766 767 #endif 767 768 #ifdef USE_HEURISTIC2 … … 914 915 for (i=1;i<=syzstr->length;i++) 915 916 { 916 if (!idIs0(syzstr->orderedRes[i])) 917 if (!idIs0(syzstr->orderedRes[i])) 917 918 { 918 919 toreor = syzstr->orderedRes[i]; … … 927 928 toreor->m[j] = NULL; 928 929 } 929 m = 0; 930 m = 0; 930 931 for (j=0;j<togo;j++) 931 932 { … … 948 949 949 950 /*2 950 * the CoCoA-algorithm for free resolutions, using a formula 951 * the CoCoA-algorithm for free resolutions, using a formula 951 952 * for remaining pairs based on Hilbert-functions 952 953 */ … … 968 969 return syzstr; 969 970 } 970 971 971 972 // Creare dp,S ring and change to it 972 973 syzstr->syRing = rCurrRingAssure_dp_C(); … … 1082 1083 kBucketDestroy(&(syzstr->bucket)); 1083 1084 kBucketDestroy(&(syzstr->syz_bucket)); 1084 if (origR != syzstr->syRing) 1085 if (origR != syzstr->syRing) 1085 1086 rChangeCurrRing(origR); 1086 1087 else -
Singular/syz3.cc
r7098117 rd4cb43b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz3.cc,v 1. 9 2001-08-27 14:47:43Singular Exp $ */4 /* $Id: syz3.cc,v 1.10 2002-01-30 14:33:06 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions 7 7 */ 8 8 9 9 #include "mod2.h" 10 10 #include <mylimits.h> … … 33 33 #include "timer.h" 34 34 #include "matpol.h" 35 35 36 36 //#define SHOW_PROT 37 37 //#define SHOW_RED … … 53 53 int discard_pairs; 54 54 int short_pairs; 55 56 /*3 55 56 /*3 57 57 * assumes the ideals old_ideal and new_ideal to be homogeneous 58 58 * tests wether the new_ideal is a regular extension of the old_ideal … … 68 68 int i; 69 69 BOOLEAN isRegular=TRUE; 70 70 71 71 for (i=old_hilbs->length()+deg-1;i>=deg;i--) 72 72 (*shifted_old_hilbs)[i] = (*old_hilbs)[i-deg]; … … 90 90 return isRegular; 91 91 } 92 92 93 93 /*3 94 94 * shows the resolution stored in syzstr->orderedRes … … 97 97 { 98 98 int i=0; 99 99 100 100 while ((i<syzstr->length) && (!idIs0(syzstr->res[i]))) 101 101 { … … 108 108 } 109 109 } 110 110 111 111 /*3 112 112 * produces the next subresolution for a regular extension … … 123 123 pSetComp(w_gen,0); 124 124 pSetmComp(w_gen); 125 125 126 126 //syShowRes(syzstr); 127 127 neg_gen = pNeg(neg_gen); … … 131 131 pShift(&neg_gen,-1); 132 132 } 133 while (index>0) 133 while (index>0) 134 134 { 135 135 if (index%2==0) … … 203 203 ppMult_qq(current_repr->m[i],p)); 204 204 syzstr->orderedRes[index]->m[i+start] = pCopy(current_repr->m[i]); 205 syzstr->orderedRes[index]->m[i+start] = 205 syzstr->orderedRes[index]->m[i+start] = 206 206 pMult_mm(syzstr->orderedRes[index]->m[i+start],w_gen); 207 207 if ((*syzstr->Tl)[index]!=0) … … 215 215 if ((index==1) && ((i==IDELEMS(current_ideal) || 216 216 (totake[index-1]->m[i+1]==NULL)))) break; 217 totake[index]->m[i+start_ttk] = 217 totake[index]->m[i+start_ttk] = 218 218 pMult_mm(pCopy(totake[index-1]->m[i]),w_gen); 219 219 pShift(&totake[index]->m[i+start_ttk],current_tl); … … 234 234 //syShowRes(syzstr); 235 235 } 236 236 237 237 /*3 238 238 * proves the consistence of the pairset resPairs with the corresponding … … 243 243 { 244 244 int i=0; 245 246 while (i<length) 245 246 while (i<length) 247 247 { 248 248 if (resPairs[i].lcm!=NULL) … … 256 256 } 257 257 } 258 258 259 259 /*3 260 260 * cancels the weight monomials given by the leading terms of totake … … 268 268 resolvente res=syzstr->fullres; 269 269 poly p; 270 270 271 271 while ((syzIndex!=0) && (res[syzIndex]==NULL)) syzIndex--; 272 272 while (syzIndex>0) … … 301 301 } 302 302 } 303 303 304 304 /*3 305 305 * updates the pairset resPairs by generating all pairs including the … … 320 320 poly p=NULL; 321 321 SObject tso; 322 322 323 323 syInitializePair(&tso); 324 while ((og_elem<og_idel) && (old_generators->m[og_elem]!=NULL)) 324 while ((og_elem<og_idel) && (old_generators->m[og_elem]!=NULL)) 325 325 { 326 326 if ((index>0) && (pGetComp(old_generators->m[og_elem])<=crit_comp)) … … 399 399 int ti=0; 400 400 while ((ti<l) && (((*resPairs)[ti].ind1!=j1)|| ((*resPairs)[ti].ind2!=jj))) ti++; 401 if (ti<l) 401 if (ti<l) 402 402 { 403 403 if (TEST_OPT_PROT) Print("cc"); … … 470 470 idDelete(&pairs); 471 471 } 472 472 473 473 /*3 474 474 * performs the modification of a single reduction on the syzygy-level … … 481 481 pDelete(&p); 482 482 } 483 483 484 484 /*3 485 485 * normalizes the poly bucket by the ideal; … … 494 494 number n; 495 495 BOOLEAN isChanged=FALSE; 496 496 497 497 loop 498 498 { … … 511 511 return isChanged; 512 512 } 513 513 514 514 /*3 515 515 * a tail reduction for the syzygies yielding new generators … … 521 521 poly h,hn; 522 522 BOOLEAN dummy; 523 523 524 524 while ((i>0) && (red->m[i-1]==NULL)) i--; 525 525 i--; … … 570 570 return tored; 571 571 } 572 572 573 573 /*3 574 574 * the complete reduction of a single pair which is just stored 575 * in bucket and syz_bucket 575 * in bucket and syz_bucket 576 576 */ 577 577 static BOOLEAN syRedSyzPair(syStrategy syzstr,int index,int* g_l,int* orp_l) … … 583 583 number n; 584 584 BOOLEAN isChanged=FALSE; 585 585 586 586 loop 587 587 { … … 601 601 return isChanged; 602 602 } 603 603 604 604 /*3 605 605 * the tailreduction for generators (which includes the correction of … … 612 612 poly h,hn; 613 613 BOOLEAN dummy; 614 614 615 615 h = tso.p; 616 616 kBucketInit(syzstr->syz_bucket,tso.syz,*syzred_l); … … 642 642 assume(pLength(tso.p)==*tored_l); 643 643 } 644 644 645 645 /*3 646 646 * the reduction of a pair in the 0-th module 647 647 */ 648 static void redOnePair(SSet resPairs,int itso,int l, ideal syzygies, 648 static void redOnePair(SSet resPairs,int itso,int l, ideal syzygies, 649 649 int crit_comp, syStrategy syzstr,int index,ideal new_generators, 650 650 ideal new_repr,int * ogm_l,int * orp_l) … … 665 665 #endif 666 666 int syz_place=IDELEMS(syzygies); 667 667 668 668 while ((syz_place>0) && (syzygies->m[syz_place-1]==NULL)) syz_place--; 669 669 while ((ng_place>0) && (new_generators->m[ng_place-1]==NULL)) ng_place--; … … 690 690 #ifdef EXPERIMENT3 691 691 /*--- tests wether the product criterion applies --------------*/ 692 if ((index==0) && (old_generators->rank==1) && 692 if ((index==0) && (old_generators->rank==1) && 693 693 (pFDeg(tso.p1)+pFDeg(tso.p2)==tso.order)) 694 694 { … … 753 753 tso.syz = pAdd(p,tso.syz); 754 754 #ifdef EXPERIMENT2 755 if ((tso.syz!=NULL) && (pGetComp(tso.syz)<=crit_comp)) 755 if ((tso.syz!=NULL) && (pGetComp(tso.syz)<=crit_comp)) 756 756 { 757 757 /*--- breaks when the leading component is less than crit_comp ------*/ … … 778 778 loop 779 779 { 780 if (j>=og_idel) 780 if (j>=og_idel) 781 781 { 782 782 /*--- reduction with generators computed in this procedure ---*/ … … 795 795 break; 796 796 } 797 //if (syzp==NULL) 797 //if (syzp==NULL) 798 798 //assume(p==NULL); 799 //else 799 //else 800 800 //if (pGetComp(syzp)<=crit_comp) short_pairs++; 801 801 #endif … … 817 817 deleteP =TRUE; 818 818 } 819 //if (syzp==NULL) 819 //if (syzp==NULL) 820 820 //assume(p==NULL); 821 //else 821 //else 822 822 //if ((pGetComp(syzp)<=crit_comp) && (p!=NULL)) short_pairs++; 823 823 #endif … … 861 861 for (i=itso+1;i<l;i++) 862 862 { 863 if (resPairs[i].lcm!=NULL) 864 { 863 if (resPairs[i].lcm!=NULL) 864 { 865 865 if ((resPairs[i].ind1==toReplace-1)||(resPairs[i].ind2==toReplace-1)) 866 866 syDeletePair(&resPairs[i]); 867 else 867 else 868 868 { 869 869 if (resPairs[i].ind1>=toReplace) … … 930 930 syTestPairs(resPairs,l,old_generators); 931 931 } 932 932 933 933 /*3 934 934 * reduction of all pairs of a fixed degree of the 0-th module … … 943 943 int * orp_l=(int*)omAlloc0(IDELEMS(syzstr->orderedRes[index])*sizeof(int)); 944 944 int t1=IDELEMS(syzstr->res[index]),t2=IDELEMS(syzstr->orderedRes[index]); 945 946 for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--) 945 946 for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--) 947 947 { 948 948 if (syzstr->res[index]->m[j]!=NULL) 949 949 ogm_l[j] = pLength(syzstr->res[index]->m[j]); 950 950 } 951 for (j=IDELEMS(syzstr->orderedRes[index])-1;j>=0;j--) 951 for (j=IDELEMS(syzstr->orderedRes[index])-1;j>=0;j--) 952 952 { 953 953 if (syzstr->orderedRes[index]->m[j]!=NULL) … … 986 986 return FALSE; 987 987 } 988 988 989 989 /*3 990 990 * extends the standard basis old_generators with new_generators; … … 992 992 * assumes that the components of the new_generators are sperated 993 993 * from those of old_generators, i.e. whenever the leading term 994 * of a syzygy lies in the part of the old_generators, the syzygy 995 * lie just in the module old_generators 994 * of a syzygy lies in the part of the old_generators, the syzygy 995 * lie just in the module old_generators 996 996 * assumes that the new_generators are reduced w.r.t. old_generators 997 997 */ … … 1002 1002 int l_pairs=2*og_idel; 1003 1003 ideal syzygies=idInit(16,syzstr->res[index]->rank+1); 1004 ideal result;1005 1004 if ((idIs0(new_generators)) || (new_generators->m[0]==NULL)) 1006 1005 { 1007 1006 Werror("Hier ist was faul!\n"); 1008 return result;1007 return NULL; 1009 1008 } 1010 1009 SSet resPairs=(SSet)omAlloc0(l_pairs*sizeof(SObject)); … … 1019 1018 return syzygies; 1020 1019 } 1021 1020 1022 1021 /*3 1023 1022 * normalizes the incoming generators … … 1030 1029 poly p = kBucketGetLm(syzstr->bucket),result; 1031 1030 number n; 1032 1031 1033 1032 loop 1034 1033 { … … 1047 1046 return result; 1048 1047 } 1049 1048 1050 1049 /*3 1051 1050 * updates the pairs inthe higher modules … … 1060 1059 poly p=NULL; 1061 1060 SObject tso; 1062 1061 1063 1062 syInitializePair(&tso); 1064 1063 while ((l>0) && ((*resPairs)[l-1].lcm==NULL)) l--; … … 1099 1098 int ti=0; 1100 1099 while ((ti<l) && (((*resPairs)[ti].ind1!=j1)|| ((*resPairs)[ti].ind2!=j))) ti++; 1101 if (ti<l) 1100 if (ti<l) 1102 1101 { 1103 1102 if (TEST_OPT_PROT) Print("cc"); … … 1171 1170 idDelete(&pairs); 1172 1171 } 1173 1172 1174 1173 /*3 1175 1174 * reduction of a single pair in the higher moduls 1176 1175 */ 1177 static void redOnePairHIndex(SSet resPairs,int itso, int crit_comp, 1176 static void redOnePairHIndex(SSet resPairs,int itso, int crit_comp, 1178 1177 syStrategy syzstr,int index,ideal add_generators, ideal add_repr, 1179 1178 ideal new_generators, ideal new_repr,int * next_place_add,int ** g_l, … … 1190 1189 poly syzp; 1191 1190 #endif 1192 1191 1193 1192 assume (tso.ind1<*next_place_add); 1194 1193 assume (tso.ind2<*next_place_add); … … 1363 1362 syDeletePair(&resPairs[itso]); 1364 1363 } 1365 1364 1366 1365 /*3 1367 1366 * reduction of all pairs of a fixed degree of a fixed module … … 1375 1374 int i=0,j; 1376 1375 poly deg_soc; 1377 1376 1378 1377 if (TEST_OPT_PROT) 1379 1378 Print("(%d,%d)",index,resPairs[0].order); … … 1395 1394 return TRUE; 1396 1395 } 1397 1396 1398 1397 /*3 1399 1398 * we proceed the generators of the next module; 1400 1399 * they are stored in add_generators and add_repr; 1401 * if the normal form of a new genrators w.r.t. add_generators has 1400 * if the normal form of a new genrators w.r.t. add_generators has 1402 1401 * pGetComp<crit_comp it is skipped from the reduction; 1403 * new_generators and new_repr (which are empty) stores the result of the 1402 * new_generators and new_repr (which are empty) stores the result of the 1404 1403 * reduction which is normalized afterwards 1405 1404 */ … … 1418 1417 BOOLEAN pairs_left; 1419 1418 SSet resPairs=(SSet)omAlloc0(l_pairs*sizeof(SObject)); 1420 1419 1421 1420 for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--) 1422 1421 { … … 1437 1436 if (syzstr->regularity>0) 1438 1437 { 1439 if (next_deg >= syzstr->regularity+index) 1438 if (next_deg >= syzstr->regularity+index) 1440 1439 { 1441 1440 while ((i<idel_temp) && (temp_generators->m[i]!=NULL)) … … 1471 1470 pEnlargeSet(&add_generators->m,IDELEMS(add_generators),16); 1472 1471 pEnlargeSet(&add_repr->m,IDELEMS(add_repr),16); 1473 gen_length = (int*)omRealloc0Size((ADDRESS)gen_length, IDELEMS(add_generators)*sizeof(int), 1472 gen_length = (int*)omRealloc0Size((ADDRESS)gen_length, IDELEMS(add_generators)*sizeof(int), 1474 1473 (IDELEMS(add_generators)+16)*sizeof(int)); 1475 1474 IDELEMS(add_generators) += 16; … … 1530 1529 omFreeSize((ADDRESS)secgen_length,IDELEMS(syzstr->res[index])*sizeof(int)); 1531 1530 } 1532 1531 1533 1532 /*3 1534 1533 * normalizes the part of the next reduction lying within the block … … 1544 1543 number n; 1545 1544 int * g_l=(int*)omAlloc0(IDELEMS(old_generators)*sizeof(int)); 1546 1545 1547 1546 for (i=0;i<IDELEMS(old_generators);i++) 1548 1547 { … … 1552 1551 } 1553 1552 } 1554 for (i=IDELEMS(new_generators)-1;i>=0;i--) 1553 for (i=IDELEMS(new_generators)-1;i>=0;i--) 1555 1554 { 1556 1555 if (new_generators->m[i]!=NULL) … … 1564 1563 { 1565 1564 if ((j>=ii) || (p==NULL)) break; 1566 if ((old_generators->m[j]!=NULL) && 1565 if ((old_generators->m[j]!=NULL) && 1567 1566 (pDivisibleBy(old_generators->m[j],p))) 1568 1567 { … … 1592 1591 return result; 1593 1592 } 1594 1593 1595 1594 /*3 1596 1595 * constructs the new subresolution for a nonregular extension … … 1664 1663 return normalizeOldPart(new_generators,new_repr,syzstr,index,next_comp); 1665 1664 } 1666 1665 1667 1666 /* 1668 1667 * this procedure assumes that the first order is C !!! … … 1693 1692 int ng_idel=IDELEMS(new_generators); 1694 1693 ideal new_repr =idInit(ng_idel, crit_comp+ng_idel); 1695 1694 1696 1695 if (index==0) 1697 1696 { … … 1752 1751 return result; 1753 1752 } 1754 1753 1755 1754 /* 1756 1755 * main call of the extended Koszul-resolution … … 1765 1764 tHomog hom=isNotHomog; 1766 1765 BOOLEAN isRegular; 1767 1766 1768 1767 discard_pairs = 0; 1769 1768 short_pairs = 0; … … 1922 1921 new_generators = temp_gens; 1923 1922 #ifdef ONLY_STD 1924 break; 1923 break; 1925 1924 #endif 1926 1925 if (idIs0(new_generators)) break; -
Singular/tok.h
r7098117 rd4cb43b 7 7 * ABSTRACT: tokens, types for interpreter; general macros 8 8 */ 9 /* $Id: tok.h,v 1.5 1 2001-08-27 14:47:44Singular Exp $ */9 /* $Id: tok.h,v 1.52 2002-01-30 14:33:07 Singular Exp $ */ 10 10 11 11 #ifndef MYYSTYPE … … 119 119 RESERVEDNAME_CMD, 120 120 RESULTANT_CMD, 121 RINGLIST_CMD,122 121 ROWS_CMD, 123 122 SIMPLEX_CMD, … … 157 156 */ 158 157 159 #define Sy_bit(x) ( 1<<(x))158 #define Sy_bit(x) ((unsigned)1<<(x)) 160 159 #define Sy_inset(x,s) ((Sy_bit(x)&(s))?TRUE:FALSE) 161 160 #define BTEST1(a) Sy_inset((a), test) … … 205 204 #define OPT_WEIGHTM 31 206 205 207 /* define ring dependent options */ 206 /* define ring dependent options */ 208 207 #define TEST_RINGDEP_OPTS \ 209 208 (Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTHROUGH) | Sy_bit(OPT_REDTAIL))
Note: See TracChangeset
for help on using the changeset viewer.