Changeset 52a5e8 in git for Singular/polys-impl.cc
- Timestamp:
- Dec 2, 1998, 2:57:41 PM (25 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- a92ff6f3188bbc12d2a3689101ca97f48f880850
- Parents:
- 5811fbf32c7285e5b584702b134e80d61f40e342
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys-impl.cc
r5811fb r52a5e8 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys-impl.cc,v 1.2 0 1998-11-10 17:25:32 SingularExp $ */4 /* $Id: polys-impl.cc,v 1.21 1998-12-02 13:57:39 obachman Exp $ */ 5 5 6 6 /*************************************************************** … … 22 22 #include "tok.h" 23 23 #include "structs.h" 24 #include "mmprivat .h"24 #include "mmprivate.h" 25 25 #include "mmemory.h" 26 26 #include "febase.h" … … 184 184 // currRing and r have the same number of variables, i.e. that polys 185 185 // from r can be "fetched" into currRing 186 #ifdef PDEBUG186 #ifdef MDEBUG 187 187 poly pDBFetchCopy(ring r, poly p,char *f,int l) 188 188 #else … … 195 195 if (r->VarOffset == pVarOffset) 196 196 { 197 #ifdef PDEBUG197 #ifdef MDEBUG 198 198 res = a = pDBNew(f,l); 199 199 #else … … 206 206 while (p!=NULL) 207 207 { 208 #ifdef PDEBUG208 #ifdef MDEBUG 209 209 a = pNext(a) = pDBNew(f,l); 210 210 #else … … 220 220 else 221 221 { 222 #ifdef PDEBUG222 #ifdef MDEBUG 223 223 a = res = pDBInit(f,l); 224 224 #else … … 234 234 // convert betweeen a lex order and a revlex order -- to speed 235 235 // up the sorting, we assemble new poly in inverse order 236 #ifdef PDEBUG236 #ifdef MDEBUG 237 237 res = pDBInit(f,l); 238 238 #else … … 263 263 ***************************************************************/ 264 264 265 #ifdef PDEBUG266 poly pDBNew(char *f, int l)267 {268 #ifdef MDEBUG269 poly p = (poly) mmDBAllocSpecialized(f,l);270 #else271 poly p = (poly) mmAllocSpecialized();272 #endif273 memset(p,0,pMonomSize);274 return p;275 }276 #endif277 265 278 266 /*2 279 267 * create a new monomial and init 280 268 */ 281 #ifdef PDEBUG269 #ifdef MDEBUG 282 270 poly pDBInit(char * f, int l) 283 271 { … … 293 281 * put the monomials in the freelist 294 282 */ 295 #ifdef PDEBUG283 #ifdef MDEBUG 296 284 void pDBDelete(poly * p, char * f, int l) 297 285 { … … 307 295 pIter(h); 308 296 #ifdef MDEBUG 309 mmDBFreeSpecialized((ADDRESS)*p,f,l);310 #else 311 mmFreeSpecialized((ADDRESS)*p);297 pDBFree1((ADDRESS)*p,f,l); 298 #else 299 pFree1((ADDRESS)*p); 312 300 #endif 313 301 *p=h; … … 327 315 pp=h; 328 316 pIter(h); 329 mmFreeSpecialized((ADDRESS)pp);317 pFree1((ADDRESS)pp); 330 318 } 331 319 *p = NULL; … … 336 324 * remove first monom 337 325 */ 338 #ifdef PDEBUG326 #ifdef MDEBUG 339 327 void pDBDelete1(poly * p, char * f, int l) 340 328 { … … 345 333 *p = pNext(h); 346 334 #ifdef MDEBUG 347 mmDBFreeSpecialized((ADDRESS)h,f,l);348 #else 349 mmFreeSpecialized((ADDRESS)h);335 pDBFree1((ADDRESS)h,f,l); 336 #else 337 pFree1((ADDRESS)h); 350 338 #endif 351 339 } … … 358 346 nDelete(&(h->coef)); 359 347 *p = pNext(h); 360 mmFreeSpecialized((ADDRESS)h);348 pFree1((ADDRESS)h); 361 349 } 362 350 #endif … … 371 359 372 360 /*2 373 * remove first monom374 */375 #ifdef PDEBUG376 void pDBFree1(poly p, char * f, int l)377 {378 if (p!=NULL)379 {380 p->coef=NULL;//nDelete(&(p->coef));381 #ifdef MDEBUG382 mmDBFreeSpecialized((ADDRESS)p,f,l);383 #else384 mmFreeSpecialized((ADDRESS)p);385 #endif386 }387 }388 #endif389 390 /*2391 361 * creates a copy of p 392 362 */ 393 #ifdef PDEBUG363 #ifdef MDEBUG 394 364 poly pDBCopy(poly p,char *f,int l) 395 365 #else … … 401 371 if (p==NULL) return NULL; 402 372 pDBTest(p,f,l); 403 #ifdef PDEBUG373 #ifdef MDEBUG 404 374 w = a = pDBNew(f,l); 405 375 #else … … 413 383 do 414 384 { 415 #ifdef PDEBUG385 #ifdef MDEBUG 416 386 a = pNext(a) = pDBNew(f,l); 417 387 #else … … 433 403 * sets the coeff of the copy to a defined value 434 404 */ 435 #ifdef PDEBUG405 #ifdef MDEBUG 436 406 poly pDBCopy1(poly p,char *f,int l) 437 407 #else … … 440 410 { 441 411 poly w; 442 #ifdef PDEBUG412 #ifdef MDEBUG 443 413 w = pDBNew(f,l); 444 414 #else … … 454 424 * returns (a copy of) the head term of a 455 425 */ 456 #ifdef PDEBUG426 #ifdef MDEBUG 457 427 poly pDBHead(poly p,char *f, int l) 458 428 #else … … 464 434 if (p!=NULL) 465 435 { 466 #ifdef PDEBUG436 #ifdef MDEBUG 467 437 w = pDBNew(f,l); 468 438 #else … … 484 454 * returns (a copy of) the head term of a without the coef 485 455 */ 486 #ifdef PDEBUG456 #ifdef MDEBUG 487 457 poly pDBHead0(poly p,char *f, int l) 488 458 #else … … 735 705 #endif // PDEBUG != 0 736 706 737 738 707 BOOLEAN pDBTest(poly p, char *f, int l) 708 { 709 return pDBTest(p, mm_specHeap, f,l); 710 } 711 712 BOOLEAN pDBTest(poly p, memHeap tail_heap, memHeap lm_heap, char *f, int l) 713 { 714 if (tail_heap != lm_heap && lm_heap != NULL) 715 { 716 poly pn = pNext(p); 717 BOOLEAN ret; 718 pNext(p) = NULL; 719 ret = pDBTest(pn, tail_heap, f, l) && pDBTest(p, lm_heap, f, l); 720 pNext(p) = pn; 721 return ret; 722 } 723 else 724 { 725 return pDBTest(p, tail_heap, f, l); 726 } 727 } 728 729 BOOLEAN pDBTest(poly p, memHeap heap, char *f, int l) 739 730 { 740 731 poly old=NULL; … … 743 734 { 744 735 #ifdef MDEBUG 745 if (!mmDBTest Block(p,mm_specSize,f,l))736 if (!mmDBTestHeapBlock(p, heap, f,l)) 746 737 return FALSE; 738 #elif defined(HEAP_DEBUG) 739 if (! mmDebugCheckHeapAddr(p, heap, MM_HEAP_ADDR_USED_FLAG, f, l)) 740 return FALSE; 747 741 #endif 748 742 #ifdef LDEBUG … … 818 812 #endif // PDEBUG 819 813 814 #define BIT_SIZEOF_LONG 8*SIZEOF_LONG 815 unsigned long GetBitFields(Exponent_t e, 816 unsigned int s, unsigned int n) 817 { 818 unsigned int i = 0, ev = 0; 819 assume(n > 0 && s < BIT_SIZEOF_LONG); 820 do 821 { 822 assume(s+i < BIT_SIZEOF_LONG); 823 if (e > (Exponent_t) i) ev |= Sy_bit(s+i); 824 else break; 825 i++; 826 } 827 while (i < n); 828 return ev; 829 } 830 831 unsigned long pGetShortExpVector(poly p) 832 { 833 unsigned long ev = 0; // short exponent vector 834 unsigned int n = BIT_SIZEOF_LONG / pVariables; // number of bits per exp 835 unsigned int m1; // highest bit which is filled with (n+1) 836 unsigned int i = 0, j=0; 837 838 if (n == 0) 839 { 840 n = 1; 841 m1 = 0; 842 } 843 else 844 { 845 m1 = (n+1)*(BIT_SIZEOF_LONG - n*pVariables); 846 } 847 848 n++; 849 while (i<m1) 850 { 851 ev |= GetBitFields(p->exp[pVarLowIndex + j], i, n); 852 i += n; 853 j++; 854 } 855 856 return ev; 857 } 820 858 821 859 #endif // POLYS_IMPL_CC
Note: See TracChangeset
for help on using the changeset viewer.