Changeset c232af in git for Singular/mpr_base.cc
- Timestamp:
- Aug 14, 2000, 2:58:28 PM (24 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b50cc4fc80fdf2a2005655a08d9229aa4b32d4a5')
- Children:
- d26c2e9dd38f1531c0e77c38e6177109182b5bca
- Parents:
- 4697a8a1ccbf49d0048033ea29c651e3966ba729
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/mpr_base.cc
r4697a8a rc232af 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpr_base.cc,v 1.2 0 2000-03-01 14:00:05 SingularExp $ */4 /* $Id: mpr_base.cc,v 1.21 2000-08-14 12:56:39 obachman Exp $ */ 5 5 6 6 /* … … 13 13 14 14 #include "mod2.h" 15 16 #include <omalloc.h> 15 17 16 18 //-> includes … … 21 23 #include "ipshell.h" 22 24 #include "febase.h" 23 #include "mmemory.h"24 25 #include "intvec.h" 25 26 #include "matpol.h" … … 34 35 #include "mpr_base.h" 35 36 #include "mpr_numeric.h" 36 #if HAVE_ASO == 1037 #include "mpr_base.aso"38 #else39 #define AllocSizeOf(X) Alloc(sizeof(X))40 #define FreeSizeOf(X,Y) Free(X,sizeof(Y))41 #endif42 37 //<- 43 38 … … 335 330 //<- 336 331 337 #ifndef ASO_GENERATE338 339 332 //-> debug output stuff 340 333 #if defined(mprDEBUG_PROT) || defined(mprDEBUG_ALL) … … 424 417 { 425 418 int i; 426 points = (onePointP *) Alloc( (count+1) * sizeof(onePointP) );419 points = (onePointP *)omAlloc( (count+1) * sizeof(onePointP) ); 427 420 for ( i= 0; i <= max; i++ ) 428 421 { 429 points[i]= (onePointP) Alloc( sizeof(onePoint) );430 points[i]->point= (Coord_t *) Alloc0( (dim+2) * sizeof(Coord_t) );422 points[i]= (onePointP)omAlloc( sizeof(onePoint) ); 423 points[i]->point= (Coord_t *)omAlloc0( (dim+2) * sizeof(Coord_t) ); 431 424 } 432 425 lifted= false; … … 439 432 for ( i= 0; i <= max; i++ ) 440 433 { 441 Free( (ADDRESS) points[i]->point, fdim * sizeof(Coord_t) );442 Free( (ADDRESS) points[i], sizeof(onePoint) );443 } 444 Free( (ADDRESS) points, (max+1) * sizeof(onePointP) );434 omFreeSize( (ADDRESS) points[i]->point, fdim * sizeof(Coord_t) ); 435 omFreeSize( (ADDRESS) points[i], sizeof(onePoint) ); 436 } 437 omFreeSize( (ADDRESS) points, (max+1) * sizeof(onePointP) ); 445 438 } 446 439 … … 457 450 int i; 458 451 int fdim= lifted ? dim+1 : dim+2; 459 points= (onePointP*) ReAlloc( points,452 points= (onePointP*)omReallocSize( points, 460 453 (max+1) * sizeof(onePointP), 461 454 (2*max + 1) * sizeof(onePointP) ); 462 455 for ( i= max+1; i <= max*2; i++ ) 463 456 { 464 points[i]= (onePointP) Alloc( sizeof(struct onePoint) );465 points[i]->point= (Coord_t *) Alloc0( fdim * sizeof(Coord_t) );457 points[i]= (onePointP)omAlloc( sizeof(struct onePoint) ); 458 points[i]->point= (Coord_t *)omAlloc0( fdim * sizeof(Coord_t) ); 466 459 } 467 460 max*= 2; … … 563 556 poly piter= p; 564 557 Exponent_t * vert; 565 vert= (Exponent_t *) Alloc( (dim+1) * sizeof(Exponent_t) );558 vert= (Exponent_t *)omAlloc( (dim+1) * sizeof(Exponent_t) ); 566 559 567 560 while ( piter ) … … 583 576 pIter( piter ); 584 577 } 585 Free( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );578 omFreeSize( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) ); 586 579 } 587 580 … … 592 585 593 586 // hier unschoen... 594 vert= (Exponent_t *) Alloc( (dim+1) * sizeof(Exponent_t) );587 vert= (Exponent_t *)omAlloc( (dim+1) * sizeof(Exponent_t) ); 595 588 596 589 pGetExpV( p, vert ); … … 601 594 if ( j > dim ) break; 602 595 } 603 Free( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );596 omFreeSize( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) ); 604 597 605 598 if ( i > num ) return 0; … … 689 682 { 690 683 outerL= false; 691 l= (int *) Alloc( (dim+1) * sizeof(int) ); // [1..dim-1]684 l= (int *)omAlloc( (dim+1) * sizeof(int) ); // [1..dim-1] 692 685 693 686 for(i = 1; i < dim; i++) … … 722 715 lifted= true; 723 716 724 if ( !outerL ) Free( (ADDRESS) l, (dim+1) * sizeof(int) );717 if ( !outerL ) omFreeSize( (ADDRESS) l, (dim+1) * sizeof(int) ); 725 718 } 726 719 //<- … … 792 785 793 786 n= pVariables; 794 vert= (Exponent_t *) Alloc( (idelem+1) * sizeof(Exponent_t) );795 796 Q = (pointSet **) Alloc( idelem * sizeof(pointSet*) ); // support hulls787 vert= (Exponent_t *)omAlloc( (idelem+1) * sizeof(Exponent_t) ); 788 789 Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) ); // support hulls 797 790 for ( i= 0; i < idelem; i++ ) 798 791 Q[i] = new pointSet( pVariables, i+1, pLength((gls->m)[i])+1 ); … … 821 814 } // i 822 815 823 Free( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );816 omFreeSize( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) ); 824 817 825 818 #ifdef mprDEBUG_PROT … … 852 845 853 846 n= pVariables; 854 vert= (Exponent_t *) Alloc( (idelem+1) * sizeof(Exponent_t) );847 vert= (Exponent_t *)omAlloc( (idelem+1) * sizeof(Exponent_t) ); 855 848 id= idInit( idelem, 1 ); 856 849 … … 885 878 } // i 886 879 887 Free( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );880 omFreeSize( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) ); 888 881 889 882 #ifdef mprDEBUG_PROT … … 1354 1347 // remap results of LP to sets Qi 1355 1348 c=0; 1356 optSum= (setID*) Alloc( (LP->m) * sizeof(struct setID) );1349 optSum= (setID*)omAlloc( (LP->m) * sizeof(struct setID) ); 1357 1350 for ( i= 0; i < LP->m; i++ ) 1358 1351 { … … 1409 1402 1410 1403 // clean up 1411 Free( (ADDRESS) optSum, (LP->m) * sizeof(struct setID) );1404 omFreeSize( (ADDRESS) optSum, (LP->m) * sizeof(struct setID) ); 1412 1405 1413 1406 mprSTICKYPROT(ST_SPARSE_RC); … … 1430 1423 Exponent_t *epp_mon, *eexp; 1431 1424 1432 epp_mon= (Exponent_t *) Alloc( (n+2) * sizeof(Exponent_t) );1433 eexp= (Exponent_t *) Alloc0((pVariables+1)*sizeof(Exponent_t));1425 epp_mon= (Exponent_t *)omAlloc( (n+2) * sizeof(Exponent_t) ); 1426 eexp= (Exponent_t *)omAlloc0((pVariables+1)*sizeof(Exponent_t)); 1434 1427 1435 1428 totDeg= numSet0; … … 1438 1431 mprSTICKYPROT2(" resultant deg: %d\n", numSet0); 1439 1432 1440 uRPos= NewIntvec3( numSet0, pLength((gls->m)[0])+1, 0 );1433 uRPos= new intvec( numSet0, pLength((gls->m)[0])+1, 0 ); 1441 1434 1442 1435 // sparse Matrix represented as a module where … … 1489 1482 1490 1483 pDelete( &epp ); 1491 Free( (ADDRESS) epp_mon, (n+2) * sizeof(Exponent_t) );1492 Free( (ADDRESS) eexp, (pVariables+1)*sizeof(Exponent_t));1484 omFreeSize( (ADDRESS) epp_mon, (n+2) * sizeof(Exponent_t) ); 1485 omFreeSize( (ADDRESS) eexp, (pVariables+1)*sizeof(Exponent_t)); 1493 1486 1494 1487 #ifdef mprDEBUG_ALL … … 1536 1529 int j,k,l; 1537 1530 1538 vert.point=(Coord_t*) Alloc( (pVariables+2) * sizeof(Coord_t) );1531 vert.point=(Coord_t*)omAlloc( (pVariables+2) * sizeof(Coord_t) ); 1539 1532 1540 1533 vs= new pointSet( dim ); … … 1553 1546 } 1554 1547 1555 Free( (ADDRESS) vert.point, (pVariables+2) * sizeof(Coord_t) );1548 omFreeSize( (ADDRESS) vert.point, (pVariables+2) * sizeof(Coord_t) ); 1556 1549 1557 1550 return vs; … … 1725 1718 delete Qi[i]; 1726 1719 } 1727 Free( (ADDRESS) Qi, idelem * sizeof(pointSet*) );1720 omFreeSize( (ADDRESS) Qi, idelem * sizeof(pointSet*) ); 1728 1721 1729 1722 delete E; … … 2091 2084 nDelete( resVectorList[i].numColVector+j ); 2092 2085 } 2093 Free( (ADDRESS)resVectorList[i].numColVector, numVectors*sizeof( number ) ); 2094 Free( (ADDRESS)resVectorList[i].numColParNr, (pVariables+1) * sizeof(int) ); 2095 } 2096 2097 Free( (ADDRESS)resVectorList, veclistmax*sizeof( resVector ) ); 2086 // OB: ????? (solve_s.tst) 2087 omfreeSize( (ADDRESS)resVectorList[i].numColVector, numVectors*sizeof( number ) ); 2088 omfreeSize( (ADDRESS)resVectorList[i].numColParNr, (pVariables+1) * sizeof(int) ); 2089 } 2090 2091 omFreeSize( (ADDRESS)resVectorList, veclistmax*sizeof( resVector ) ); 2098 2092 2099 2093 // free matrix m … … 2103 2097 for ( j= 1; j <= numVectors; j++ ) 2104 2098 pDelete( &MATELEM(m , i, j) ); 2105 Free( (ADDRESS)m->m, numVectors * numVectors * sizeof(poly) );2106 FreeSizeOf( (ADDRESS)m, ip_smatrix);2099 omfreeSize( (ADDRESS)m->m, numVectors * numVectors * sizeof(poly) ); 2100 omFreeBin((ADDRESS)m, ip_smatrix_bin); 2107 2101 } 2108 2102 } … … 2186 2180 if ( numVectors == veclistmax ) 2187 2181 { 2188 resVectorList= (resVector * ) ReAlloc( resVectorList,2182 resVectorList= (resVector * )omReallocSize( resVectorList, 2189 2183 (veclistmax) * sizeof( resVector ), 2190 2184 (veclistmax + veclistblock) * sizeof( resVector ) ); … … 2225 2219 veclistblock= 512; 2226 2220 veclistmax= veclistblock; 2227 resVectorList= (resVector *) Alloc( veclistmax*sizeof( resVector ) );2221 resVectorList= (resVector *)omAlloc( veclistmax*sizeof( resVector ) ); 2228 2222 2229 2223 // Init resVector()s … … 2387 2381 resVectorList[k].numColParNr= NULL; 2388 2382 resVectorList[k].numColVectorSize= numVectors; 2389 resVectorList[k].numColVector= (number *) Alloc( numVectors*sizeof( number ) );2383 resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) ); 2390 2384 for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0); 2391 2385 … … 2421 2415 resVectorList[k].numColVectorSize= 0; 2422 2416 resVectorList[k].numColVector= NULL; 2423 resVectorList[k].numColParNr= (int *) Alloc0( (pVariables+1) * sizeof(int) );2417 resVectorList[k].numColParNr= (int *)omAlloc0( (pVariables+1) * sizeof(int) ); 2424 2418 2425 2419 pi= (gls->m)[ resVectorList[k].elementOfS ]; … … 2451 2445 // create the matrix M 2452 2446 createMatrix(); 2447 2453 2448 } 2454 2449 … … 2712 2707 { 2713 2708 ideal newGls= idCopy( gls ); 2714 newGls->m= (poly *) ReAlloc( newGls->m,2709 newGls->m= (poly *)omReallocSize( newGls->m, 2715 2710 IDELEMS(gls) * sizeof(poly), 2716 2711 (IDELEMS(gls) + 1) * sizeof(poly) ); … … 2787 2782 // we need mdg results of D(p0,p1,...,pn) 2788 2783 number *presults; 2789 presults= (number *) Alloc( mdg * sizeof( number ) );2784 presults= (number *)omAlloc( mdg * sizeof( number ) ); 2790 2785 for (i=0; i < mdg; i++) presults[i]= nInit(0); 2791 2786 2792 number *pevpoint= (number *) Alloc( n * sizeof( number ) );2793 number *pev= (number *) Alloc( n * sizeof( number ) );2787 number *pevpoint= (number *)omAlloc( n * sizeof( number ) ); 2788 number *pev= (number *)omAlloc( n * sizeof( number ) ); 2794 2789 for (i=0; i < n; i++) pev[i]= nInit(0); 2795 2790 … … 2930 2925 // c(0)*u0^tdg + c(1)*u0^tdg-1 + ... + c(tdg-1)*u0 + c(tdg) 2931 2926 number *presults; 2932 presults= (number *) Alloc( (tdg + 1) * sizeof( number ) );2927 presults= (number *)omAlloc( (tdg + 1) * sizeof( number ) ); 2933 2928 for ( i=0; i <= tdg; i++ ) presults[i]= nInit(0); 2934 2929 2935 2930 rootContainer ** roots; 2936 roots= (rootContainer **) Alloc( loops * sizeof(rootContainer*) );2931 roots= (rootContainer **) omAlloc( loops * sizeof(rootContainer*) ); 2937 2932 for ( i=0; i < loops; i++ ) roots[i]= new rootContainer(); // 0..n-2 2938 2933 2939 number *pevpoint= (number *) Alloc( n * sizeof( number ) );2934 number *pevpoint= (number *)omAlloc( n * sizeof( number ) ); 2940 2935 for (i=0; i < n; i++) pevpoint[i]= nInit(0); 2941 2936 2942 number *pev= (number *) Alloc( n * sizeof( number ) );2937 number *pev= (number *)omAlloc( n * sizeof( number ) ); 2943 2938 for (i=0; i < n; i++) pev[i]= nInit(0); 2944 2939 … … 3046 3041 // free some stuff: pev, presult 3047 3042 for ( i=0; i < n; i++ ) nDelete( pev + i ); 3048 Free( (ADDRESS)pev, n * sizeof( number ) );3043 omFreeSize( (ADDRESS)pev, n * sizeof( number ) ); 3049 3044 3050 3045 for ( i=0; i <= tdg; i++ ) nDelete( presults+i ); 3051 Free( (ADDRESS)presults, (tdg + 1) * sizeof( number ) );3046 omFreeSize( (ADDRESS)presults, (tdg + 1) * sizeof( number ) ); 3052 3047 3053 3048 return roots; … … 3066 3061 3067 3062 rootContainer ** roots; 3068 roots= (rootContainer **) Alloc( loops * sizeof(rootContainer*) );3063 roots= (rootContainer **) omAlloc( loops * sizeof(rootContainer*) ); 3069 3064 for ( i=0; i < loops; i++ ) roots[i]= new rootContainer(); // 0..n-2 3070 3065 3071 number *pevpoint= (number *) Alloc( n * sizeof( number ) );3066 number *pevpoint= (number *)omAlloc( n * sizeof( number ) ); 3072 3067 for (i=0; i < n; i++) pevpoint[i]= nInit(0); 3073 3068 … … 3106 3101 pures= resMat->getUDet( pevpoint ); 3107 3102 3108 number *ncpoly= (number *) Alloc( (tdg+1) * sizeof(number) );3103 number *ncpoly= (number *)omAlloc( (tdg+1) * sizeof(number) ); 3109 3104 3110 3105 #ifdef MPR_MASI … … 3159 3154 // free some stuff: pev, presult 3160 3155 for ( i=0; i < n; i++ ) nDelete( pevpoint + i ); 3161 Free( (ADDRESS)pevpoint, n * sizeof( number ) );3156 omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) ); 3162 3157 3163 3158 return roots; … … 3209 3204 3210 3205 //----------------------------------------------------------------------------- 3211 3212 #endif // ! ASO_GENERATE3213 3206 3214 3207 // local Variables: ***
Note: See TracChangeset
for help on using the changeset viewer.