Changeset a9c298 in git
- Timestamp:
- Nov 20, 2013, 4:54:25 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
- Children:
- 0de0509972719531e2a4b51ec9fd0e44a66fd2fd
- Parents:
- e4014563a82388c4b39dfa37db24cbe159b24a35
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-11-20 16:54:25+01:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-11-20 16:54:42+01:00
- Files:
-
- 72 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Cache.h
re40145 ra9c298 76 76 */ 77 77 std::list<int> _rank; 78 78 79 79 /** 80 80 * _key is sorted in ascending order, i.e., … … 84 84 */ 85 85 std::list<KeyClass> _key; 86 86 87 87 /** 88 88 * _value captures the actual objects of interest;<br> … … 92 92 */ 93 93 std::list<ValueClass> _value; 94 94 95 95 /** 96 96 * container for the weights of all cached values 97 97 */ 98 98 std::list<int> _weights; 99 99 100 100 /** 101 101 * a pointer to some element of _key; … … 105 105 */ 106 106 mutable typename std::list<KeyClass>::const_iterator _itKey; 107 107 108 108 /** 109 109 * a pointer to some element of _value; … … 113 113 */ 114 114 mutable typename std::list<ValueClass>::const_iterator _itValue; 115 115 116 116 /** 117 117 * for storing the momentary weight of the given cache;<br> … … 121 121 */ 122 122 int _weight; 123 123 124 124 /** 125 125 * the bound for the number of cached <c>key --> value</c> pairs;<br> … … 129 129 */ 130 130 int _maxEntries; 131 131 132 132 /** 133 133 * the bound on total cache weight;<br> … … 137 137 */ 138 138 int _maxWeight; 139 139 140 140 /** 141 141 * A method for providing the index of a given key in the vector _key. … … 148 148 */ 149 149 int getIndexInKey (const KeyClass& key) const; 150 150 151 151 /** 152 152 * A method for providing the index of a given value in the vector _rank. … … 159 159 */ 160 160 int getIndexInRank (const ValueClass& value) const; 161 161 162 162 /** 163 163 * A method for shrinking the given cache so that it meet the bounds on … … 169 169 */ 170 170 bool shrink (const KeyClass& key); 171 171 172 172 /** 173 173 * A method for deleting the least-ranked cache entry. … … 184 184 */ 185 185 Cache(); 186 186 187 187 /** 188 188 * A destructor for class Cache. … … 191 191 */ 192 192 ~Cache(); 193 193 194 194 /** 195 195 * Copy implementation for class Cache. … … 198 198 */ 199 199 Cache (const Cache& c); 200 200 201 201 /** 202 202 * A user-suited constructor for class Cache. … … 210 210 */ 211 211 Cache (const int maxEntries, const int maxWeight); 212 212 213 213 /** 214 214 * A method for retrieving the momentary weight of the cache. … … 222 222 */ 223 223 int getWeight () const; 224 224 225 225 /** 226 226 * A method for retrieving the momentary number of (key --> value) pairs … … 232 232 */ 233 233 int getNumberOfEntries () const; 234 234 235 235 /** 236 236 * A method for retrieving the maximum number of (key --> value) pairs … … 241 241 */ 242 242 int getMaxNumberOfEntries () const; 243 243 244 244 /** 245 245 * A method for retrieving the maximum weight of the cache. … … 249 249 */ 250 250 int getMaxWeight () const; 251 251 252 252 /** 253 253 * Checks whether the cache contains a pair (k --> v) such that … … 264 264 */ 265 265 bool hasKey (const KeyClass& key) const; 266 266 267 267 /** 268 268 * Returns the value for a given key. … … 280 280 */ 281 281 ValueClass getValue (const KeyClass& key) const; 282 282 283 283 /** 284 284 * Inserts the pair (key --> value) in the cache. … … 301 301 */ 302 302 bool put (const KeyClass& key, const ValueClass& value); 303 303 304 304 /** 305 305 * Clears the cache so that it has no entry. This method will also … … 307 307 */ 308 308 void clear (); 309 309 310 310 /** 311 311 * A method for providing a printable version of the represented … … 315 315 */ 316 316 std::string toString () const; 317 317 318 318 /** 319 319 * A method for printing a string representation of the given cache to -
Singular/Minor.cc
re40145 ra9c298 13 13 14 14 void MinorKey::reset() 15 { 15 { 16 16 _numberOfRowBlocks = 0; 17 17 _numberOfColumnBlocks = 0; … … 59 59 for (int c = 0; c < _numberOfColumnBlocks; c++) 60 60 _columnKey[c] = mk.getColumnKey(c); 61 61 62 62 return *this; 63 63 } … … 707 707 if ((blockCount - 1 >= mkBlockIndex) && 708 708 (shiftedBit & this->getColumnKey(mkBlockIndex))) hitBits++; 709 else if (shiftedBit & currentInt) 709 else if (shiftedBit & currentInt) 710 710 { 711 711 newBitToBeSet = shiftedBit; -
Singular/Minor.h
re40145 ra9c298 187 187 */ 188 188 MinorKey& operator=(const MinorKey&); 189 189 190 190 /** 191 191 * just to make the compiler happy … … 411 411 */ 412 412 int _retrievals; 413 413 414 414 /** 415 415 * -1 iff cache is not used, otherwise the maximum number of potential … … 418 418 */ 419 419 int _potentialRetrievals; 420 420 421 421 /** 422 422 * a store for the actual number of multiplications to compute the current … … 424 424 */ 425 425 int _multiplications; 426 426 427 427 /** 428 428 * a store for the actual number of additions to compute the current minor 429 429 */ 430 430 int _additions; 431 431 432 432 /** 433 433 * a store for the accumulated number of multiplications to compute the … … 438 438 */ 439 439 int _accumulatedMult; 440 440 441 441 /** 442 442 * a store for the accumulated number of additions to compute the current … … 447 447 */ 448 448 int _accumulatedSum; 449 449 450 450 /** 451 451 * A method for obtaining a rank measure for the given MinorValue.<br> … … 463 463 */ 464 464 int rankMeasure1 () const; 465 465 466 466 /** 467 467 * A method for obtaining a rank measure for the given MinorValue.<br> … … 481 481 */ 482 482 int rankMeasure2 () const; 483 483 484 484 /** 485 485 * A method for obtaining a rank measure for the given MinorValue.<br> … … 498 498 */ 499 499 int rankMeasure3 () const; 500 500 501 501 /** 502 502 * A method for obtaining a rank measure for the given MinorValue.<br> … … 515 515 */ 516 516 int rankMeasure4 () const; 517 517 518 518 /** 519 519 * A method for obtaining a rank measure for the given MinorValue.<br> … … 532 532 */ 533 533 int rankMeasure5 () const; 534 534 535 535 /** 536 536 * private store for the current value ranking strategy; … … 538 538 */ 539 539 static int g_rankingStrategy; 540 540 541 541 /** 542 542 * Accessor for the static private field g_rankingStrategy. … … 548 548 */ 549 549 bool operator== (const MinorValue& mv) const; 550 550 551 551 /** 552 552 * just to make the compiler happy 553 553 */ 554 554 bool operator< (const MinorValue& mv) const; 555 555 556 556 /** 557 557 * A method for retrieving the weight of a given MinorValue. … … 566 566 */ 567 567 virtual int getWeight () const; 568 568 569 569 /** 570 570 * A method for accessing the number of retrievals of this minor. Multiple … … 575 575 */ 576 576 int getRetrievals () const; 577 577 578 578 /** 579 579 * A method for accessing the maximum number of potential retrievals of … … 585 585 */ 586 586 int getPotentialRetrievals () const; 587 587 588 588 /** 589 589 * A method for accessing the multiplications performed while computing … … 600 600 */ 601 601 int getMultiplications () const; 602 602 603 603 /** 604 604 * A method for accessing the multiplications performed while computing … … 613 613 */ 614 614 int getAccumulatedMultiplications () const; 615 615 616 616 /** 617 617 * A method for accessing the additions performed while computing this … … 636 636 */ 637 637 int getAccumulatedAdditions () const; 638 638 639 639 /** 640 640 * A method for incrementing the number of performed retrievals of \a this … … 654 654 */ 655 655 void incrementRetrievals (); 656 656 657 657 /** 658 658 * A method for obtaining a rank measure for theiven MinorValue.<br> … … 671 671 */ 672 672 int getUtility () const; 673 673 674 674 /** 675 675 * A method for determining the value ranking strategy.<br> … … 680 680 */ 681 681 static void SetRankingStrategy (const int rankingStrategy); 682 682 683 683 /** 684 684 * A method for providing a printable version of the represented MinorValue. … … 687 687 */ 688 688 virtual std::string toString () const; 689 689 690 690 /** 691 691 * A method for printing a string representation of the given MinorValue … … 756 756 */ 757 757 virtual ~IntMinorValue (); 758 758 759 759 /** 760 760 * Accessor for the private field _result. … … 762 762 */ 763 763 int getResult() const; 764 764 765 765 /** 766 766 * Accessor for the current weight of this class instance. … … 833 833 */ 834 834 void operator= (const PolyMinorValue& mv); 835 835 836 836 /** 837 837 * just to make the compiler happy … … 843 843 */ 844 844 virtual ~PolyMinorValue (); 845 845 846 846 /** 847 847 * Accessor for the private field _result. … … 849 849 */ 850 850 poly getResult() const; 851 851 852 852 /** 853 853 * Accessor for the current weight of this class instance. … … 855 855 */ 856 856 int getWeight () const; 857 857 858 858 /** 859 859 * A method for providing a printable version of the represented MinorValue. -
Singular/MinorInterface.h
re40145 ra9c298 21 21 "Laplace"; when a cache is used, the underlying algorithm 22 22 is automatically Laplace */ 23 23 24 24 /** 25 25 * Returns the specified set of minors (= subdeterminantes) of the -
Singular/MinorProcessor.cc
re40145 ra9c298 416 416 return getMinorPrivateBareiss(_minorSize, _minor, characteristic, iSB); 417 417 else assume(false); 418 418 419 419 /* The following code is never reached and just there to make the 420 420 compiler happy: */ … … 933 933 return getMinorPrivateBareiss(_minorSize, _minor, iSB); 934 934 else assume(false); 935 935 936 936 /* The following code is never reached and just there to make the 937 937 compiler happy: */ … … 1444 1444 complexity = 0; 1445 1445 while ((pp != NULL) && (complexity < minComplexity)) 1446 { 1446 { 1447 1447 complexity += nSize(pGetCoeff(pp)); pp = pNext(pp); 1448 1448 } -
Singular/blackbox.h
re40145 ra9c298 70 70 /// return the name to the type given by t (r/o) 71 71 const char * getBlackboxName(const int t); 72 /// used by scanner: returns ROOT_DECL for known types 72 /// used by scanner: returns ROOT_DECL for known types 73 73 /// (and the type number in @c tok) 74 74 int blackboxIsCmd(const char *n, int & tok); -
Singular/calcSVD.cc
re40145 ra9c298 62 62 failthreshold = amp::ampf<Precision>("5.0E-3"); 63 63 a.setbounds(1, max_i, 1, max_j); 64 65 64 65 66 66 // 67 67 // fill matrix a entries from M … … 80 80 ap::template_2d_array< amp::ampf<Precision> > vt; 81 81 ap::template_1d_array< amp::ampf<Precision> > w; 82 svd::svddecomposition<Precision>(a, max_i, max_j, 2, 2, 2, w, u, vt); 82 svd::svddecomposition<Precision>(a, max_i, max_j, 2, 2, 2, w, u, vt); 83 83 matrix Mu,Mw,Mvt; 84 84 Mu=mpNew(max_i,max_i); -
Singular/countedref.h
re40145 ra9c298 11 11 * 12 12 * @note This works was supported by the "Industrial Algebra" project. 13 * 13 * 14 14 * @par Copyright: 15 15 * (c) 2012 by The Singular Team, see LICENSE file … … 80 80 //} 81 81 82 /// Checking equality 82 /// Checking equality 83 83 bool operator==(const self& rhs) const { return m_ptr == rhs.m_ptr; } 84 84 … … 96 96 count_type count() const { return (*this? m_ptr->ref: 0); } 97 97 void reclaim() { if (*this) ++m_ptr->ref; } 98 void release() { 98 void release() { 99 99 if (*this && (--m_ptr->ref <= 0) && !nondestructive) 100 CountedRefPtr_kill(m_ptr); 100 CountedRefPtr_kill(m_ptr); 101 101 } 102 102 //@} … … 136 136 137 137 template <class PtrType> 138 class CountedRefIndirectPtr: 138 class CountedRefIndirectPtr: 139 139 public RefCounter { 140 140 public: … … 149 149 }; 150 150 151 template <class PtrType> 151 template <class PtrType> 152 152 inline void CountedRefPtr_kill(CountedRefIndirectPtr<PtrType>* pval) { delete pval; } 153 153 … … 184 184 //@{ 185 185 operator bool() const { return operator->(); } 186 self& operator=(const self& rhs) { 186 self& operator=(const self& rhs) { 187 187 m_indirect = rhs.m_indirect; 188 188 return *this; 189 189 } 190 190 self& operator=(ptr_type ptr) { 191 if (!m_indirect) 191 if (!m_indirect) 192 192 m_indirect = new CountedRefIndirectPtr<ptr_type>(ptr); 193 193 else … … 209 209 210 210 /** @class LeftvHelper 211 * This class implements some recurrent code sniplets to be used with 211 * This class implements some recurrent code sniplets to be used with 212 212 * @c leftv and @c idhdl.implements a refernce counter which we can use 213 213 **/ … … 286 286 public LeftvHelper { 287 287 typedef LeftvShallow self; 288 288 289 289 public: 290 290 /// Just allocate (all-zero) @c leftv … … 296 296 297 297 /// Destruct 298 ~LeftvShallow() { 298 ~LeftvShallow() { 299 299 recursivekill(m_data->e); 300 300 omFree(m_data); … … 324 324 /** @class LeftvDeep 325 325 * This class wraps @c leftv by taking into acount memory allocation, destruction 326 * as well as deeply copying of a given @c leftv, i.e. we also take over 326 * as well as deeply copying of a given @c leftv, i.e. we also take over 327 327 * ownership of the @c leftv data. 328 328 * … … 333 333 * @note It invalidats @c leftv on input. 334 334 **/ 335 class LeftvDeep: 335 class LeftvDeep: 336 336 public LeftvHelper { 337 337 typedef LeftvDeep self; … … 349 349 /// Store a deep copy of the data 350 350 /// @ note Occupies the provided @c leftv and invalidates the latter 351 LeftvDeep(leftv data): m_data(cpy(data)) { 352 data->e = NULL; // occupy subexpression 353 if(!isid()) m_data->data=data->CopyD(); 351 LeftvDeep(leftv data): m_data(cpy(data)) { 352 data->e = NULL; // occupy subexpression 353 if(!isid()) m_data->data=data->CopyD(); 354 354 } 355 355 … … 390 390 BOOLEAN brokenid(idhdl context) const { 391 391 assume(isid()); 392 return (context == NULL) || 392 return (context == NULL) || 393 393 ((context != (idhdl) m_data->data) && brokenid(IDNEXT(context))); 394 394 } -
Singular/eigenval_ip.cc
re40145 ra9c298 182 182 183 183 intvec *m0; 184 #ifdef HAVE_FACTORY185 184 ideal e0=singclap_factorize(mp_DetBareiss(M,currRing),&m0,2, currRing); 186 #else187 WarnS("cannot factorize due to missing module 'factory'");188 ideal e0=NULL;189 #endif190 191 185 if (e0==NULL) 192 186 { -
Singular/extra.cc
re40145 ra9c298 2181 2181 intvec* arg3 = (intvec*) h->next->next->Data(); 2182 2182 int arg4 = (int)(long) h->next->next->next->Data(); 2183 2183 2184 2184 ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4); 2185 2185 … … 2188 2188 2189 2189 return FALSE; 2190 } 2190 } 2191 2191 else 2192 2192 … … 3927 3927 p_poly* h= reinterpret_cast<p_poly*> (erg); 3928 3928 h->p_poly_print(); 3929 3929 3930 3930 return FALSE; 3931 3931 } -
Singular/iparith.cc
re40145 ra9c298 3038 3038 3039 3039 maxl--; 3040 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/ 3040 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/ 3041 3041 { 3042 3042 maxl = currRing->N-1+2*(iiOp==MRES_CMD); … … 3153 3153 3154 3154 maxl--; 3155 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/ 3155 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/ 3156 3156 { 3157 3157 maxl = currRing->N-1+2*(iiOp==MRES_CMD); … … 4367 4367 static BOOLEAN jjDIFF_COEF(leftv res, leftv u, leftv v) 4368 4368 { 4369 if (!nCoeff_is_transExt(currRing->cf)) 4370 { 4369 if (!nCoeff_is_transExt(currRing->cf)) 4370 { 4371 4371 WerrorS("differentiation not defined in the coefficient ring"); 4372 4372 return TRUE; -
Singular/ipassign.cc
re40145 ra9c298 502 502 static BOOLEAN jiA_1x1INTMAT(leftv res, leftv a,Subexpr e) 503 503 { 504 if (/*(*/ res->rtyp!=INTMAT_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type int */ 504 if (/*(*/ res->rtyp!=INTMAT_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type int */ 505 505 { 506 506 // no error message: assignment simply fails … … 524 524 static BOOLEAN jiA_1x1MATRIX(leftv res, leftv a,Subexpr e) 525 525 { 526 if (/*(*/ res->rtyp!=MATRIX_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type poly */ 526 if (/*(*/ res->rtyp!=MATRIX_CMD /*)*/) /*|| (e!=NULL) - TRUE because of type poly */ 527 527 { 528 528 // no error message: assignment simply fails … … 846 846 847 847 int lt=l->Typ(); 848 if (/*(*/ lt==0 /*)*/) /*&&(l->name!=NULL)*/ 848 if (/*(*/ lt==0 /*)*/) /*&&(l->name!=NULL)*/ 849 849 { 850 850 if (!errorreported) Werror("left side `%s` is undefined",l->Fullname()); -
Singular/ipshell.cc
re40145 ra9c298 5090 5090 else // (0/p, a, b, ..., z) 5091 5091 { 5092 if ((ch!=0) && (ch!=IsPrime(ch))) 5092 if ((ch!=0) && (ch!=IsPrime(ch))) 5093 5093 { 5094 5094 WerrorS("too many parameters"); -
Singular/locals.h
re40145 ra9c298 17 17 18 18 #if 0 19 extern "C" 19 extern "C" 20 20 { 21 21 void Print(char* fmt, ...); -
Singular/misc_ip.h
re40145 ra9c298 1 1 /*****************************************************************************\ 2 * Computer Algebra System SINGULAR 2 * Computer Algebra System SINGULAR 3 3 \*****************************************************************************/ 4 4 /** @file misc_ip.h 5 * 5 * 6 6 * This file provides miscellaneous functionality. 7 7 * -
Singular/mod_lib.h
re40145 ra9c298 2 2 #define MOD_LIB_H 3 3 4 // #include config.h 4 // #include config.h 5 5 #include <kernel/mod2.h> /* for EMBED_PYTHON, HAVE_MATHICGB */ 6 6 … … 10 10 11 11 12 #if HAVE_GFANLIB 12 #if HAVE_GFANLIB 13 13 #define SI_BUILTIN_GFANLIB(add) add(gfanlib) 14 14 #else 15 #define SI_BUILTIN_GFANLIB(add) 15 #define SI_BUILTIN_GFANLIB(add) 16 16 #endif 17 17 … … 21 21 //TODO: the line above means that syzextra should be staticly embedded IFF pyobjects do so :( 22 22 #else 23 #define SI_BUILTIN_PYOBJECT(add) 23 #define SI_BUILTIN_PYOBJECT(add) 24 24 #endif 25 25 … … 27 27 # define SI_BUILTIN_MATHIC(add) add(singmathic) 28 28 #else 29 # define SI_BUILTIN_MATHIC(add) 29 # define SI_BUILTIN_MATHIC(add) 30 30 #endif 31 31 -
Singular/omSingularConfig.h
re40145 ra9c298 3 3 * Purpose: declaration of External Config stuff for omalloc 4 4 * This file is inlcuded by omDefaultConfig.h, i.e., at the the time 5 * the omalloc library is built. Any changes to the default config 6 * of omalloc should be done here (and, of course, you need to 5 * the omalloc library is built. Any changes to the default config 6 * of omalloc should be done here (and, of course, you need to 7 7 * rebuilt the library). 8 8 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) -
Singular/pyobject.cc
re40145 ra9c298 66 66 ~PythonInterpreter() { if(m_owns_python) Py_Finalize(); } 67 67 68 /// Initialize unique (singleton) python interpreter instance, 68 /// Initialize unique (singleton) python interpreter instance, 69 69 /// and set Singular type identifier 70 70 static void init(id_type num) { instance().m_id = num; } 71 71 72 /// Get Singular type identitfier 72 /// Get Singular type identitfier 73 73 static id_type id() { return instance().m_id; } 74 74 … … 78 78 m_id(0), m_owns_python(false) { start_python(); } 79 79 80 /// Static initialization - 80 /// Static initialization - 81 81 /// safely takes care of destruction on program termination 82 static PythonInterpreter& instance() 82 static PythonInterpreter& instance() 83 83 { 84 84 static PythonInterpreter init_interpreter; … … 91 91 set_python_defaults(); 92 92 } 93 93 94 94 void init_python() 95 95 { … … 110 110 PyRun_SimpleString(cmd); 111 111 PyRun_SimpleString("del path"); // cleanup 112 } 112 } 113 113 114 114 id_type m_id; … … 131 131 132 132 PythonObject(): m_ptr(Py_None) { } 133 PythonObject(ptr_type ptr): m_ptr(ptr) { 133 PythonObject(ptr_type ptr): m_ptr(ptr) { 134 134 if (!ptr && handle_exception()) m_ptr = Py_None; 135 135 } 136 136 137 137 ptr_type check_context(ptr_type ptr) const { 138 if(ptr) sync_contexts(); 138 if(ptr) sync_contexts(); 139 139 return ptr; 140 140 } … … 175 175 176 176 /// Ternary operations 177 self operator()(int op, const self& arg1, const self& arg2) const 177 self operator()(int op, const self& arg1, const self& arg2) const 178 178 { 179 179 switch(op) 180 180 { 181 case ATTRIB_CMD: 181 case ATTRIB_CMD: 182 182 if(PyObject_SetAttr(*this, arg1, arg2) == -1) handle_exception(); 183 183 return self(); … … 210 210 211 211 void import_as(const char* name) const { 212 idhdl handle = enterid(omStrDup(name), 0, DEF_CMD, 212 idhdl handle = enterid(omStrDup(name), 0, DEF_CMD, 213 213 &IDROOT, FALSE); 214 214 … … 216 216 { 217 217 IDDATA(handle) = (char*)m_ptr; 218 Py_XINCREF(m_ptr); 218 Py_XINCREF(m_ptr); 219 219 IDTYP(handle) = PythonInterpreter::id(); 220 220 } … … 228 228 self attr(const self& arg) const { return PyObject_GetAttr(*this, arg); } 229 229 230 self del_attr(const self& arg) const 231 { 232 if (!PyObject_HasAttr(*this, arg)) 230 self del_attr(const self& arg) const 231 { 232 if (!PyObject_HasAttr(*this, arg)) 233 233 Werror("Cannot delete attribute %s.", arg.repr()); 234 234 else 235 PyObject_DelAttr(*this, arg); 236 235 PyObject_DelAttr(*this, arg); 236 237 237 return self(); 238 238 } … … 252 252 253 253 if(!PyErr_Occurred()) return FALSE; 254 254 255 255 PyObject *pType, *pMessage, *pTraceback; 256 256 PyErr_Fetch(&pType, &pMessage, &pTraceback); 257 257 258 258 WerrorS("pyobject error occured"); 259 259 WerrorS(PyString_AsString(pMessage)); 260 260 261 261 Py_XDECREF(pType); 262 262 Py_XDECREF(pMessage); 263 263 Py_XDECREF(pTraceback); 264 264 265 265 PyErr_Clear(); 266 266 return TRUE; … … 277 277 int py_opid(int op) const{ 278 278 switch(op) 279 { 279 { 280 280 case '<': return Py_LT; 281 281 case '>': return Py_GT; 282 282 case EQUAL_EQUAL: return Py_EQ; 283 283 case NOTEQUAL: return Py_NE; 284 case GE: return Py_GE; 285 case LE: return Py_LE; 284 case GE: return Py_GE; 285 case LE: return Py_LE; 286 286 } 287 287 return -1; … … 315 315 * compile-time. 316 316 * 317 * @note The Singular objects are assumed to be equivalent to the template argument. 317 * @note The Singular objects are assumed to be equivalent to the template argument. 318 318 **/ 319 319 template <class CastType = PythonObject::ptr_type> … … 365 365 { 366 366 if (typeId == PythonInterpreter::id()) return PythonCastStatic<>(value); 367 367 368 368 switch (typeId) 369 369 { … … 376 376 sleftv tmp; 377 377 BOOLEAN newstruct_equal(int, leftv, leftv); // declaring overloaded '=' 378 if (!newstruct_equal(PythonInterpreter::id(), &tmp, value)) 379 return PythonCastStatic<>(&tmp); 378 if (!newstruct_equal(PythonInterpreter::id(), &tmp, value)) 379 return PythonCastStatic<>(&tmp); 380 380 381 381 if (typeId > MAX_TOK) // custom types … … 384 384 assume(bbx != NULL); 385 385 if (! bbx->blackbox_Op1(PythonInterpreter::id(), &tmp, value)) 386 return PythonCastStatic<>(&tmp); 386 return PythonCastStatic<>(&tmp); 387 387 } 388 388 … … 413 413 PythonObject(PyTuple_New(size(value))) { append_to(value); } 414 414 415 415 416 416 private: 417 size_t size(leftv iter, size_t distance = 0) const 418 { 419 if (iter) { do { ++distance; } while((iter = iter->next)); }; 417 size_t size(leftv iter, size_t distance = 0) const 418 { 419 if (iter) { do { ++distance; } while((iter = iter->next)); }; 420 420 return distance; 421 421 } 422 422 423 423 void append_to(leftv iter) const 424 424 { … … 519 519 /// blackbox support - copy element 520 520 void* pyobject_Copy(blackbox*b, void* ptr) 521 { 521 { 522 522 Py_XINCREF(ptr); 523 523 return ptr; … … 535 535 else 536 536 l->data = (void *)result; 537 537 538 538 return !result; 539 539 } 540 540 541 541 542 542 /// blackbox support - unary operations … … 559 559 case TYPEOF_CMD: 560 560 res->data = (void*) omStrDup("pyobject"); 561 res->rtyp = STRING_CMD; 561 res->rtyp = STRING_CMD; 562 562 return FALSE; 563 563 } … … 577 577 578 578 switch(op) // built-in return types and special cases first 579 { 579 { 580 580 case '<': case '>': case EQUAL_EQUAL: case NOTEQUAL: case GE: case LE: 581 581 { … … 691 691 } 692 692 693 PythonObject deletedElts = 693 PythonObject deletedElts = 694 694 python_eval("list(set(_SINGULAR_IMPORTED.iterkeys()) - \ 695 695 set(_SINGULAR_NEW.iterkeys()))"); … … 710 710 711 711 blackbox* pyobject_blackbox(int& tok) { 712 if(blackboxIsCmd("pyobject", tok) != ROOT_DECL) 713 { 714 tok = setBlackboxStuff((blackbox*)omAlloc0(sizeof(blackbox)), 712 if(blackboxIsCmd("pyobject", tok) != ROOT_DECL) 713 { 714 tok = setBlackboxStuff((blackbox*)omAlloc0(sizeof(blackbox)), 715 715 "pyobject"); 716 716 } … … 728 728 int tok = -1; 729 729 blackbox* bbx = pyobject_blackbox(tok); 730 if (bbx->blackbox_Init != pyobject_Init) 730 if (bbx->blackbox_Init != pyobject_Init) 731 731 { 732 732 bbx->blackbox_destroy = pyobject_destroy; … … 740 740 bbx->blackbox_OpM = pyobject_OpM; 741 741 bbx->data = (void*)omAlloc0(newstruct_desc_size()); 742 742 743 743 PythonInterpreter::init(tok); 744 744 745 745 PYOBJECT_ADD_C_PROC(python_import); 746 746 PYOBJECT_ADD_C_PROC(python_eval); 747 PYOBJECT_ADD_C_PROC(python_run); 747 PYOBJECT_ADD_C_PROC(python_run); 748 748 } 749 749 return 0; … … 752 752 753 753 #ifndef EMBED_PYTHON 754 extern "C" { 754 extern "C" { 755 755 int mod_init(SModulFunctions* psModulFunctions) 756 { 757 return SI_MOD_INIT(pyobject)(psModulFunctions); 756 { 757 return SI_MOD_INIT(pyobject)(psModulFunctions); 758 758 } 759 759 } -
Singular/pyobject_setup.cc
re40145 ra9c298 35 35 { 36 36 assume(bbx != NULL); 37 return (pyobject_load() || (bbx->blackbox_Init == pyobject_autoload)? 37 return (pyobject_load() || (bbx->blackbox_Init == pyobject_autoload)? 38 38 NULL: bbx->blackbox_Init(bbx)); 39 39 } … … 45 45 46 46 // Setting up an empty blackbox type, which can be filled with pyobject 47 void pyobject_setup() 47 void pyobject_setup() 48 48 { 49 49 blackbox *bbx = (blackbox*)omAlloc0(sizeof(blackbox)); … … 60 60 getBlackboxStuff(tok): (blackbox*)NULL); 61 61 if (bbx == NULL) return TRUE; 62 return (bbx->blackbox_Init == pyobject_autoload? pyobject_load(): FALSE); 62 return (bbx->blackbox_Init == pyobject_autoload? pyobject_load(): FALSE); 63 63 } 64 64 -
Singular/pyobject_setup.h
re40145 ra9c298 17 17 #define SINGULAR_PYOBJECT_SETUP_H 18 18 19 /// initialize blackbox support for @c pyobject; functionilty os autoloaded on demand 19 /// initialize blackbox support for @c pyobject; functionilty os autoloaded on demand 20 20 void pyobject_setup(); 21 21 -
Singular/si_signals.h
re40145 ra9c298 52 52 (pid, status, options)) 53 53 54 //SI_EINTR_SAVE_FUNC(int, waitid, 54 //SI_EINTR_SAVE_FUNC(int, waitid, 55 55 // (idtype_t idtype, id_t id, siginfo_t *infop, int options), 56 56 // (idtype, id, infop, options)) 57 57 58 SI_EINTR_SAVE_FUNC(ssize_t, read, (int fd, void *buf, size_t count), 58 SI_EINTR_SAVE_FUNC(ssize_t, read, (int fd, void *buf, size_t count), 59 59 (fd, buf, count)) 60 60 … … 105 105 res = nanosleep(req, rem); 106 106 } while((rem != NULL) && (res < 0) && (errno == EINTR)); 107 return res; 107 return res; 108 108 } 109 109 … … 125 125 SI_EINTR_SAVE_FUNC(int, unlink, (const char *pathname), (pathname)) 126 126 127 SI_EINTR_SAVE_SCANF(int, vscanf, 127 SI_EINTR_SAVE_SCANF(int, vscanf, 128 128 (const char *format, va_list ap), 129 129 (format, ap)) … … 139 139 } 140 140 141 SI_EINTR_SAVE_SCANF(int, vfscanf, 141 SI_EINTR_SAVE_SCANF(int, vfscanf, 142 142 (FILE *stream, const char *format, va_list ap), 143 143 (stream, format, ap)) … … 153 153 } 154 154 155 SI_EINTR_SAVE_SCANF(int, vsscanf, 155 SI_EINTR_SAVE_SCANF(int, vsscanf, 156 156 (const char *str, const char *format, va_list ap), 157 157 (str, format, ap)) 158 158 159 static inline int 159 static inline int 160 160 si_sscanf(const char *str, const char *format, ...) 161 161 { … … 176 176 177 177 SI_EINTR_SAVE_FUNC(int, sigaction, 178 (int signum, const struct sigaction *act, 178 (int signum, const struct sigaction *act, 179 179 struct sigaction *oldact), 180 180 (signum, act, oldact)) … … 185 185 (sig, flag)) 186 186 #else 187 #define si_siginterrupt(arg1, arg2) 187 #define si_siginterrupt(arg1, arg2) 188 188 #endif 189 189 -
Singular/singmathic.cc
re40145 ra9c298 367 367 std::cout << "M"; 368 368 break; 369 369 370 370 case ringorder_S: ///< S? 371 371 std::cout << "S"; 372 372 break; 373 373 374 374 case ringorder_s: ///< s? 375 375 std::cout << "s"; … … 379 379 std::cout << "lp"; 380 380 break; 381 381 382 382 case ringorder_dp: 383 383 std::cout << "dp"; -
Singular/subexpr.h
re40145 ra9c298 62 62 inline void Init() { memset(this,0,sizeof(*this)); } 63 63 void CleanUp(ring r=currRing); 64 64 65 65 /// Called by type_cmd (e.g. "r;") or as default in jPRINT 66 66 void Print(leftv store=NULL,int spaces=0); 67 67 68 68 /// Called for conversion to string (used by string(..), write(..),..) 69 69 char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1); 70 70 71 71 void Copy(leftv e); 72 72 attr CopyA(); -
Singular/test.cc
re40145 ra9c298 237 237 { 238 238 assume( sizeof(long) == SIZEOF_LONG ); 239 239 240 240 if( sizeof(long) != SIZEOF_LONG ) 241 241 { 242 242 WerrorS("Bad config.h: wrong size of long!"); 243 243 244 244 return(1); 245 245 } 246 246 247 247 // init path names etc. 248 248 // feInitResources(argv[0]); //??? … … 250 250 251 251 if( char *s = versionString() ) 252 { 252 { 253 253 PrintS(s); 254 254 omFree(s); 255 255 } 256 257 256 257 258 258 259 259 StringSetS("ressources in use (as reported by feStringAppendResources(0):\n"); 260 260 feStringAppendResources(0); 261 StringAppendS("\n"); 261 StringAppendS("\n"); 262 262 if( char * s = StringEndS() ) 263 263 { … … 265 265 omFree(s); 266 266 } 267 268 269 267 268 269 270 270 271 271 // Libpolys tests: -
Singular/walk.cc
re40145 ra9c298 949 949 { 950 950 int i, nR = iv->length(); 951 951 952 952 intvec* ivm = new intvec(nR*nR); 953 953 … … 1117 1117 { 1118 1118 mpz_set(tot_deg, maxdeg); 1119 } 1119 } 1120 1120 } 1121 1121 … … 1881 1881 mpz_init(sing_int_half); 1882 1882 mpz_set_si(sing_int_half, 3*(1073741824/2)); 1883 1883 1884 1884 mpz_t deg_w0_p1, deg_d0_p1; 1885 1885 mpz_init(deg_w0_p1); … … 1969 1969 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t)); 1970 1970 mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t)); 1971 1971 1972 1972 1973 1973 // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector … … 2061 2061 mpz_add(sntz, s_nenner, s_zaehler); 2062 2062 mpz_init_set(vec[j], sntz); 2063 2063 2064 2064 #ifdef NEXT_VECTORS_CC 2065 2065 Print("\n// j = %d ==> ", j); … … 2126 2126 { 2127 2127 if(mpz_cmp_si(ggt,1)==0) 2128 { 2128 { 2129 2129 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2130 2130 // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]); … … 2153 2153 } 2154 2154 */ 2155 2155 2156 2156 if(test_w_in_ConeCC(G,diff_weight1) != 0) 2157 2157 { … … 2211 2211 2212 2212 2213 2213 2214 2214 if(Overflow_Error == FALSE) 2215 2215 { … … 2334 2334 2335 2335 // complete ring intializations 2336 2336 2337 2337 rComplete(r); 2338 2338 … … 2408 2408 2409 2409 // complete ring intializations 2410 2410 2411 2411 rComplete(r); 2412 2412 … … 2471 2471 2472 2472 /* complete ring intializations */ 2473 2473 2474 2474 rComplete(r); 2475 2475 … … 2614 2614 2615 2615 // complete ring intializations 2616 2616 2617 2617 rComplete(r); 2618 2618 … … 3132 3132 #ifdef INVEPS_SMALL_IN_TRAN 3133 3133 if(mpz_cmp_ui(ndeg, nV)>0 && nV > 3) 3134 { 3134 { 3135 3135 mpz_cdiv_q_ui(ndeg, ndeg, nV); 3136 3136 } … … 3976 3976 //compute a perturbed next weight vector "next_weight1" 3977 3977 intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G); 3978 //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1))); 3978 //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1))); 3979 3979 3980 3980 //compute a random next weight vector "next_weight2" … … 3991 3991 } 3992 3992 weight_norm = 1 + floor(sqrt(weight_norm)); 3993 } 3993 } 3994 3994 3995 3995 for(i=nV-1; i>=0; i--) … … 4005 4005 //Print("\n// next_weight22[%d] = %d", i, (*next_weight22)[i]); 4006 4006 } 4007 4007 4008 4008 if(test_w_in_ConeCC(G, next_weight22) == 1) 4009 4009 { … … 4035 4035 (*result)[i] = (*next_weight1)[i]; 4036 4036 } 4037 } 4037 } 4038 4038 } 4039 4039 else … … 4234 4234 // compute a next weight vector 4235 4235 intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 4236 4236 4237 4237 4238 4238 xtnw = xtnw + clock() - to; … … 4669 4669 M = REC_GB_Mwalk(idCopy(Gomega), tmp_weight, curr_weight,pert_deg,1); 4670 4670 Print("\n//Mrwalk: time for the last std(Gw) = %.2f sec\n",((double) (clock()-tim)/1000000)); 4671 4671 4672 4672 #ifdef CHECK_IDEAL_MWALK 4673 4673 idString(Gomega, "G_omega"); … … 4703 4703 { 4704 4704 hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing); 4705 } 4705 } 4706 4706 else 4707 4707 { … … 4784 4784 //intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight,G); 4785 4785 intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg); 4786 4786 4787 4787 tnw = tnw + clock() - to; 4788 4788 //#ifdef PRINT_VECTORS … … 4845 4845 } 4846 4846 4847 //unused 4847 //unused 4848 4848 #if 0 4849 4849 ideal Mwalk_tst(ideal Go, intvec* curr_weight, intvec* target_weight) … … 5811 5811 else 5812 5812 { 5813 // compute a perturbed next weight vector "next_vect1" 5813 // compute a perturbed next weight vector "next_vect1" 5814 5814 intvec* next_vect11 = MPertVectors(G, MivMatrixOrder(omega), nlev); 5815 5815 intvec* next_vect1 = MkInterRedNextWeight(next_vect11, omega2, G); … … 5822 5822 ideal G_test = MwalkInitialForm(G, next_vect); 5823 5823 ideal G_test1 = MwalkInitialForm(G, next_vect1); 5824 5824 // Print("\n// G_test, G_test 1 erzeugt"); 5825 5825 if(IDELEMS(G_test1) <= IDELEMS(G_test)) 5826 5826 { … … 5848 5848 } 5849 5849 weight_norm = 1 + floor(sqrt(weight_norm)); 5850 } 5850 } 5851 5851 for(i=nV-1; i>=0; i--) 5852 5852 { … … 5856 5856 } 5857 5857 else 5858 { 5858 { 5859 5859 (*next_vect22)[i] = (*omega)[i] + floor(weight_rad*(*next_vect22)[i]/weight_norm); 5860 5860 } … … 6829 6829 to=clock(); 6830 6830 // compute a red. GB w.r.t. the help ring 6831 if(MivComp(curr_weight, iv_dp) == 1) 6831 if(MivComp(curr_weight, iv_dp) == 1) 6832 6832 { 6833 6833 //rOrdStr(currRing) = "dp" … … 6972 6972 if(MivComp(next_weight, target_weight) != 1) 6973 6973 { 6974 // compute a perturbed next weight vector "next_weight1" 6974 // compute a perturbed next weight vector "next_weight1" 6975 6975 intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G); 6976 6976 6977 6977 // compare next_weight and next_weight1 6978 6978 ideal G_test = MwalkInitialForm(G, next_weight); … … 6987 6987 // Print("\n// size of target_weight = %d", sizeof((*target_weight))); 6988 6988 k = 0; 6989 6989 6990 6990 while(test_w_in_ConeCC(G, next_weight22) == 0 && k < 11) 6991 6991 { … … 7005 7005 } 7006 7006 weight_norm = 1 + floor(sqrt(weight_norm)); 7007 } 7007 } 7008 7008 for(i=nV-1; i>=0; i--) 7009 7009 { 7010 7010 if((*next_weight22)[i] < 0) 7011 7011 { 7012 7012 (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm); … … 7018 7018 // Print("\n// next_weight22[%d] = %d", i, (*next_weight22)[i]); 7019 7019 } 7020 } 7020 } 7021 7021 7022 7022 if(test_w_in_ConeCC(G, next_weight22) == 1) … … 7028 7028 ideal G_test2 = MwalkInitialForm(G, next_weight2); 7029 7029 if(IDELEMS(G_test2) <= IDELEMS(G_test)) 7030 7030 { 7031 7031 if(IDELEMS(G_test2) <= IDELEMS(G_test1)) 7032 7032 { … … 7791 7791 #endif 7792 7792 tproc = clock()-xftinput; 7793 7793 7794 7794 //Print("\n// main routine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg); 7795 7795 7796 7796 // compute the red. GB of <G> w.r.t. the lex order by the "recursive-modified" perturbation walk alg (1,tp_deg) 7797 7797 G = Mpwalk_MAltwalk1(G, curr_weight, tp_deg); -
Singular/walk.h
re40145 ra9c298 24 24 intvec* Mivlp(int nR); 25 25 26 intvec* MivMatrixOrder(intvec* iv); 27 intvec* MivMatrixOrderdp(int iv); 28 intvec* MPertVectors(ideal G, intvec* ivtarget, int pdeg); 29 intvec* MPertVectorslp(ideal G, intvec* ivtarget, int pdeg); 26 intvec* MivMatrixOrder(intvec* iv); 27 intvec* MivMatrixOrderdp(int iv); 28 intvec* MPertVectors(ideal G, intvec* ivtarget, int pdeg); 29 intvec* MPertVectorslp(ideal G, intvec* ivtarget, int pdeg); 30 30 31 31 32 32 intvec* MivMatrixOrderlp(int nV); 33 33 34 intvec* Mfpertvector(ideal G, intvec* iv); 34 intvec* Mfpertvector(ideal G, intvec* iv); 35 35 intvec* MivUnit(int nV); 36 36 37 intvec* MivWeightOrderlp(intvec* ivstart); 38 intvec* MivWeightOrderdp(intvec* ivstart); 37 intvec* MivWeightOrderlp(intvec* ivstart); 38 intvec* MivWeightOrderdp(intvec* ivstart); 39 39 40 ideal MidLift(ideal Gomega, ideal M); 40 ideal MidLift(ideal Gomega, ideal M); 41 41 ideal MLiftLmalG(ideal L, ideal G); 42 ideal MLiftLmalGNew(ideal Gomega, ideal M, ideal G); 43 ideal MLiftLmalGMin(ideal L, ideal G); 42 ideal MLiftLmalGNew(ideal Gomega, ideal M, ideal G); 43 ideal MLiftLmalGMin(ideal L, ideal G); 44 44 45 45 … … 53 53 /* Okt -- Nov'01 */ 54 54 // compute a Groebner basis of an ideal G w.r.t. lexicographic order 55 ideal Mwalk(ideal G, intvec* curr_weight, intvec* target_weight); 55 ideal Mwalk(ideal G, intvec* curr_weight, intvec* target_weight); 56 56 57 57 // random walk algorithm to compute a Groebner basis … … 59 59 60 60 /* the perturbation walk algorithm */ 61 ideal Mpwalk(ideal G,int op,int tp,intvec* curr_weight,intvec* target_weight, int nP); 61 ideal Mpwalk(ideal G,int op,int tp,intvec* curr_weight,intvec* target_weight, int nP); 62 62 63 63 /* The fractal walk algorithm */ … … 75 75 76 76 /* the first alternative algorithm */ 77 ideal MAltwalk1(ideal G,int op,int tp,intvec* curr_weight,intvec* target_weight); 77 ideal MAltwalk1(ideal G,int op,int tp,intvec* curr_weight,intvec* target_weight); 78 78 79 79 /* the second alternative algorithm */ 80 ideal MAltwalk2(ideal G, intvec* curr_weight, intvec* target_weight); 80 ideal MAltwalk2(ideal G, intvec* curr_weight, intvec* target_weight); 81 81 82 82 #endif //WALK_H -
kernel/F4.cc
re40145 ra9c298 56 56 #endif 57 57 for(i=0;i<p_index;i++) 58 { 58 { 59 59 // Print("%i ter Eintrag:%s\n",i,pString(p[i])); 60 60 mac_poly m=NULL; … … 75 75 (*set_this)=new mac_poly_r(); 76 76 (*set_this)->exp=v; 77 77 78 78 (*set_this)->coef=nCopy(p_i->coef); 79 79 set_this=&(*set_this)->next; … … 102 102 #endif 103 103 for(i=0;i<p_index;i++) 104 { 104 { 105 105 // Print("%i ter Eintrag:%s\n",i,pString(p[i])); 106 106 poly p_i=p[i]; … … 155 155 continue; 156 156 } 157 157 158 158 m[m_index]=pInit(); 159 159 int v=mat->min_col_not_zero_in_row(i); … … 164 164 pSetExpV(m[m_index],ev); 165 165 omfree(ev); 166 166 167 167 poly p=m[m_index]; 168 168 pSetCoeff(p,mat->get(i,v)); … … 170 170 { 171 171 poly pn=pInit(); 172 172 173 173 //v=done_index-1-pos; => pos=done_index-1-v=mat->get_columns()-1-v 174 174 pos=mat->get_columns()-1-v; … … 203 203 p2=((monom_poly*)ap2); 204 204 if(((unsigned long) p1->f)>((unsigned long) p2->f)) return 1; 205 if(((unsigned long) p1->f)<((unsigned long)p2->f)) return -1; 205 if(((unsigned long) p1->f)<((unsigned long)p2->f)) return -1; 206 206 207 207 return pLmCmp(p1->m,p2->m); 208 208 209 209 } 210 210 static int posInMonomPolys (monom_poly* p, int pn, monom_poly & qe,slimgb_alg* c) … … 251 251 if ((h.f==F->mp[i].f) &&(p_LmDivisibleBy(F->mp[i].m,h.m,c->r))) 252 252 { 253 254 //Print("found");255 256 257 253 254 // Print("found"); 255 256 //according to the algorithm you should test (!(pIsConstant(F[i].m))) 257 //but I think this is only because of bad formulation 258 258 int j; 259 259 260 260 poly lm=pLmInit(h.f); 261 261 pSetCoeff(lm,nInit(1)); … … 272 272 assume(j!=-1); 273 273 // if(j==-1) Print("\n jAltert \n"); 274 // 275 // 276 // 277 // 278 // 279 // 274 // for(j=0;j<F_minus->size;j++) 275 // { 276 // if (pLmEqual(F_minus->p[j],lm)) 277 // break; 278 // } 279 // assume(j<F_minus->size); 280 280 pDelete(&lm); 281 281 if(j>=0) … … 322 322 while(chosen_index<max_par) 323 323 { 324 324 325 325 // sorted_pair_node* s=c->apairs[c->pair_top]; 326 326 sorted_pair_node* s; … … 341 341 { 342 342 //replace_pair(s->i,s->j,c); 343 if(s->i==s->j) 343 if(s->i==s->j) 344 344 { 345 345 free_sorted_pair_node(s,c->r); … … 352 352 if(s->i>=0) 353 353 { 354 354 355 355 poly lcm=pOne(); 356 356 357 357 pLcm(c->S->m[s->i], c->S->m[s->j], lcm); 358 358 pSetm(lcm); … … 371 371 if(chosen_index+1>=chosen_size) 372 372 { 373 373 //max_par must be greater equal 2 374 374 chosen_size+=si_max(max_par,2); 375 375 chosen=(monom_poly*) omrealloc(chosen,chosen_size*sizeof(monom_poly)); … … 395 395 //must carefull remember to destroy such a h; 396 396 poly_list_node* next=c->to_destroy; 397 397 398 398 c->to_destroy=(poly_list_node*) omalloc(sizeof(poly_list_node)); 399 399 c->to_destroy->p=h.f; … … 409 409 else 410 410 omfree(s); 411 412 411 412 413 413 414 414 } … … 426 426 //Print(", %s \n", pString(chosen[i].f)); 427 427 } 428 428 429 429 //next Step remove duplicate entries 430 430 qsort(chosen,chosen_index,sizeof(monom_poly),monom_poly_crit); … … 489 489 //q=(poly*) omalloc(m_size*sizeof(poly)); 490 490 491 491 492 492 493 493 for(i=0;i<p_index;i++) … … 520 520 { 521 521 #ifdef TGB_DEBUG 522 522 523 523 for(i=0;i<done_index;i++) 524 524 { … … 529 529 qsort(m, m_index,sizeof(poly),pLmCmp_func); 530 530 531 531 532 532 pos=0; 533 533 #ifdef TGB_DEBUG 534 534 535 535 for(i=0;i<done_index;i++) 536 536 { 537 537 538 538 pTest(done[i]); 539 539 } … … 593 593 pTest(done[my_i]); 594 594 } 595 #endif 595 #endif 596 596 if(((done_index>pos)&&(pLmEqual(m[i],done[pos]))) ||(pos>0) &&(pLmEqual(m[i],done[pos-1]))) 597 597 in_done=TRUE; 598 598 if (!(in_done)) 599 599 { 600 600 601 601 int S_pos=kFindDivisibleByInS_easy(c->strat,m[i], pGetShortExpVector(m[i])); 602 602 if(S_pos>=0) … … 622 622 pTest(done[my_i]); 623 623 } 624 #endif 625 626 624 #endif 625 memmove(&(done[pos+1]),&(done[pos]), (done_index-pos)*sizeof(poly)); 626 done[pos]=m[i]; 627 627 done_index++; 628 628 #ifdef TGB_DEBUG … … 631 631 for (my_i=0;my_i<done_index;my_i++) 632 632 { 633 //Print("Position %i pos %i size %i\n",my_i,pos,done_index);633 // Print("Position %i pos %i size %i\n",my_i,pos,done_index); 634 634 pTest(done[my_i]); 635 635 } 636 636 } 637 #endif 637 #endif 638 638 } 639 639 else … … 718 718 #endif 719 719 assume(p_index==chosen_index); 720 720 721 721 // tgb_matrix* mat=build_matrix(p,p_index,done, done_index,c); 722 722 723 723 // simple_gauss2(mat); 724 724 tgb_sparse_matrix* mat=build_sparse_matrix(p,p_index,done, done_index,c); … … 727 727 m=(poly*) omalloc(m_size*sizeof(poly)); 728 728 m_index=retranslate(m,mat,done,c); 729 729 730 730 mat=NULL; 731 731 for(i=0;i<done_index;i++) … … 733 733 omfree(done); 734 734 done=NULL; 735 //next Step addElements to basis 735 //next Step addElements to basis 736 736 int F_plus_size=m_index; 737 737 poly* F_plus=(poly*)omalloc(F_plus_size*sizeof(poly)); … … 752 752 if(((p_index>pos)&&(pLmEqual(m[i],p[pos]))) ||(pos>0) &&(pLmEqual(m[i],p[pos-1]))) 753 753 minus=TRUE; 754 754 755 755 if(minus) 756 756 { … … 772 772 // if (pLmEqual(p[j],m[i])) 773 773 // { 774 // 775 // 774 // minus=TRUE; 775 // break; 776 776 // } 777 777 // if(minus) … … 793 793 if (TEST_OPT_PROT) 794 794 Print("%i]", F_plus_index); 795 for(i=0;i<p_index;i++) 795 for(i=0;i<p_index;i++) 796 796 pDelete(&p[i]); 797 797 omfree(p); … … 824 824 (*F_i)->mp=chosen; 825 825 (*F_i)->next=NULL; 826 826 827 827 if(F_plus_index>0) 828 828 { … … 830 830 int* ibuf=(int*) omalloc(F_plus_index*sizeof(int)); 831 831 sorted_pair_node*** sbuf=(sorted_pair_node***) omalloc(F_plus_index*sizeof(sorted_pair_node**)); 832 832 833 833 for(j=0;j<F_plus_index;j++) 834 834 { 835 835 int len; 836 836 poly p=F_plus[j]; 837 837 838 838 // delete buf[j]; 839 839 //remember to free res here 840 840 // p=redTailShort(p, c->strat); 841 841 sbuf[j]=add_to_basis_ideal_quotient(p,c,ibuf+j); 842 842 843 843 } 844 844 int sum=0; -
kernel/F4.h
re40145 ra9c298 2 2 // C++ Interface: F4 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // -
kernel/IIntvec.h
re40145 ra9c298 5 5 class Intvec: public std::vector<int>{ 6 6 public: 7 Intvec(iterator first, 7 Intvec(iterator first, 8 8 iterator last, 9 9 const allocator_type& __a = allocator_type()): … … 20 20 int s=size(); 21 21 intvec* iv=new intvec(s); 22 22 23 23 for(int i=0;i<s;i++){ 24 24 (*iv)[i]=(*this)[i]; -
kernel/f5c.h
re40145 ra9c298 8 8 /*! 9 9 * main function of the F5C implementation in SINGULAR 10 * 10 * 11 11 * INPUT: Ideal i for which a gröbner basis should be computed; 12 12 * ring r. -
kernel/f5data.cc
re40145 ra9c298 4 4 ****************************************/ 5 5 /* 6 * ABSTRACT: lpolynomial definition 6 * ABSTRACT: lpolynomial definition 7 7 */ 8 8 #ifdef HAVE_CONFIG_H … … 30 30 /* 31 31 ===================== 32 everything is inlined 32 everything is inlined 33 33 ===================== 34 34 */ -
kernel/f5data.h
re40145 ra9c298 232 232 class RuleOld { 233 233 private: 234 int index; // index of the labeled polynomial the RuleOld comes from 234 int index; // index of the labeled polynomial the RuleOld comes from 235 235 poly term; // term of the labeled polynomial the RuleOld comes from 236 236 public: -
kernel/f5gb.cc
re40145 ra9c298 47 47 /* 48 48 ==================================================================== 49 sorting ideals by decreasing total degree "left" and "right" are the 49 sorting ideals by decreasing total degree "left" and "right" are the 50 50 pointer of the first and last polynomial in the considered ideal 51 51 ==================================================================== … … 59 59 while(pTotaldegree(*ptr1, currRing) < pTotaldegree(p2, currRing)) { 60 60 ptr1++; 61 } 61 } 62 62 while(pTotaldegree(*ptr2, currRing) > pTotaldegree(p2,currRing)) { 63 63 ptr2--; … … 111 111 return true; 112 112 } 113 } 113 } 114 114 } 115 115 } … … 119 119 /* 120 120 ================================================== 121 computes incrementally gbs of subsets of the input 121 computes incrementally gbs of subsets of the input 122 122 gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 123 123 ================================================== 124 124 */ 125 125 LList* F5inc(int i, poly f_i, LList* gPrev, LList* reducers, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag, int plus, int termination) { 126 //Print("in f5inc\n"); 126 //Print("in f5inc\n"); 127 127 //pWrite(rules->getFirst()->getRuleTerm()); 128 128 int iterationstep = i; … … 140 140 //Print("2nd gPrev: "); 141 141 //pWrite(gPrev->getFirst()->getNext()->getPoly()); 142 //pWrite(gPrev->getFirst()->getNext()->getPoly()); 142 //pWrite(gPrev->getFirst()->getNext()->getPoly()); 143 143 CListOld* critPairs = new CListOld(); 144 CNode* critPairsMinDeg = new CNode(); 144 CNode* critPairsMinDeg = new CNode(); 145 145 PList* rejectedGBList = new PList(); 146 146 // computation of critical pairs with checking of criterion 1 and criterion 2 and saving them … … 154 154 static LList* reducedLPolys = new LList(); 155 155 // while there are critical pairs to be further checked and deleted/computed 156 while(NULL != critPairs->getFirst()) { 156 while(NULL != critPairs->getFirst()) { 157 157 // critPairs->getMinDeg() deletes the first elements of minimal degree from 158 158 // critPairs, thus the while loop is not infinite. 159 // adds all to be reduced S-polynomials in the list sPolyList and adds 159 // adds all to be reduced S-polynomials in the list sPolyList and adds 160 160 // the corresponding rules to the list rules 161 // NOTE: inside there is a second check of criterion 2 if new rules are 161 // NOTE: inside there is a second check of criterion 2 if new rules are 162 162 // added 163 163 //int timer4 = initTimer(); … … 180 180 //Print("number of useful pairs: %d\n",numberUsefulPairs); 181 181 //Print("number of useless pairs: %d\n\n",numberUselessPairs); 182 //Print("Degree of following reduction: %d\n",critPairsMinDeg->getData()->getDeg()); 183 long degreecheck = critPairsMinDeg->getData()->getDeg(); 184 182 //Print("Degree of following reduction: %d\n",critPairsMinDeg->getData()->getDeg()); 183 long degreecheck = critPairsMinDeg->getData()->getDeg(); 184 185 185 computeSPols(critPairsMinDeg,rTag,rules,sPolyList, rejectedGBList); 186 186 //} … … 216 216 // return gPrev; 217 217 //} 218 //Print("ARRIS DEG: %ld\n",arrideg); 218 //Print("ARRIS DEG: %ld\n",arrideg); 219 219 // Arris idea stated by John in an email 220 220 //if(arrisCheck(critPairs->getFirst(),gPrev->getFirst(),arrideg)) { … … 222 222 // return gPrev; 223 223 //} 224 225 226 //bool aha = checkDGB(gPrev); 227 224 225 226 //bool aha = checkDGB(gPrev); 227 228 228 229 229 //timer3 = getTimer(); 230 230 //reductionTime = reductionTime + timer3; 231 //Print("REDUCTION TIMER: %d\n",timer3); 231 //Print("REDUCTION TIMER: %d\n",timer3); 232 232 // DEBUG STUFF FOR GPREV 233 233 //temp = gPrev->getFirst(); … … 242 242 //} 243 243 //sleep(5); 244 244 245 245 } 246 246 //Print("REDUCTION DONE\n"); … … 333 333 ppMult_qq(u2,temp2->getPoly())); 334 334 pNorm(sp); 335 335 336 336 poly reducer = pOne(); 337 337 //reducer = gb->m[0]; 338 338 int i = 0; 339 339 pWrite(pHead(sp)); 340 340 341 341 while(i<IDELEMS(gb)) { 342 342 reducer = gb->m[i]; … … 356 356 } 357 357 } 358 358 359 359 pWrite(pHead(sp)); 360 360 } … … 371 371 * Checks all remaining critical pairs, i.e. those of higher degree, 372 372 * by the two Buchberger criteria. 373 * return value: 0, if all remaining critical pairs are deleted by 373 * return value: 0, if all remaining critical pairs are deleted by 374 374 * Buchberger's criteria 375 375 * 1, otherwise … … 377 377 bool arrisCheck(CNode* first, LNode* firstGCurr, long arrideg) { 378 378 CNode* temp = first; 379 379 380 380 //product criterion check 381 381 while(NULL != temp) { … … 422 422 } 423 423 424 425 424 425 426 426 /* 427 427 ================================================================ 428 428 computes a list of critical pairs for the next reduction process 429 the first element is always "useful" thus the critical pair 430 computed is either "useful" or "useless" depending on the second 429 the first element is always "useful" thus the critical pair 430 computed is either "useful" or "useless" depending on the second 431 431 element which generates the critical pair. 432 432 first element in gPrev is always the newest element which must … … 466 466 u2 = pDivide(lcm,pHead(temp->getPoly())); 467 467 pSetCoeff(u2,nOne); 468 int degree = pDeg(ppMult_qq(u2,pHead(temp->getPoly()))); 468 int degree = pDeg(ppMult_qq(u2,pHead(temp->getPoly()))); 469 469 // testing both new labels by the F5 Criterion 470 470 if(!temp->getDel()) { … … 473 473 } 474 474 if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag) 475 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 475 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 476 476 && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) { 477 477 // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater 478 478 // label as first element in the CPairOld 479 if(newElement->getIndex() == temp->getIndex() && 479 if(newElement->getIndex() == temp->getIndex() && 480 480 -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) { 481 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 482 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 0 , testedRuleOld); 481 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 482 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 0 , testedRuleOld); 483 483 critPairs->insert(cp); 484 484 // counting the number of useful pairs … … 486 486 } 487 487 else { 488 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 489 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 0, testedRuleOld); 488 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 489 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 0, testedRuleOld); 490 490 critPairs->insert(cp); 491 491 // counting the number of useful pairs … … 511 511 //if(rejectedGBList->check(lcm)) { // if there is equality of lcms then we need the F5 critical pair 512 512 if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag) 513 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 513 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 514 514 && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) { 515 515 // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater 516 516 // label as first element in the CPairOld 517 if(newElement->getIndex() == temp->getIndex() && 517 if(newElement->getIndex() == temp->getIndex() && 518 518 -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) { 519 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 520 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld); 519 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 520 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld); 521 521 critPairs->insert(cp); 522 522 numberUselessPairs++; 523 523 } 524 524 else { 525 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 526 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld); 525 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 526 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld); 527 527 critPairs->insert(cp); 528 528 numberUselessPairs++; … … 540 540 ================================================================ 541 541 computes a list of critical pairs for the next reduction process 542 the first element is always "useless" thus the critical pair 542 the first element is always "useless" thus the critical pair 543 543 computed is "useless". 544 544 first element in gPrev is always the newest element which must … … 577 577 //if(rejectedGBList->check(lcm)) { // if there is equality of lcms then we need the F5 critical pair 578 578 if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag) 579 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 579 && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 580 580 && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) { 581 581 // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater 582 582 // label as first element in the CPairOld 583 if(newElement->getIndex() == temp->getIndex() && 583 if(newElement->getIndex() == temp->getIndex() && 584 584 -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) { 585 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 586 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld); 585 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 586 temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld); 587 587 critPairs->insert(cp); 588 588 numberUselessPairs++; 589 589 } 590 590 else { 591 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 592 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld); 591 CPairOld* cp = new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 592 newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld); 593 593 critPairs->insert(cp); 594 594 numberUselessPairs++; 595 595 } 596 596 } 597 //} 597 //} 598 598 temp = temp->getNext(); 599 599 } … … 609 609 inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag) { 610 610 // starts at the first element in gPrev with index = (index of l)-1, these tags are saved in lTag 611 611 int idx = l->getIndex(); 612 612 int i; 613 613 if(idx == 1) { … … 670 670 inline bool criterion2(int idx, poly t, LNode* l, RList* rules, RTagList* rTag) { 671 671 //Print("------------------------------IN CRITERION 2/1-----------------------------------------\n"); 672 /* 672 /* 673 673 Print("RULES: \n"); 674 674 RNode* tempR = rules->getFirst(); … … 694 694 return false; 695 695 } 696 696 697 697 RNode* testNode; // = new RNode(); 698 698 testNode = rules->getFirst(); … … 706 706 } 707 707 } 708 708 709 709 else { 710 710 … … 713 713 } 714 714 else { 715 //Print("HIER\n"); 715 //Print("HIER\n"); 716 716 //Print("DEBUG\n"); 717 717 //Print("L INDEX: %d\n",l->getIndex()); … … 731 731 */ 732 732 //testNode = rules->getFirst(); 733 733 // save the monom t1*label_term(l) as it is tested various times in the following 734 734 poly u1 = ppMult_qq(t,l->getTerm()); 735 735 // first element added to rTag was NULL, check for this … … 738 738 //Print("TESTNODE: %p\n",testNode); 739 739 //pWrite(testNode->getRuleTerm()); 740 if(NULL != testNode ) { 740 if(NULL != testNode ) { 741 741 //pWrite(testNode->getRuleTerm()); 742 742 } … … 750 750 } 751 751 } 752 while(NULL != testNode && testNode->getRuleOld() != l->getRuleOld() 752 while(NULL != testNode && testNode->getRuleOld() != l->getRuleOld() 753 753 && l->getIndex() == testNode->getRuleOldIndex()) { 754 754 //Print("%p\n",testNode); … … 765 765 return true; 766 766 } 767 767 testNode = testNode->getNext(); 768 768 } 769 769 //delete testNode; … … 798 798 */ 799 799 // start at the previously added element to gPrev, as all other elements will have the same index for sure 800 800 RNode* testNode = rules->getFirst(); 801 801 // save the monom t1*label_term(l) as it is tested various times in the following 802 802 poly u1 = ppMult_qq(t,l->getTerm()); 803 804 803 // first element added to rTag was NULL, check for this 804 while(NULL != testNode && testNode->getRuleOld() != testedRuleOld) { 805 805 //pWrite(testNode->getRuleTerm()); 806 806 if(pLmDivisibleByNoComp(testNode->getRuleOldTerm(),u1)) { … … 811 811 return true; 812 812 } 813 813 testNode = testNode->getNext(); 814 814 } 815 815 pDelete(&u1); … … 837 837 ================================== 838 838 */ 839 void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList, PList* rejectedGBList) { 839 void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList, PList* rejectedGBList) { 840 840 CNode* temp = first; 841 841 //Print("\nDegree: %d\n",temp->getData()->getDeg()); … … 850 850 CListOld* f5pairs = new CListOld(); 851 851 poly sp = pInit(); 852 number sign = nInit(-1); 852 number sign = nInit(-1); 853 853 //Print("###############################IN SPOLS##############################\n"); 854 854 //first->print(); … … 898 898 } 899 899 rejectedGBList->insert(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly()))); 900 //Print("rejected!\n"); 900 //Print("rejected!\n"); 901 901 902 902 //Print("CRITERION 2 in SPOLS 2nd generator\n"); 903 903 } 904 904 } 905 else { 905 else { 906 906 sp = ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()), 907 907 ppMult_qq(temp->getT2(),temp->getLp2Poly())); … … 925 925 } 926 926 } 927 /* 927 /* 928 928 if(temp->getDel() == 0 && criterion2(temp->getT1(),temp->getAdLp1(),rules,temp->getTestedRuleOld())) { 929 //Print("rejected!\n"); 929 //Print("rejected!\n"); 930 930 rejectedGBList->insert(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly()))); 931 931 } 932 933 932 933 934 934 if(temp->getDel() == 1 && !criterion2(temp->getT1(),temp->getAdLp1(),rules,temp->getTestedRuleOld())) { 935 if(highestDegree < pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()))) { 935 if(highestDegree < pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()))) { 936 936 highestDegree = pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly())); 937 } 937 } 938 938 if(temp->getLp2Index() == temp->getLp1Index()) { 939 939 if(!criterion2(temp->getT2(),temp->getAdLp2(),rules,temp->getTestedRuleOld())) { … … 956 956 957 957 f5rules->insert(rules->getFirst()->getRuleOld()); 958 f5pairs->insertWithoutSort(temp->getData()); 958 f5pairs->insertWithoutSort(temp->getData()); 959 959 /////////////////////////////////////// 960 960 … … 963 963 } 964 964 } 965 else { 965 else { 966 966 sp = ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()), 967 967 ppMult_qq(temp->getT2(),temp->getLp2Poly())); … … 983 983 984 984 f5rules->insert(rules->getFirst()->getRuleOld()); 985 f5pairs->insertWithoutSort(temp->getData()); 985 f5pairs->insertWithoutSort(temp->getData()); 986 986 /////////////////////////////////////// 987 987 //sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRuleOld()); … … 1004 1004 1005 1005 } 1006 1007 /* 1006 1007 /* 1008 1008 temp = f5pairs->getFirst(); 1009 1009 RNode* tempRule = f5rules->getFirst(); … … 1026 1026 numberRejectedF5CriticalPairs++; 1027 1027 howmany++; 1028 if(numberRejectedF5CriticalPairs < -1) { // || 1028 if(numberRejectedF5CriticalPairs < -1) { // || 1029 1029 } 1030 1030 else { … … 1050 1050 //if(temp->getLp1Index() < 7) { 1051 1051 sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,tempRule->getRuleOld()); 1052 1052 1053 1053 //} 1054 1054 //numberOfSpolys++; 1055 1055 } 1056 //pSetExp(tempRule->getRuleOld()->getTerm(),1,1000); 1056 //pSetExp(tempRule->getRuleOld()->getTerm(),1,1000); 1057 1057 } 1058 1058 temp = temp->getNext(); … … 1060 1060 1061 1061 } 1062 */ 1063 // these critical pairs can be deleted now as they are either useless for further computations or 1062 */ 1063 // these critical pairs can be deleted now as they are either useless for further computations or 1064 1064 // already saved as an S-polynomial to be reduced in the following 1065 delete first; 1065 delete first; 1066 1066 //Print("NUMBER SPOLYS: %d\n", numberOfSpolys); 1067 1067 //Print("SPOLY LIST: \n"); … … 1082 1082 ======================================================================== 1083 1083 */ 1084 void reduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, 1085 ideal gbPrev, PList* rejectedGBList, int plus) { 1084 void reduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, 1085 ideal gbPrev, PList* rejectedGBList, int plus) { 1086 1086 //Print("##########################################In REDUCTION!########################################\n"); 1087 1087 // check if sPolyList has any elements … … 1090 1090 while(NULL != temp) { 1091 1091 // temp is the first element in the sPolyList which should be reduced 1092 // due to earlier sorting this is the element of minimal degree AND 1092 // due to earlier sorting this is the element of minimal degree AND 1093 1093 // minimal label 1094 1094 // delete the above first element from sPolyList, temp will be either reduced to … … 1103 1103 temp->setPoly(tempNF); 1104 1104 // try further reductions of temp with polynomials in gPrev 1105 // with label index = current label index: this is done such that there 1105 // with label index = current label index: this is done such that there 1106 1106 // is no label corruption during the reduction process 1107 1107 //Print("lower label reduction: "); 1108 1108 //pWrite(tempNF); 1109 1109 topReduction(temp,sPolyList,gPrev,critPairs,rules,lTag,rTag,gbPrev, rejectedGBList,plus); 1110 1110 1111 1111 } 1112 1112 else { … … 1121 1121 //sPolyList->print(); 1122 1122 //delete sPolyList; 1123 } 1123 } 1124 1124 1125 1125 /* … … 1128 1128 ======================================================================== 1129 1129 */ 1130 void newReduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, LList* reducers, RList* rules, LTagList* lTag, RTagList* rTag, 1131 ideal gbPrev, int termination, PList* rejectedGBList, int plus) { 1130 void newReduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, LList* reducers, RList* rules, LTagList* lTag, RTagList* rTag, 1131 ideal gbPrev, int termination, PList* rejectedGBList, int plus) { 1132 1132 //Print("##########################################In REDUCTION!########################################\n"); 1133 1133 // check if sPolyList has any elements … … 1139 1139 numberOfReductions++; 1140 1140 // temp is the first element in the sPolyList which should be reduced 1141 // due to earlier sorting this is the element of minimal degree AND 1141 // due to earlier sorting this is the element of minimal degree AND 1142 1142 // minimal label 1143 1143 // delete the above first element from sPolyList, temp will be either reduced to … … 1159 1159 //pWrite(tempNF); 1160 1160 // try further reductions of temp with polynomials in gPrev 1161 // with label index = current label index: this is done such that there 1161 // with label index = current label index: this is done such that there 1162 1162 // is no label corruption during the reduction process 1163 findReducers(temp,sPolyList,gbPrev,gPrev,reducers,critPairs,rules,lTag,rTag, termination, rejectedGBList,plus); 1163 findReducers(temp,sPolyList,gbPrev,gPrev,reducers,critPairs,rules,lTag,rTag, termination, rejectedGBList,plus); 1164 1164 //} 1165 1165 //else { … … 1180 1180 //delete sPolyList; 1181 1181 //Print("REDUCTION FERTIG\n"); 1182 } 1182 } 1183 1183 1184 1184 1185 1185 /*! 1186 1186 * ================================================================================ 1187 * searches for reducers of temp similar to the symbolic preprocessing of F4 and 1187 * searches for reducers of temp similar to the symbolic preprocessing of F4 and 1188 1188 * divides them into a "good" and "bad" part: 1189 * 1189 * 1190 1190 * the "good" ones are the reducers which do not corrupt the label of temp, with 1191 1191 * these the normal form of temp is computed 1192 1192 * 1193 * the "bad" ones are the reducers which corrupt the label of temp, they are tested 1193 * the "bad" ones are the reducers which corrupt the label of temp, they are tested 1194 1194 * later on for possible new rules and S-polynomials to be added to the algorithm 1195 1195 * ================================================================================ … … 1259 1259 break; 1260 1260 } 1261 } 1262 1261 } 1262 1263 1263 } 1264 1264 else { … … 1267 1267 //pWrite(u); 1268 1268 //pWrite(tempRed->getTerm()); 1269 //pWrite(pHead(tempRed->getPoly())); 1269 //pWrite(pHead(tempRed->getPoly())); 1270 1270 addToG = 0; 1271 1271 } … … 1312 1312 } 1313 1313 } 1314 } 1314 } 1315 1315 } 1316 1316 else { 1317 1317 //Print("CRIT 1 "); 1318 1318 1319 1319 if(pLmCmp(ppMult_qq(u,tempRed->getTerm()),l->getTerm()) == 1 ) { 1320 1320 //Print("NOT ALLOWED REDUCER, CRIT 1:\n"); … … 1369 1369 break; 1370 1370 } 1371 1371 1372 1372 } 1373 1373 } … … 1381 1381 //Print("TEMPREDPOLY: "); 1382 1382 //pWrite(tempRed->getPoly()); 1383 //pWrite(tempPoly); 1383 //pWrite(tempPoly); 1384 1384 if(pLmDivisibleByNoComp(tempRed->getPoly(),tempPoly)) { 1385 1385 //Print("A\n"); … … 1412 1412 break; 1413 1413 } 1414 } 1415 1414 } 1415 1416 1416 } 1417 1417 else { … … 1420 1420 //pWrite(u); 1421 1421 //pWrite(tempRed->getTerm()); 1422 //pWrite(pHead(tempRed->getPoly())); 1422 //pWrite(pHead(tempRed->getPoly())); 1423 1423 //addToG = 0; 1424 1424 } … … 1465 1465 } 1466 1466 } 1467 } 1467 } 1468 1468 } 1469 1469 else { 1470 1470 //Print("CRIT 1 "); 1471 1471 1472 1472 if(pLmCmp(ppMult_qq(u,tempRed->getTerm()),l->getTerm()) == 1 ) { 1473 1473 //Print("NOT ALLOWED REDUCER, CRIT 1:\n"); … … 1498 1498 } 1499 1499 } 1500 1500 1501 1501 } 1502 1502 tempRed = tempRed->getNext(); … … 1515 1515 // end for top-reduction only 1516 1516 tempPoly = kBucketGetLm(bucket); 1517 1517 1518 1518 } 1519 1519 } … … 1525 1525 Print("\nELEMENT ADDED TO GPREV: "); 1526 1526 pNorm(redPoly); 1527 if(highestDegree < pDeg(redPoly)) { 1527 if(highestDegree < pDeg(redPoly)) { 1528 1528 highestDegree = pDeg(redPoly); 1529 } 1529 } 1530 1530 pWrite(pHead(redPoly)); 1531 1531 //pWrite(l->getTerm()); … … 1567 1567 } 1568 1568 } 1569 1569 1570 1570 // if there are "bad" reducers than try to compute new S-polynomials and rules 1571 1571 1572 1572 if(NULL != bad->getFirst()) { 1573 1573 //Print("BAD STUFF LIST:\n"); … … 1608 1608 //tempRed->getLPoly()->setRule(rules->getFirst()->getRule()); 1609 1609 tempBadNew->setDel(1); 1610 1610 1611 1611 sPolyList->insertByLabel(tempBadNew); 1612 1612 //Print("BAD SPOLYLIST: \n"); … … 1625 1625 //Print("HIER AUCH\n"); 1626 1626 //Print("SPOLYLIST IN BAD: \n"); 1627 //sPolyList->print(); 1627 //sPolyList->print(); 1628 1628 //Print("END FIND REDUCERS\n"); 1629 1629 } … … 1713 1713 // if label of reductor is greater than the label of l we have to built a new element 1714 1714 // and add it to sPolyList 1715 1715 1716 1716 if(pLmCmp(tempRed->getTerm(),l->getTerm()) == 1) { 1717 1717 // needed sinc pSub destroys the arguments! … … 1743 1743 } 1744 1744 } 1745 1746 // label of reductor is smaller than the label of l, subtract reductor from l and delete the 1747 // gPrevRedCheck pointer added to l during findReductor() as the head term of l changes 1748 // after subtraction 1745 1746 // label of reductor is smaller than the label of l, subtract reductor from l and delete the 1747 // gPrevRedCheck pointer added to l during findReductor() as the head term of l changes 1748 // after subtraction 1749 1749 else { 1750 1750 1751 1751 //poly temp_poly_l = pInit(); 1752 1752 //temp_poly_l = pCopy(l->getPoly()); … … 1760 1760 pNorm(temp); 1761 1761 //pWrite(temp); 1762 poly tempNF = kNF(gbPrev,currQuotient,temp); 1762 poly tempNF = kNF(gbPrev,currQuotient,temp); 1763 1763 pNorm(tempNF); 1764 1764 if(NULL == tempNF) { … … 1769 1769 } 1770 1770 l->setPoly(tempNF); 1771 1771 1772 1772 gPrevRedCheck = lTag->getFirstCurrentIdx(); 1773 1773 } … … 1778 1778 break; 1779 1779 } 1780 } 1780 } 1781 1781 } 1782 1782 else { … … 1816 1816 poly t = pHead(l->getPoly()); 1817 1817 // if l was already checked use the information in gPrevRedCheck such 1818 // that we can start searching for new reducers from this point and 1818 // that we can start searching for new reducers from this point and 1819 1819 // not from the first element of gPrev with the current index 1820 1820 temp = gPrevRedCheck; … … 1867 1867 temp = temp->getNext(); 1868 1868 } 1869 1869 1870 1870 // delete temp; 1871 1871 return NULL; … … 1881 1881 */ 1882 1882 ideal F5main(ideal id, ring r, int opt, int plus, int termination) { 1883 switch(opt) { 1883 switch(opt) { 1884 1884 case 0: 1885 1885 Print("\nComputations are done by the standard F5 Algorithm"); … … 1895 1895 return id; 1896 1896 } 1897 1897 1898 1898 int timer = initTimer(); 1899 1899 startTimer(); … … 1904 1904 poly pOne = pOne(); 1905 1905 number nOne = nInit(1); 1906 // tag the first element of index i-1 for criterion 1 1906 // tag the first element of index i-1 for criterion 1 1907 1907 //Print("LTAG BEGINNING: %p\n",lTag); 1908 1908 1909 1909 // DEBUGGING STUFF START 1910 1910 //Print("NUMBER: %d\n",r->N); 1911 /* 1911 /* 1912 1912 int* ev = new int[r->N +1]; 1913 1913 for(i=0;i<IDELEMS(id);i++) { … … 1923 1923 */ 1924 1924 /*DEBUGGING STUFF END */ 1925 1926 // first element in rTag is first element of rules which is NULL RNode, 1925 1926 // first element in rTag is first element of rules which is NULL RNode, 1927 1927 // this must be done due to possible later improvements 1928 1928 RList* rules = new RList(); … … 1933 1933 i = 1; 1934 1934 /*for(j=0; j<IDELEMS(id); j++) { 1935 if(NULL != id->m[j]) { 1935 if(NULL != id->m[j]) { 1936 1936 if(pComparePolys(id->m[j],ONE)) { 1937 1937 Print("One Polynomial in Input => Computations stopped\n"); … … 1939 1939 idNew->m[0] = ONE; 1940 1940 return(idNew); 1941 } 1942 } 1943 }*/ 1944 ideal idNew = kInterRed(id); 1941 } 1942 } 1943 }*/ 1944 ideal idNew = kInterRed(id); 1945 1945 id = idNew; 1946 1946 //qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]); … … 1948 1948 LList* gPrev = new LList(ONE, i, id->m[0]); 1949 1949 LList* reducers = new LList(); 1950 //idShow(id); 1950 //idShow(id); 1951 1951 //Print("%p\n",id->m[0]); 1952 1952 //pWrite(id->m[0]); … … 1968 1968 LNode* gPrevTag = gPrev->getLast(); 1969 1969 //Print("Last POlynomial in GPREV: "); 1970 //Print("%p\n",gPrevTag); 1970 //Print("%p\n",gPrevTag); 1971 1971 //pWrite(gPrevTag->getPoly()); 1972 1972 Print("Iteration: %d\n\n",i); … … 1975 1975 //Print("%d\n",gPrev->getLength()); 1976 1976 //Print("____________________________________ITERATION STEP DONE________________________________________\n"); 1977 1977 1978 1978 // DEBUGGING STUFF 1979 1979 LNode* temp = gPrev->getFirst(); 1980 1980 1981 1981 1982 1982 ///////////////////////////////////////////////////////////////////////////////// 1983 // // 1983 // // 1984 1984 // one needs to choose one of the following 3 implementations of the algorithm // 1985 // F5,F5R or F5C // 1985 // F5,F5R or F5C // 1986 1986 // // 1987 ///////////////////////////////////////////////////////////////////////////////// 1988 1989 1990 // 1987 ///////////////////////////////////////////////////////////////////////////////// 1988 1989 1990 // 1991 1991 // standard "F5" 1992 1992 // 1993 if(0 == opt) { 1993 if(0 == opt) { 1994 1994 if(gPrev->getLength() > gbLength) { 1995 1995 if(i < IDELEMS(id)) { … … 2022 2022 gbLength = gPrev->getLength(); 2023 2023 } 2024 2025 2026 // 2024 2025 2026 // 2027 2027 // "F5R" 2028 2028 // … … 2060 2060 gbLength = gPrev->getLength(); 2061 2061 } 2062 2063 2064 // 2062 2063 2064 // 2065 2065 // "F5C" 2066 2066 // 2067 if(2 == opt) { 2067 if(2 == opt) { 2068 2068 if(gPrev->getLength() > gbLength) { 2069 2069 if(i < IDELEMS(id)) { … … 2103 2103 } 2104 2104 } 2105 gbLength = gPrev->getLength(); 2106 } 2105 gbLength = gPrev->getLength(); 2106 } 2107 2107 } 2108 2108 … … 2112 2112 //Print("\n\nADDING TIME IN REDUCTION: %d\n\n",reductionTime); 2113 2113 Print("\n\nNumber of zero-reductions: %d\n",reductionsToZero); 2114 Print("Number of rules: %d\n",numberOfRules); 2115 Print("Number of rejected F5-critical pairs:%d\n",numberRejectedF5CriticalPairs); 2116 Print("Number of reductions: %d\n",numberOfReductions); 2117 Print("Elements not added to G: %d\n",notInG); 2114 Print("Number of rules: %d\n",numberOfRules); 2115 Print("Number of rejected F5-critical pairs:%d\n",numberRejectedF5CriticalPairs); 2116 Print("Number of reductions: %d\n",numberOfReductions); 2117 Print("Elements not added to G: %d\n",notInG); 2118 2118 Print("Highest Degree during computations: %d\n",highestDegree); 2119 2119 Print("Degree d_0 in F5+: %d\n",highestDegreeGBCriticalPair); … … 2134 2134 highestDegree = 0; 2135 2135 highestDegreeGBCriticalPair = 0; 2136 reductionTime = 0; 2136 reductionTime = 0; 2137 2137 spolsTime = 0; 2138 2138 numberUselessPairs = 0; -
kernel/f5gb.h
re40145 ra9c298 38 38 /* 39 39 ================================================== 40 computes incrementally gbs of subsets of the input 41 gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 40 computes incrementally gbs of subsets of the input 41 gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 42 42 ================================================== 43 43 */ … … 47 47 ================================================================ 48 48 computes a list of critical pairs for the next reduction process 49 the first element is always "useful" thus the critical pair 50 computed is either "useful" or "useless" depending on the second 49 the first element is always "useful" thus the critical pair 50 computed is either "useful" or "useless" depending on the second 51 51 element which generates the critical pair. 52 52 first element in gPrev is always the newest element which must … … 64 64 * Checks all remaining critical pairs, i.e. those of higher degree, 65 65 * by the two Buchberger criteria. 66 * return value: 0, if all remaining critical pairs are deleted by 66 * return value: 0, if all remaining critical pairs are deleted by 67 67 * Buchberger's criteria 68 68 * 1, otherwise 69 69 */ 70 bool arrisCheck(CNode* first,LNode* firstGCurr, long arrisdeg); 70 bool arrisCheck(CNode* first,LNode* firstGCurr, long arrisdeg); 71 71 72 72 /* 73 73 ================================================================ 74 74 computes a list of critical pairs for the next reduction process 75 the first element is always "useless" thus the critical pair 75 the first element is always "useless" thus the critical pair 76 76 computed is "useless". 77 77 first element in gPrev is always the newest element which must … … 131 131 /*! 132 132 * ================================================================================ 133 * searches for reducers of temp similar to the symbolic preprocessing of F4 and 133 * searches for reducers of temp similar to the symbolic preprocessing of F4 and 134 134 * divides them into a "good" and "bad" part: 135 * 135 * 136 136 * the "good" ones are the reducers which do not corrupt the label of temp, with 137 137 * these the normal form of temp is computed 138 138 * 139 * the "bad" ones are the reducers which corrupt the label of temp, they are tested 139 * the "bad" ones are the reducers which corrupt the label of temp, they are tested 140 140 * later on for possible new RuleOlds and S-polynomials to be added to the algorithm 141 141 * ================================================================================ 142 142 */ 143 void findReducers(LNode* l, LList* sPolyList, ideal gbPrev, LList* gPrev, LList* reducers, CListOld* critPairs, RList* rules, LTagList* lTag, RTagList* rTag, int termination, PList* rejectedGBList, int plus); 143 void findReducers(LNode* l, LList* sPolyList, ideal gbPrev, LList* gPrev, LList* reducers, CListOld* critPairs, RList* rules, LTagList* lTag, RTagList* rTag, int termination, PList* rejectedGBList, int plus); 144 144 145 145 /* … … 149 149 ===================================================================================== 150 150 */ 151 inline void topReduction(LNode* l, LList* sPolyList, LList* gPrev, CListOld* critPairs, RList* RuleOlds, LTagList* lTag, RTagList* rTag, ideal gbPrev, PList* rejectedGBList, int plus); 151 inline void topReduction(LNode* l, LList* sPolyList, LList* gPrev, CListOld* critPairs, RList* RuleOlds, LTagList* lTag, RTagList* rTag, ideal gbPrev, PList* rejectedGBList, int plus); 152 152 153 153 /* … … 159 159 160 160 poly p_MergeEq_q(poly p, poly q, const ring r); 161 */ 161 */ 162 162 /* 163 163 ===================================================================== -
kernel/f5lists.cc
re40145 ra9c298 39 39 PNode* PNode::insert(poly p) { 40 40 poly q = pOne(); 41 q = pCopy(p); 41 q = pCopy(p); 42 42 PNode* temp = this; 43 43 if(NULL == temp) { … … 83 83 first = first->insert(p); 84 84 } 85 85 86 86 87 87 /* … … 137 137 next = NULL; 138 138 } 139 139 140 140 LNode::LNode(LPolyOld* lp, LNode* l) { 141 141 //Print("HIER LNODE\n"); … … 149 149 next = NULL; 150 150 } 151 151 152 152 LNode::LNode(poly t, int i, poly p, RuleOld* r, LNode* l) { 153 153 LPolyOld* lp = new LPolyOld(t,i,p,r); … … 160 160 next = ln->getNext(); 161 161 } 162 162 163 163 LNode::~LNode() { 164 164 //delete next; 165 165 //Print("DELETE LNODE\n"); 166 delete data; 166 delete data; 167 167 } 168 168 … … 191 191 } 192 192 } 193 193 194 194 inline LNode* LNode::insert(poly t, int i, poly p, RuleOld* r) { 195 195 if(NULL == this) { … … 212 212 return newElement; 213 213 } 214 214 215 215 inline LNode* LNode::insertSP(poly t, int i, poly p, RuleOld* r) { 216 216 LNode* newElement = new LNode(t, i, p, r, this); … … 253 253 //Print("%p\n",temp); 254 254 //Print("%p\n",temp->data); 255 255 256 256 //Print("%p\n",temp->next); 257 257 } … … 302 302 //Print("%p\n",temp); 303 303 //Print("%p\n",temp->data); 304 304 305 305 //Print("%p\n",temp->next); 306 306 } … … 443 443 last = first; 444 444 length = 1; 445 } 445 } 446 446 447 447 LList::~LList() { … … 558 558 next = NULL; 559 559 } 560 560 561 561 LTagNode::LTagNode(LNode* l, LTagNode* n) { 562 562 data = l; … … 565 565 566 566 LTagNode::~LTagNode() { 567 delete data; 568 } 569 567 delete data; 568 } 569 570 570 // declaration with first as parameter due to sorting of LTagList 571 571 LTagNode* LTagNode::insert(LNode* l) { … … 607 607 LTagList::LTagList() { 608 608 LTagNode* first = new LTagNode(); 609 609 610 610 length = 0; 611 611 } … … 679 679 680 680 CNode::CNode() { 681 data = NULL; 682 next = NULL; 681 data = NULL; 682 next = NULL; 683 683 } 684 684 685 685 CNode::CNode(CPairOld* c) { 686 data = c; 687 next = NULL; 686 data = c; 687 next = NULL; 688 688 } 689 689 690 690 CNode::CNode(CPairOld* c, CNode* n) { 691 data = c; 692 next = n; 691 data = c; 692 next = n; 693 693 } 694 694 … … 699 699 // insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label 700 700 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels 701 // working only with linked, but not doubly linked lists due to memory usage we have to check the 701 // working only with linked, but not doubly linked lists due to memory usage we have to check the 702 702 // insertion around the first element separately from the insertion around all other elements in the list 703 703 CNode* CNode::insert(CPairOld* c) { … … 724 724 CNode* temp = this; 725 725 while( NULL != temp->next) { 726 if(temp->next->data->getDeg() == c->getDeg() ) { 726 if(temp->next->data->getDeg() == c->getDeg() ) { 727 727 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { 728 728 temp = temp->next; … … 732 732 temp->next = newElement; 733 733 return this; 734 } 734 } 735 735 } 736 736 else { … … 747 747 if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element 748 748 CNode* temp = this; 749 while( NULL != temp->next ) { 749 while( NULL != temp->next ) { 750 750 if( c->getDeg() < temp->next->data->getDeg() ) { 751 751 CNode* newElement = new CNode(c, temp->next); … … 754 754 } 755 755 if( c->getDeg() == temp->next->data->getDeg() ) { 756 if(1 != pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { 756 if(1 != pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { 757 757 CNode* newElement = new CNode(c, temp->next); 758 758 temp->next = newElement; … … 762 762 temp = temp->next; 763 763 while( NULL != temp->next ) { 764 if( temp->next->data->getDeg() == c->getDeg() ) { 764 if( temp->next->data->getDeg() == c->getDeg() ) { 765 765 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(), 766 766 temp->next->data->getLp1Term()))) { … … 771 771 temp->next = newElement; 772 772 return this; 773 } 773 } 774 774 } 775 775 else { … … 810 810 temp = temp->next; 811 811 } 812 CNode* returnCNode = temp->next; 813 // every CListOld should end with a (NULL,NULL) element for a similar behaviour 812 CNode* returnCNode = temp->next; 813 // every CListOld should end with a (NULL,NULL) element for a similar behaviour 814 814 // using termination conditions throughout the algorithm 815 815 temp->next = NULL; … … 1000 1000 1001 1001 RNode* RNode::insertOrdered(RuleOld* r) { 1002 RNode* newElement = new RNode(r); 1002 RNode* newElement = new RNode(r); 1003 1003 RNode* temp = this; 1004 1004 if(NULL == temp) { … … 1022 1022 RNode* RNode::getNext() { 1023 1023 return next; 1024 } 1024 } 1025 1025 1026 1026 RuleOld* RNode::getRuleOld() { … … 1074 1074 } 1075 1075 //Print("FERTIG\n"); 1076 } 1076 } 1077 1077 1078 1078 void RList::insert(int i, poly t) { … … 1110 1110 next = NULL; 1111 1111 } 1112 1112 1113 1113 RTagNode::RTagNode(RNode* r) { 1114 1114 data = r; 1115 1115 next = NULL; 1116 1116 } 1117 1117 1118 1118 RTagNode::RTagNode(RNode* r, RTagNode* n) { 1119 1119 1120 1120 data = r; 1121 1121 next = n; … … 1123 1123 1124 1124 RTagNode::~RTagNode() { 1125 delete data; 1126 } 1127 1125 delete data; 1126 } 1127 1128 1128 // declaration with first as parameter due to sorting of RTagList 1129 1129 RTagNode* RTagNode::insert(RNode* r) { … … 1156 1156 else { 1157 1157 int j; 1158 RTagNode* temp = this; 1158 RTagNode* temp = this; 1159 1159 //Print("\n\nHIER IN GET IDX\n"); 1160 //Print("FOR LOOP: %d\n",length-idx+1); 1160 //Print("FOR LOOP: %d\n",length-idx+1); 1161 1161 for(j=1; j<=length-idx+1; j++) { 1162 1162 temp = temp->next; -
kernel/f5lists.h
re40145 ra9c298 13 13 ============================ 14 14 ============================ 15 classes for lists used in F5 15 classes for lists used in F5 16 16 ============================ 17 17 ============================ … … 35 35 */ 36 36 class PNode { 37 private: 37 private: 38 38 poly data; 39 39 PNode* next; … … 56 56 bool check(poly p); 57 57 void print(); 58 }; 59 58 }; 59 60 60 /* 61 61 ======================================= … … 102 102 poly getPoly(); 103 103 poly getTerm(); 104 int getIndex(); 104 int getIndex(); 105 105 RuleOld* getRuleOld(); 106 106 bool getDel(); … … 209 209 /* 210 210 ====================================================================================== 211 class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements 211 class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements 212 212 of the lists LList* completed & LList* sPolyList 213 213 ====================================================================================== … … 238 238 CNode(CPairOld* c); 239 239 CNode(CPairOld* c, CNode* n); 240 ~CNode(); 241 CNode* insert(CPairOld* c); 242 CNode* insertWithoutSort(CPairOld* cp); 240 ~CNode(); 241 CNode* insert(CPairOld* c); 242 CNode* insertWithoutSort(CPairOld* cp); 243 243 CNode* getMinDeg(); 244 244 CPairOld* getData(); … … 250 250 poly getLp1Term(); 251 251 poly getLp2Term(); 252 poly getT1(); 253 poly* getAdT1(); 254 poly getT2(); 255 poly* getAdT2(); 252 poly getT1(); 253 poly* getAdT1(); 254 poly getT2(); 255 poly* getAdT2(); 256 256 int getLp1Index(); 257 257 int getLp2Index(); … … 272 272 public: 273 273 // for initialization of CListOlds, last element alwas has data=NULL and next=NULL 274 CListOld(); 275 CListOld(CPairOld* c); 276 ~CListOld(); 274 CListOld(); 275 CListOld(CPairOld* c); 276 ~CListOld(); 277 277 CNode* getFirst(); 278 278 void insert(CPairOld* c); -
kernel/fast_maps.cc
re40145 ra9c298 469 469 return NULL; 470 470 } 471 if (/*(*/ p==NULL /*)*/) /* && (e>0)*/ 471 if (/*(*/ p==NULL /*)*/) /* && (e>0)*/ 472 472 { 473 473 p=p_Copy(pp /*dest_id[i-1]*/,dest_r); … … 482 482 } 483 483 if (is_const) 484 { 484 { 485 485 assume(p==NULL); 486 486 p=p_ISet(1,dest_r); -
kernel/fast_maps.h
re40145 ra9c298 6 6 * Purpose: implementation of fast maps 7 7 * Author: obachman (Olaf Bachmann), hannes (Hannes Schoenemann), 8 * bricken (Michael Brickenstein) 8 * bricken (Michael Brickenstein) 9 9 * Created: 01/02 10 10 *******************************************************************/ … … 34 34 }; 35 35 36 class macoeff_s 36 class macoeff_s 37 37 { 38 38 public: … … 60 60 mapoly maMonomial_Create(poly p, ring , sBucket_pt bucket = NULL); 61 61 // unconditionally destroys a maMonomial: 62 // src: LmFree 63 // dest: p_Delete 62 // src: LmFree 63 // dest: p_Delete 64 64 // coeffs: delete list 65 65 void maMonomial_Destroy(mapoly monomial, ring src_r, ring dest_r = NULL); … … 68 68 { 69 69 monomial->ref--; 70 if (monomial->ref <= 0) 70 if (monomial->ref <= 0) 71 71 { maMonomial_Destroy(monomial, src_r, dest_r); return NULL;} 72 72 return monomial; … … 87 87 88 88 // creates mpoly and mideal 89 void maMap_CreatePolyIdeal(ideal map_id, ring map_r, 89 void maMap_CreatePolyIdeal(ideal map_id, ring map_r, 90 90 ring src_r, ring dest_r, 91 91 mapoly &mp, maideal &mideal); 92 92 // creates src_r: rings with weights 93 93 // dest_r: where we do our computations 94 void maMap_CreateRings(ideal map_id, ring map_r, 95 ideal image_id, ring image_r, 94 void maMap_CreateRings(ideal map_id, ring map_r, 95 ideal image_id, ring image_r, 96 96 ring &src_r, ring &dest_r, BOOLEAN &no_sort); 97 97 -
kernel/febase.cc
re40145 ra9c298 46 46 char prompt_char = '>'; /*1 either '>' or '.'*/ 47 47 int yylineno = 0; 48 int myynest = -1; 48 int myynest = -1; 49 49 int traceit = 0; 50 50 char my_yylinebuf[80]; -
kernel/feread.cc
re40145 ra9c298 114 114 #define rl_completion_matches completion_matches 115 115 #endif 116 #ifndef READLINE_READLINE_H_OK 116 #ifndef READLINE_READLINE_H_OK 117 117 /* declare everything we need explicitely and do not rely on includes */ 118 118 extern char * rl_readline_name; … … 149 149 */ 150 150 #if defined(HAVE_DYN_RL) 151 extern "C" 151 extern "C" 152 152 { 153 153 int fe_init_dyn_rl(); -
kernel/gr_kstd2.cc
re40145 ra9c298 274 274 // Print("nach nc_rat_ReduceSpolyNew ");wrp(c_p);PrintLn(); 275 275 // pDelete(&((*h).p)); 276 276 277 277 c_p=nc_rat_ReduceSpolyNew(strat->S[c_j],(*h).p, currRing->real_var_start-1,currRing); 278 278 (*h).p=c_p; -
kernel/hdegree.cc
re40145 ra9c298 985 985 int i; 986 986 int k = ak; 987 987 988 988 #if HAVE_RINGS 989 989 if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1)) … … 1450 1450 assume(p_ind!=NULL); 1451 1451 assume(res->m[ind]==p_ind); 1452 hEdge=p_ind; 1452 hEdge=p_ind; 1453 1453 res->m[ind]=NULL; 1454 1454 nDelete(&pGetCoeff(hEdge)); … … 1457 1457 pIncrExp(hEdge,i); 1458 1458 pSetm(hEdge); 1459 1459 1460 1460 idDelete(&res); 1461 1461 return; -
kernel/ideals.cc
re40145 ra9c298 1219 1219 intvec * weights; 1220 1220 hom = (tHomog)idHomModule(h1,currQuotient,&weights); 1221 if /**addOnlyOne &&*/ (/*(*/ !h1IsStb /*)*/) 1221 if /**addOnlyOne &&*/ (/*(*/ !h1IsStb /*)*/) 1222 1222 temph1 = kStd(h1,currQuotient,hom,&weights,NULL); 1223 1223 else … … 2567 2567 if (id->m[i] != NULL) pDelete(&id->m[i]); 2568 2568 } 2569 int kk=k; 2570 if (k==0) kk=1; /* ideals must have at least one element(0)*/ 2571 pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id)); 2572 IDELEMS(id) = kk; 2569 int kk=k; 2570 if (k==0) kk=1; /* ideals must have at least one element(0)*/ 2571 pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id)); 2572 IDELEMS(id) = kk; 2573 2573 } 2574 2574 -
kernel/ideals.h
re40145 ra9c298 29 29 /// delete an ideal 30 30 inline void idDelete (ideal* h, ring r = currRing) 31 { 32 id_Delete(h, r); 31 { 32 id_Delete(h, r); 33 33 } 34 34 35 35 /// initialise the maximal ideal (at 0) 36 //ideal id_MaxIdeal(int deg, const ring r); 36 //ideal id_MaxIdeal(int deg, const ring r); 37 37 #define idMaxIdeal(D) id_MaxIdeal(D,currRing) 38 38 … … 48 48 poly* mm = id->m; 49 49 while ((j >= 0) && (mm[j] == NULL)) j--; 50 return (j + 1); 50 return (j + 1); 51 51 } 52 52 -
kernel/khstd.cc
re40145 ra9c298 135 135 void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, 136 136 kStrategy strat) 137 137 138 138 /* 139 139 This will be used for the local orderings in the case of the inhomogenous ideals. 140 140 Assume f1,...,fs are already in the standard basis. Test if hilb(LM(f1),...,LM(fs),1) 141 is equal to the inputed one. 141 is equal to the inputed one. 142 142 If no, do nothing. 143 143 If Yes, we know that all polys that we need are already in the standard basis … … 198 198 return; 199 199 } 200 200 201 201 id_Delete(&Lm,currRing); 202 202 -
kernel/kspoly.cc
re40145 ra9c298 76 76 { 77 77 // for the time being: we know currRing==strat->tailRing 78 // no exp-bound checking needed 78 // no exp-bound checking needed 79 79 // (only needed if exp-bound(tailring)<exp-b(currRing)) 80 80 if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef); 81 else 81 else 82 82 { 83 83 poly _p = (PR->t_p != NULL ? PR->t_p : PR->p); … … 150 150 poly qq = p_Shrink(PR->p, currRing->isLPring, currRing); 151 151 PR->Clear(); // does the right things 152 PR->p = qq; 152 PR->p = qq; 153 153 PR->t_p = NULL; 154 154 PR->SetShortExpVector(); 155 155 } 156 156 #endif 157 157 158 158 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 159 159 if (TEST_OPT_DEBUG) … … 202 202 * -------------------------------------------- 203 203 * if strat->incremental 204 * Since we are subdividing lower index and 204 * Since we are subdividing lower index and 205 205 * current index reductions it is enough to 206 206 * look at the polynomial part of the signature … … 212 212 * Schreyer order 213 213 * 214 * nevertheless, this different behaviour is 214 * nevertheless, this different behaviour is 215 215 * taken care of by is_sigsafe 216 216 * => one reduction procedure can be used for … … 258 258 // signature of fm*p1 259 259 if(sigSafe != 1) 260 { 260 { 261 261 PR->is_redundant = TRUE; 262 262 return 3; … … 283 283 { 284 284 // for the time being: we know currRing==strat->tailRing 285 // no exp-bound checking needed 285 // no exp-bound checking needed 286 286 // (only needed if exp-bound(tailring)<exp-b(currRing)) 287 287 if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef); 288 else 288 else 289 289 { 290 290 poly _p = (PR->t_p != NULL ? PR->t_p : PR->p); … … 357 357 poly qq = p_Shrink(PR->p, currRing->isLPring, currRing); 358 358 PR->Clear(); // does the right things 359 PR->p = qq; 359 PR->p = qq; 360 360 PR->t_p = NULL; 361 361 PR->SetShortExpVector(); … … 485 485 poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing); 486 486 Pair->Clear(); // does the right things 487 Pair->p = qq; 487 Pair->p = qq; 488 488 Pair->t_p = NULL; 489 489 Pair->SetShortExpVector(); … … 540 540 poly qq = p_Shrink(PR->p, currRing->isLPring, currRing); 541 541 PR->Clear(); // does the right things 542 PR->p = qq; 542 PR->p = qq; 543 543 PR->t_p = NULL; 544 544 PR->SetShortExpVector(); -
kernel/kstdfac.cc
re40145 ra9c298 1001 1001 } 1002 1002 // delete L[j], 1003 Li=L; 1003 Li=L; 1004 1004 if (Lj_prev!=NULL) 1005 1005 { -
kernel/kutil.h
re40145 ra9c298 79 79 BOOLEAN is_normalized; // true, if pNorm was called on p, false otherwise 80 80 // used in incremental sba() with F5C: 81 // we know some of the redundant elements in 81 // we know some of the redundant elements in 82 82 // strat->T beforehand, so we can just discard 83 83 // them and do not need to consider them in the … … 91 91 92 92 93 #ifdef HAVE_PLURAL 93 #ifdef HAVE_PLURAL 94 94 BOOLEAN is_special; // true, it is a new special S-poly (e.g. for SCA) 95 95 #endif 96 96 97 97 // initialization 98 98 KINLINE void Init(ring r = currRing); … … 420 420 void initEcartPairBba (LObject* Lp,poly f,poly g,int ecartF,int ecartG); 421 421 void initEcartPairMora (LObject* Lp,poly f,poly g,int ecartF,int ecartG); 422 int posInS (const kStrategy strat, const int length, const poly p, 422 int posInS (const kStrategy strat, const int length, const poly p, 423 423 const int ecart_p); 424 424 int posInT0 (const TSet set,const int length,LObject &p); … … 508 508 void initSLSba (ideal F, ideal Q,kStrategy strat); 509 509 /************************************************* 510 * when initializing a new bunch of principal 510 * when initializing a new bunch of principal 511 511 * syzygies at the beginning of a new iteration 512 * step in a signature-based algorithm we 512 * step in a signature-based algorithm we 513 513 * compute ONLY the leading elements of those 514 514 * syzygies, NOT the whole syzygy … … 624 624 void initBba(ideal F,kStrategy strat); 625 625 void initSba(ideal F,kStrategy strat); 626 void f5c (kStrategy strat, int& olddeg, int& minimcnt, int& hilbeledeg, 626 void f5c (kStrategy strat, int& olddeg, int& minimcnt, int& hilbeledeg, 627 627 int& hilbcount, int& srmax, int& lrmax, int& reduc, ideal Q, 628 628 intvec *w,intvec *hilb ); … … 771 771 void enterpairsShift (poly h,int k,int ecart,int pos,kStrategy strat, int atR,int uptodeg, int lV); 772 772 773 void initenterpairsShift (poly h,int k,int ecart,int isFromQ,kStrategy strat, int atR,int uptodeg, int lV); 773 void initenterpairsShift (poly h,int k,int ecart,int isFromQ,kStrategy strat, int atR,int uptodeg, int lV); 774 774 775 775 void updateSShift(kStrategy strat,int uptodeg,int lV); -
kernel/linearAlgebra.h
re40145 ra9c298 1 1 /*****************************************************************************\ 2 * Computer Algebra System SINGULAR 2 * Computer Algebra System SINGULAR 3 3 \*****************************************************************************/ 4 4 /** @file lineareAlgebra.h 5 * 5 * 6 6 * This file provides basic linear algebra functionality. 7 7 * … … 515 515 * d linear equation systems. It is hence an application of other methods 516 516 * defined in this h-file and its corresponding cc-file. 517 * 517 * 518 518 **/ 519 519 void henselFactors( -
kernel/mod2.h
re40145 ra9c298 66 66 /* procedures to compute groebner bases with the f5 implementation */ 67 67 /* still testing */ 68 #undef HAVE_F5 68 #undef HAVE_F5 69 69 70 70 /* procedures to compute groebner bases with the f5c implementation */ … … 186 186 ... 187 187 188 makes sure that all poly operations in your file are done with 188 makes sure that all poly operations in your file are done with 189 189 PDEBUG == 2 190 190 To break after an error occured, set a debugger breakpoint on 191 dErrorBreak. 191 dErrorBreak. 192 192 */ 193 193 #ifndef PDEBUG … … 223 223 1 : addresses are only marked as free and not really freed. 224 224 225 OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis 225 OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis 226 226 (as can OM_NDEBUG), e.g.: 227 227 #define OM_CHECK 3 … … 230 230 #include "mod2.h" 231 231 #include <omalloc/omalloc.h> 232 ensures that all memory allocs/free in this file are done with 233 OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed 232 ensures that all memory allocs/free in this file are done with 233 OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed 234 234 in this file are only marked as free and never really freed. 235 236 To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set 237 om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and 238 om_Opts.Keep to the number of addresses which are kept before they are 235 236 To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set 237 om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and 238 om_Opts.Keep to the number of addresses which are kept before they are 239 239 actually freed. E.g.: 240 240 int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; … … 243 243 om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; 244 244 ensures that all calls omDebug routines occuring during the computation of 245 ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and 245 ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and 246 246 calls to omFree only mark addresses as free and not really free them. 247 247 248 Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies 249 how many addresses are kept before they are actually freed, independently 248 Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies 249 how many addresses are kept before they are actually freed, independently 250 250 of the value of OM_KEEP. 251 251 … … 260 260 Under dynamic scope, do (e.g., from within the debugger): 261 261 om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; 262 + to find out where "memory corruption" occured, increase value of 263 OM_CHECK - the higher this value is, the more consistency checks are 264 done (However a value > 3 checks the entire memory each time an omalloc 262 + to find out where "memory corruption" occured, increase value of 263 OM_CHECK - the higher this value is, the more consistency checks are 264 done (However a value > 3 checks the entire memory each time an omalloc 265 265 routine is used!) 266 266 267 267 Some more tips on the usage of omalloc: 268 + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines 268 + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines 269 269 assume that sizes are > 0 and pointers are != NULL 270 270 + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow 271 271 NULL pointers and sizes == 0 272 + You can safely use any free/realloc routine in combination with any alloc 272 + You can safely use any free/realloc routine in combination with any alloc 273 273 routine (including the debug versions): E.g., an address allocated with 274 omAllocBin can be freed with omfree, or an adress allocated with 274 omAllocBin can be freed with omfree, or an adress allocated with 275 275 om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. 276 However, keep in mind that the efficiency decreases from 276 However, keep in mind that the efficiency decreases from 277 277 Bin over Size to General routines (i.e., omFreeBin is more efficient than 278 278 omFreeSize which is more efficient than omFree, likewise with the alloc 279 279 routines). 280 280 + if OM_CHECK is undefined or 0, then all omCheck routines do nothing 281 + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is 282 defined, then the "real" alloc/realloc/free macros are used, and all 281 + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is 282 defined, then the "real" alloc/realloc/free macros are used, and all 283 283 omTest, omDebug and omCheck routines are undefined 284 + to break after an omError occured within a debugger, 284 + to break after an omError occured within a debugger, 285 285 set a breakpoint on dErrorBreak 286 + to do checks from within the debugger, or to do checks with explicit 286 + to do checks from within the debugger, or to do checks with explicit 287 287 check level, use omTest routines. 288 288 */ … … 296 296 #define OM_CHECK 1 297 297 #endif 298 /* Do actually free memory: 299 (be careful: if this is set, memory is never really freed, 298 /* Do actually free memory: 299 (be careful: if this is set, memory is never really freed, 300 300 but only marked as free) */ 301 301 #ifndef OM_KEEP 302 302 #define OM_KEEP 0 303 303 #endif 304 /* but only after you have freed 1000 more addresses 304 /* but only after you have freed 1000 more addresses 305 305 (this is actually independent of the value of OM_KEEP and used 306 306 to initialize om_Opts.Keep) */ … … 312 312 313 313 314 /* undef KDEBUG for check of data during std computations 314 /* undef KDEBUG for check of data during std computations 315 315 * 316 316 * define KDEBUG to 317 317 * 0 for basic tests 318 * 1 for tests in kSpoly 319 * NOTE: You can locally enable tests in kspoly by setting the 318 * 1 for tests in kSpoly 319 * NOTE: You can locally enable tests in kspoly by setting the 320 320 * define at the beginning of kspoly.cc 321 321 */ … … 433 433 #ifdef HAVE_ASSUME 434 434 #ifndef RDEBUG 435 #define RDEBUG 435 #define RDEBUG 436 436 #endif 437 437 #endif -
kernel/nc.cc
re40145 ra9c298 1 1 #define PLURAL_INTERNAL_DECLARATIONS 2 2 3 3 #ifdef HAVE_CONFIG_H 4 4 #include "singularconfig.h" … … 287 287 var[i]=pCopy(x); 288 288 } 289 // init NF's 289 // init NF's 290 290 for (i=1; i<=N; i++ ) 291 291 { … … 306 306 h2->m[j]=0; 307 307 } 308 // W[1..idElems(I)] 308 // W[1..idElems(I)] 309 309 if (flag >0) 310 310 { … … 372 372 syzcnt++; 373 373 idDelete(&s_h3); 374 } // end if flag >0 374 } // end if flag >0 375 375 else 376 376 { -
kernel/nc.h
re40145 ra9c298 57 57 gb = gnc_gr_bba; 58 58 } 59 59 60 60 r->GetNC()->p_Procs.GB = cast_A_to_vptr(gb); 61 61 } -
kernel/old.Ideal.h
re40145 ra9c298 17 17 IdealBase(){ 18 18 } 19 20 IdealBase(iterator first, 21 22 23 19 20 IdealBase(iterator first, 21 iterator last, 22 const typename 23 std::vector<poly_type>::allocator_type& __a = allocator_type()): 24 24 storage(first,last,__a) 25 25 { 26 26 27 27 } 28 28 ring getRing() const{ … … 84 84 } 85 85 } 86 Ideal(iterator first, 87 88 86 Ideal(iterator first, 87 iterator last, 88 const allocator_type& __a = allocator_type()): 89 89 IdealBase<Poly>(first,last,__a){ 90 90 } … … 92 92 //no checks for rings 93 93 int s=size(); 94 94 95 95 if (s==0) 96 96 s=1; 97 97 98 98 ideal result=idInit(s,1); 99 99 result->m[0]=NULL; … … 114 114 } 115 115 ideal as_module() const{ 116 116 117 117 //no checks for rings 118 118 int s=size(); 119 119 120 120 if (s==0) 121 121 s=1; 122 122 123 123 ideal result=idInit(s,1); 124 124 result->m[0]=NULL; … … 133 133 result->rank=idRankFreeModule(result,storage[0].getRing()); 134 134 return result; 135 135 136 136 } 137 Module(iterator first, 138 139 137 Module(iterator first, 138 iterator last, 139 const allocator_type& __a = allocator_type()): 140 140 IdealBase<Vector>(first,last,__a){ 141 141 } -
kernel/old.Number.h
re40145 ra9c298 15 15 else { 16 16 r->ref--; 17 17 18 18 } 19 19 //Print("ref count after release: %d", r->ref); … … 29 29 class Vector; 30 30 class Number{ 31 31 32 32 public: 33 33 friend Number operator+(const Number& n1, const Number& n2); … … 117 117 return *this; 118 118 } 119 119 120 120 Number& operator+=(int n2){ 121 121 number n2n=n_Init(n2,r.get()); … … 143 143 return *this; 144 144 } 145 Number& operator/=(int n2){ 145 Number& operator/=(int n2){ 146 146 number n2n=n_Init(n2,r.get()); 147 147 number nv=n_Div(n,n2n,r.get()); … … 187 187 n_Write(towrite,r.get()); 188 188 } 189 189 190 190 ~Number(){ 191 191 if (r!=NULL) -
kernel/old.Poly.h
re40145 ra9c298 100 100 } 101 101 p=p_Add_q(p,p_Copy(p2.p,p2.r.get()),r.get()); 102 102 103 103 return *this; 104 104 } … … 121 121 return *this; 122 122 } 123 123 124 124 p=p_Mult_nn(p,n.n,r.get()); 125 125 return *this; … … 140 140 p=p_Add_q(p,pc,r.get()); 141 141 142 142 143 143 return *this; 144 144 } … … 146 146 147 147 PolyImpl& operator=(int n){ 148 148 149 149 p_Delete(&p,r.get()); 150 150 p=p_ISet(n,r.get()); 151 151 return *this; 152 153 } 154 152 153 } 154 155 155 156 156 PolyImpl(){ … … 175 175 } 176 176 PolyImpl(const Number & n){ 177 177 178 178 r=n.r.get(); 179 179 this->p=p_NSet(n_Copy(n.n,r.get()),r.get()); 180 180 181 181 } 182 182 explicit PolyImpl(int n){ … … 262 262 return p_LmIsConstant(t,r); 263 263 } 264 264 265 265 }; 266 266 … … 269 269 { 270 270 271 271 272 272 private: 273 273 poly t; … … 332 332 } 333 333 return res; 334 } 334 } 335 335 void copy_on_write(){ 336 336 if (!ptr.unique()){ … … 366 366 copy_on_write(); 367 367 *ptr += *p2.ptr; 368 368 369 369 return *this; 370 370 } … … 373 373 copy_on_write(); 374 374 *ptr *=n; 375 375 376 376 return *this; 377 377 } … … 411 411 } 412 412 protected: 413 413 414 414 PolyBase(PolyImpl& impl):ptr(&impl){ 415 415 416 416 } 417 417 poly getInternalReference(){ … … 434 434 } 435 435 Poly(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){ 436 436 437 437 } 438 438 Poly(const char* c, ring r=currRing):Base(c,r){ … … 441 441 Poly(const Base& p):Base(p){ 442 442 } 443 443 444 444 Poly(const Number& n):Base(*(new PolyImpl(n))){ 445 445 446 446 } 447 447 Poly(poly p, ring r):Base(p,r){ 448 448 449 449 } 450 450 Poly(poly p, ring r, int):Base(p,r,0){ … … 486 486 } 487 487 Vector(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){ 488 488 489 489 } 490 490 Vector(const char* c, ring r=currRing):Base(c,r){ … … 493 493 Vector(const Base& p):Base(p){ 494 494 } 495 495 496 496 497 497 Vector(poly p, ring r):Base(p,r){ 498 498 499 499 } 500 500 Vector(poly p, ring r, int):Base(p,r,0){ … … 556 556 557 557 //assumes monomials commute with numbers 558 template <poly_variant variant, class create_type, class error_traits> 559 inline typename PolyBase<variant,create_type, error_traits>::create_type 558 template <poly_variant variant, class create_type, class error_traits> 559 inline typename PolyBase<variant,create_type, error_traits>::create_type 560 560 operator* 561 (const Number& n, 561 (const Number& n, 562 562 const PolyBase<variant,create_type, class error_tratis>& p) 563 563 { … … 589 589 return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1); 590 590 } 591 template <poly_variant variant, class create_type,class error_traits> 592 inline typename PolyBase<variant,create_type,error_traits>::create_type 591 template <poly_variant variant, class create_type,class error_traits> 592 inline typename PolyBase<variant,create_type,error_traits>::create_type 593 593 operator+ 594 (const PolyBase<variant,create_type,error_traits>& b1, 594 (const PolyBase<variant,create_type,error_traits>& b1, 595 595 const PolyBase<variant,create_type,error_traits>& b2) 596 596 { … … 609 609 return res; 610 610 } 611 template <poly_variant variant, class create_type, class error_traits> 612 613 inline PolyBase<variant, create_type, error_traits>& 611 template <poly_variant variant, class create_type, class error_traits> 612 613 inline PolyBase<variant, create_type, error_traits>& 614 614 PolyBase<variant, create_type, error_traits>::operator*=(const Poly & p2){ 615 615 copy_on_write(); 616 616 *ptr *= *p2.ptr; 617 617 618 618 return *this; 619 619 } -
kernel/old.PowerSeries.h
re40145 ra9c298 8 8 std::input_iterator_tag, 9 9 typename traits::expansion_type, 10 int, 10 int, 11 11 shared_ptr<const typename traits::expansion_type>, 12 const typename traits::expansion_type 12 const typename traits::expansion_type 13 13 > { 14 14 private: … … 23 23 denominator_type lastPot; 24 24 public: 25 PowerSeriesInputIterator(numerator_type num_arg, 26 27 data(den_arg.getRing()), 25 PowerSeriesInputIterator(numerator_type num_arg, 26 denominator_type den_arg): 27 data(den_arg.getRing()), 28 28 lastPot(den_arg.getRing()), 29 29 numerator(num_arg), … … 37 37 typename traits::denominator_type::iterator end=denominator.end(); 38 38 while(it!=end){ 39 39 40 40 if ((*it).isConstant()){ 41 42 43 44 41 //change this type 42 c=denominator_type(*it).leadCoef(); 43 44 break; 45 45 } 46 46 47 47 ++it; 48 49 50 48 49 50 51 51 } 52 52 c=Number(1,r)/c; … … 54 54 denominator*=c; 55 55 toPot=denominator+denominator_type(-1,r); 56 56 57 57 toPot*=Number(-1,r); 58 58 //change this type … … 60 60 data=numerator; 61 61 state=0; 62 62 63 63 } 64 64 PowerSeriesInputIterator(){ … … 72 72 while(it!=end){ 73 73 if(it->lmTotalDegree()<state){ 74 74 remove+=expansion_type(*it); 75 75 } 76 76 it++; … … 86 86 while(it!=end){ 87 87 if(it->lmTotalDegree()==state) 88 89 90 88 { 89 res+=expansion_type(*it); 90 } 91 91 it++; 92 92 } … … 97 97 shorten(); 98 98 lastPot*=toPot; 99 99 100 100 data+=lastPot*numerator; 101 102 101 102 103 103 return *this; 104 104 105 105 } 106 106 //bad if this are iterators for different PowerSeries … … 136 136 numerator_type numerator; 137 137 public: 138 138 139 139 PowerSeriesBase(){ 140 140 } … … 150 150 return iterator(); 151 151 } 152 152 153 153 154 154 }; -
kernel/old.lplist.h
re40145 ra9c298 129 129 #endif 130 130 #endif 131 131 -
kernel/old.si_gmp.h
re40145 ra9c298 15 15 #endif 16 16 17 #endif 17 #endif 18 18 #endif /* ! INCL_CF_GMP_H */ -
kernel/polys.h
re40145 ra9c298 246 246 ***************************************************************/ 247 247 inline int pWeight(int i, const ring R = currRing){ return p_Weight(i, R); } 248 248 249 249 250 250 static inline long pTotaldegree(poly p) { return p_Totaldegree(p,currRing); } … … 306 306 // On return all components pf *q == 0 307 307 inline void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R = currRing) 308 { 308 { 309 309 return p_TakeOutComp(p, comp, q, lq, R); 310 310 } -
kernel/preimage.cc
re40145 ra9c298 71 71 if (rIsPluralRing(theImageRing)) 72 72 { 73 if ((rIsPluralRing(sourcering)) && (ncRingType(sourcering)!=nc_comm)) 73 if ((rIsPluralRing(sourcering)) && (ncRingType(sourcering)!=nc_comm)) 74 74 { 75 75 Werror("Sorry, not yet implemented for noncomm. rings"); … … 78 78 } 79 79 #endif 80 80 81 81 int i,j; 82 82 poly p,/*pp,*/q; … … 104 104 105 105 const ring save_ring = currRing; if (currRing!=tmpR) rChangeCurrRing(tmpR); // due to kStd 106 106 107 107 if (id==NULL) 108 108 j = 0; … … 120 120 { 121 121 p = p_SortMerge( 122 123 122 pChangeSizeOfPoly(theImageRing, theMap->m[i], 1, imagepvariables, tmpR), 123 tmpR); 124 124 p=p_Add_q(p,q,tmpR); 125 125 } … … 134 134 { 135 135 temp1->m[i] = p_SortMerge( 136 137 136 pChangeSizeOfPoly(theImageRing, id->m[i-sourcering->N], 1, imagepvariables, tmpR), 137 tmpR); 138 138 } 139 139 for (i=sourcering->N+j0;i<sourcering->N+j;i++) 140 140 { 141 141 temp1->m[i] = p_SortMerge( 142 143 142 pChangeSizeOfPoly(theImageRing, theImageRing->qideal->m[i-sourcering->N-j0], 1, imagepvariables, tmpR), 143 tmpR); 144 144 } 145 145 // we ignore here homogenity - may be changed later: … … 163 163 { 164 164 q = p_SortMerge( 165 166 165 pChangeSizeOfPoly(tmpR, p, imagepvariables+1, N, sourcering), 166 sourcering); 167 167 if (j>=IDELEMS(temp1)) 168 168 { … … 178 178 179 179 if (currRing!=save_ring) rChangeCurrRing(save_ring); 180 180 181 181 rDelete(tmpR); 182 182 return temp1; -
kernel/ratgring.cc
re40145 ra9c298 38 38 } 39 39 pSetComp(m, si_max(pGetComp(a), pGetComp(b))); 40 /* Don't do a pSetm here, otherwise hres/lres chockes */ 40 /* Don't do a pSetm here, otherwise hres/lres chockes */ 41 41 } 42 42 … … 85 85 // } 86 86 // pSetComp(m, si_max(pGetComp(a), pGetComp(b))); 87 // /* Don't do a pSetm here, otherwise hres/lres chockes */ 87 // /* Don't do a pSetm here, otherwise hres/lres chockes */ 88 88 // } 89 89 … … 105 105 } 106 106 107 /* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials 107 /* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials 108 108 have the same D-part and the component 0 109 109 does not destroy p … … 143 143 } 144 144 // p_wrp(*p,r);Print(" "); 145 // PrintS("end\n"); 145 // PrintS("end\n"); 146 146 p_LmDelete(&q,r); 147 147 } … … 153 153 p_LmCheckPolyRing1(p1, r); 154 154 p_LmCheckPolyRing1(p2, r); 155 p_LmCheckPolyRing1(pr, r); 155 p_LmCheckPolyRing1(pr, r); 156 156 int i; 157 157 poly t=pr; … … 166 166 #ifdef PDEBUG 167 167 PrintS("negative ExpVectorDiff\n"); 168 #endif 168 #endif 169 169 p_Delete(&t,r); 170 170 break; … … 201 201 // pShift(&K,-2); // 2nd component to 0th comp. 202 202 K2 = pTakeOutComp(&K, 1); 203 // K2 = K; 203 // K2 = K; 204 204 205 205 PrintS("syz1: "); p_wrp(K1,r); 206 206 PrintS("syz2: "); p_wrp(K2,r); 207 207 208 /* checking signs before multiplying */ 208 /* checking signs before multiplying */ 209 209 number ck1 = p_GetCoeff(K1,r); 210 210 number ck2 = p_GetCoeff(K2,r); … … 252 252 } 253 253 254 /* PINLINE1 void p_ExpVectorDiff 254 /* PINLINE1 void p_ExpVectorDiff 255 255 remains as is -> BUT we can do memory shift on smaller number of exp's */ 256 256 … … 345 345 // K2 = K; 346 346 347 // /* checking signs before multiplying */ 347 // /* checking signs before multiplying */ 348 348 // number ck1 = p_GetCoeff(K1,r); 349 349 // number ck2 = p_GetCoeff(K2,r); … … 473 473 PrintS("k: "); p_wrp(K,r); PrintS("\n"); 474 474 #endif 475 475 476 476 ideal ncsyz = ncGCD(C,K,r); 477 477 poly KK = ncsyz->m[0]; ncsyz->m[0]=NULL; //p_Copy(ncsyz->m[0],r); // k' … … 487 487 488 488 #ifdef PDEBUG 489 PrintS(" t_f: "); p_wrp(p1,r); PrintS("\n"); 490 PrintS(" t_g: "); p_wrp(p2,r); PrintS("\n"); 491 PrintS(" r_f: "); p_wrp(HF,r); PrintS("\n"); 492 PrintS(" r_g: "); p_wrp(HG,r); PrintS("\n"); 493 PrintS(" c': "); p_wrp(CC,r); PrintS("\n"); 494 PrintS(" k': "); p_wrp(KK,r); PrintS("\n"); 489 PrintS(" t_f: "); p_wrp(p1,r); PrintS("\n"); 490 PrintS(" t_g: "); p_wrp(p2,r); PrintS("\n"); 491 PrintS(" r_f: "); p_wrp(HF,r); PrintS("\n"); 492 PrintS(" r_g: "); p_wrp(HG,r); PrintS("\n"); 493 PrintS(" c': "); p_wrp(CC,r); PrintS("\n"); 494 PrintS(" k': "); p_wrp(KK,r); PrintS("\n"); 495 495 496 496 #endif … … 589 589 #ifdef PDEBUG 590 590 PrintS("t_g: "); p_wrp(out,r); 591 PrintS("k': "); p_wrp(KK,r); PrintS("\n"); 592 PrintS("p': "); p_wrp(PP,r); PrintS("\n"); 591 PrintS("k': "); p_wrp(KK,r); PrintS("\n"); 592 PrintS("p': "); p_wrp(PP,r); PrintS("\n"); 593 593 #endif 594 594 id_Delete(&ncsyz,r); … … 609 609 610 610 // out = r->nc->p_Procs.mm_Mult_p(m, out, r); // d^aplha t_g 611 out = nc_mm_Mult_p(m, out, r); // d^aplha t_g 611 out = nc_mm_Mult_p(m, out, r); // d^aplha t_g 612 612 p_Delete(&m,r); 613 613 … … 643 643 p_wrp(p_Head(a,r),r); 644 644 PrintS(" and b= "); 645 p_wrp(p_Head(b,r),r); 645 p_wrp(p_Head(b,r),r); 646 646 PrintLn(); 647 647 #endif … … 676 676 { 677 677 j=i; l=red_length[i]; 678 678 // PrintS(" yes\n"); 679 679 } 680 680 // else PrintS(" no\n"); … … 693 693 } 694 694 poly hh=nc_rat_ReduceSpolyNew(reducer[j], *h, ishift, r); 695 // p_Delete(h,r); 695 // p_Delete(h,r); 696 696 *h=hh; 697 697 if (TEST_OPT_DEBUG) … … 774 774 // and pmideglen is the coordinate of one of the smallest among them 775 775 776 // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r)); 776 // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r)); 777 777 // return naGcd(d,d2,currRing); 778 778 … … 781 781 { 782 782 d=singclap_gcd(d,pCopy(C[i])); 783 if (pTotaldegree(d)==0) 783 if (pTotaldegree(d)==0) 784 784 { 785 785 // cleanup, pContent, return … … 800 800 C[i]=h; 801 801 } 802 803 // zusammensetzen, 802 803 // zusammensetzen, 804 804 p=NULL; // just to be sure 805 805 for(i=0; i<=k; i++) -
kernel/ratgring.h
re40145 ra9c298 15 15 /* MACROS */ 16 16 17 /* the part, related to the interface */ 17 /* the part, related to the interface */ 18 18 19 19 /* ring nc_rCreateNCcomm(ring r); */ … … 49 49 // poly nc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r); 50 50 // poly nc_mm_Mult_p(const poly m, poly p, const ring r); 51 // poly nc_mm_Mult_nn (int *F, int *G, const ring r); 51 // poly nc_mm_Mult_nn (int *F, int *G, const ring r); 52 52 // poly nc_mm_Mult_uu (int *F,int jG,int bG, const ring r); 53 53 -
kernel/sca.cc
re40145 ra9c298 105 105 assume( currRing == _currRing ); 106 106 107 107 108 108 #if MYTEST 109 109 PrintS("<sca_gr_bba>\n"); … … 362 362 363 363 if( currRing != save ) rChangeCurrRing(save); 364 364 365 365 return (strat->Shdl); 366 366 } … … 484 484 kDebugPrint(strat); 485 485 } 486 486 487 487 488 488 /////////////////////////////////////////////////////////////// … … 731 731 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos); 732 732 733 734 735 736 #if 0 733 734 735 736 #if 0 737 737 h.sev = pGetShortExpVector(h.p); 738 738 strat->initEcart(&h); … … 781 781 782 782 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos); 783 // the end of "#if 0" (comment) 784 #endif 783 // the end of "#if 0" (comment) 784 #endif 785 785 786 786 } // for all x_i \in Ann(lm(P)) … … 851 851 852 852 if( currRing != save ) rChangeCurrRing(save); 853 853 854 854 return (strat->Shdl); 855 855 } … … 920 920 #ifdef PDEBUG 921 921 assume( strat->homog == bIdHomog ); 922 #endif 922 #endif 923 923 924 924 #ifdef HAVE_ASSUME … … 1229 1229 1230 1230 if( currRing != save ) rChangeCurrRing(save); 1231 1231 1232 1232 return (strat->Shdl); 1233 1233 } -
kernel/semic.h
re40145 ra9c298 81 81 82 82 spectrum( const spectrum& ); 83 83 84 84 ~spectrum( ); 85 85 -
kernel/syz0.cc
re40145 ra9c298 527 527 if (modcomp!=NULL) (*modcomp)->show(0,0); 528 528 #endif 529 529 530 530 newmodcomp = new intvec(Fl+2); 531 531 //for (j=0;j<Fl;j++) pWrite(F[j]); … … 668 668 omFreeSize((ADDRESS)pairs,(Fl + gencQ)*sizeof(poly)); 669 669 for(k=0;k<IDELEMS(result);k++) pDelete(&((*Shdl)[k])); 670 670 671 671 kBucketDestroy(&(sy0buck)); 672 672 return result; … … 735 735 delete *modcomp; 736 736 *modcomp = newmodcomp; 737 737 738 738 kBucketDestroy(&(sy0buck)); 739 739 return result; … … 896 896 res=newres; 897 897 } 898 898 899 899 if ((hom==isHomog)|| (rHasGlobalOrdering(origR))) 900 900 { 901 901 if (syzIndex==0) syInitSort(res[0],&modcomp); 902 902 903 903 if ((syzIndex==0) && !rRing_has_CompLastBlock(currRing)) 904 904 res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW,FALSE); 905 905 else 906 906 res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW); 907 907 908 908 mW = res[syzIndex]; 909 909 } -
kernel/syz1.cc
re40145 ra9c298 1998 1998 } 1999 1999 } 2000 2000 2001 2001 int sl=strlen(sn); 2002 2002 syPrintEmptySpaces1(sl); … … 2461 2461 assume(syzstr->syRing != origR); // why? 2462 2462 rChangeCurrRing(syzstr->syRing); 2463 2463 2464 2464 // set initial ShiftedComps 2465 2465 currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int)); -
kernel/syz2.cc
re40145 ra9c298 88 88 while ((l>0) && ((syzstr->resPairs[index])[l-1].lcm==NULL)) l--; 89 89 rr = l-1; 90 while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) || 90 while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) || 91 91 ((syzstr->resPairs[index])[rr].order>actdeg))) rr--; 92 r2 = rr+1; 92 r2 = rr+1; 93 93 while ((rr>=0) && ((syzstr->resPairs[index])[rr].order==actdeg) 94 94 && ((syzstr->resPairs[index])[rr].syzind<0)) … … 123 123 if (tcp!=NULL) 124 124 { 125 while ((tcp!=NULL) && 125 while ((tcp!=NULL) && 126 126 ((tcp->first_poly!=i)||(tcp->second_poly!=r1))) tcp = tcp->next; 127 127 } … … 134 134 j = 0; 135 135 while (j<i) 136 { 136 { 137 137 if (nP->m[j]!=NULL) 138 138 { … … 175 175 while ((ti<l) && (((syzstr->resPairs[index])[ti].ind1!=j)|| 176 176 ((syzstr->resPairs[index])[ti].ind2!=i))) ti++; 177 if (ti<l) 177 if (ti<l) 178 178 { 179 179 #ifdef SHOW_SPRFL … … 571 571 while (kk>=0) 572 572 { 573 if (toGo==0) 573 if (toGo==0) 574 574 { 575 575 while (kk>=0) … … 617 617 q = kBucketGetLm(syzstr->bucket); 618 618 j = 0; 619 while (j<kres) 619 while (j<kres) 620 620 { 621 if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q)) 621 if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q)) 622 622 && ((redset[j].ind1!=tso.ind1) || (redset[j].ind2!=tso.ind2))) 623 623 { … … 761 761 i = 0; 762 762 delete spl1; 763 spl1 = ivStrip(spl2); 763 spl1 = ivStrip(spl2); 764 764 delete spl2; 765 765 if (spl1!=NULL) … … 768 768 kk = (*spl1)[i]-1; 769 769 } 770 } 770 } 771 771 #endif 772 772 #ifdef USE_HEURISTIC2 … … 918 918 for (i=1;i<=syzstr->length;i++) 919 919 { 920 if (!idIs0(syzstr->orderedRes[i])) 920 if (!idIs0(syzstr->orderedRes[i])) 921 921 { 922 922 toreor = syzstr->orderedRes[i]; … … 931 931 toreor->m[j] = NULL; 932 932 } 933 m = 0; 933 m = 0; 934 934 for (j=0;j<togo;j++) 935 935 { … … 952 952 953 953 /*2 954 * the CoCoA-algorithm for free resolutions, using a formula 954 * the CoCoA-algorithm for free resolutions, using a formula 955 955 * for remaining pairs based on Hilbert-functions 956 956 */ … … 972 972 return syzstr; 973 973 } 974 974 975 975 // Creare dp,S ring and change to it 976 976 syzstr->syRing = rAssure_dp_C(origR); … … 1087 1087 kBucketDestroy(&(syzstr->bucket)); 1088 1088 kBucketDestroy(&(syzstr->syz_bucket)); 1089 if (origR != syzstr->syRing) 1089 if (origR != syzstr->syRing) 1090 1090 rChangeCurrRing(origR); 1091 1091 else -
kernel/syz3.cc
re40145 ra9c298 5 5 * ABSTRACT: resolutions 6 6 */ 7 7 8 8 #ifdef HAVE_CONFIG_H 9 9 #include "singularconfig.h" … … 29 29 #include <kernel/timer.h> 30 30 #include <polys/matpol.h> 31 31 32 32 //#define SHOW_PROT 33 33 //#define SHOW_RED … … 49 49 int discard_pairs; 50 50 int short_pairs; 51 52 /*3 51 52 /*3 53 53 * assumes the ideals old_ideal and new_ideal to be homogeneous 54 54 * tests wether the new_ideal is a regular extension of the old_ideal … … 64 64 int i; 65 65 BOOLEAN isRegular=TRUE; 66 66 67 67 for (i=old_hilbs->length()+deg-1;i>=deg;i--) 68 68 (*shifted_old_hilbs)[i] = (*old_hilbs)[i-deg]; … … 86 86 return isRegular; 87 87 } 88 88 89 89 /*3 90 90 * shows the resolution stored in syzstr->orderedRes … …