Changeset c232af in git for Singular/mpr_base.cc


Ignore:
Timestamp:
Aug 14, 2000, 2:58:28 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b50cc4fc80fdf2a2005655a08d9229aa4b32d4a5')
Children:
d26c2e9dd38f1531c0e77c38e6177109182b5bca
Parents:
4697a8a1ccbf49d0048033ea29c651e3966ba729
Message:
* omalloc stuff


git-svn-id: file:///usr/local/Singular/svn/trunk@4524 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/mpr_base.cc

    r4697a8a rc232af  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mpr_base.cc,v 1.20 2000-03-01 14:00:05 Singular Exp $ */
     4/* $Id: mpr_base.cc,v 1.21 2000-08-14 12:56:39 obachman Exp $ */
    55
    66/*
     
    1313
    1414#include "mod2.h"
     15
     16#include <omalloc.h>
    1517
    1618//-> includes
     
    2123#include "ipshell.h"
    2224#include "febase.h"
    23 #include "mmemory.h"
    2425#include "intvec.h"
    2526#include "matpol.h"
     
    3435#include "mpr_base.h"
    3536#include "mpr_numeric.h"
    36 #if HAVE_ASO == 10
    37 #include "mpr_base.aso"
    38 #else
    39 #define AllocSizeOf(X) Alloc(sizeof(X))
    40 #define FreeSizeOf(X,Y) Free(X,sizeof(Y))
    41 #endif
    4237//<-
    4338
     
    335330//<-
    336331
    337 #ifndef ASO_GENERATE
    338 
    339332//-> debug output stuff
    340333#if defined(mprDEBUG_PROT) || defined(mprDEBUG_ALL)
     
    424417{
    425418  int i;
    426   points = (onePointP *)Alloc( (count+1) * sizeof(onePointP) );
     419  points = (onePointP *)omAlloc( (count+1) * sizeof(onePointP) );
    427420  for ( i= 0; i <= max; i++ )
    428421  {
    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) );
    431424  }
    432425  lifted= false;
     
    439432  for ( i= 0; i <= max; i++ )
    440433  {
    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) );
    445438}
    446439
     
    457450    int i;
    458451    int fdim= lifted ? dim+1 : dim+2;
    459     points= (onePointP*)ReAlloc( points,
     452    points= (onePointP*)omReallocSize( points,
    460453                                 (max+1) * sizeof(onePointP),
    461454                                 (2*max + 1) * sizeof(onePointP) );
    462455    for ( i= max+1; i <= max*2; i++ )
    463456    {
    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) );
    466459    }
    467460    max*= 2;
     
    563556  poly piter= p;
    564557  Exponent_t * vert;
    565   vert= (Exponent_t *)Alloc( (dim+1) * sizeof(Exponent_t) );
     558  vert= (Exponent_t *)omAlloc( (dim+1) * sizeof(Exponent_t) );
    566559
    567560  while ( piter )
     
    583576    pIter( piter );
    584577  }
    585   Free( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );
     578  omFreeSize( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );
    586579}
    587580
     
    592585
    593586  // hier unschoen...
    594   vert= (Exponent_t *)Alloc( (dim+1) * sizeof(Exponent_t) );
     587  vert= (Exponent_t *)omAlloc( (dim+1) * sizeof(Exponent_t) );
    595588
    596589  pGetExpV( p, vert );
     
    601594    if ( j > dim ) break;
    602595  }
    603   Free( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );
     596  omFreeSize( (ADDRESS) vert, (dim+1) * sizeof(Exponent_t) );
    604597
    605598  if ( i > num ) return 0;
     
    689682  {
    690683    outerL= false;
    691     l= (int *)Alloc( (dim+1) * sizeof(int) ); // [1..dim-1]
     684    l= (int *)omAlloc( (dim+1) * sizeof(int) ); // [1..dim-1]
    692685
    693686    for(i = 1; i < dim; i++)
     
    722715  lifted= true;
    723716
    724   if ( !outerL ) Free( (ADDRESS) l, (dim+1) * sizeof(int) );
     717  if ( !outerL ) omFreeSize( (ADDRESS) l, (dim+1) * sizeof(int) );
    725718}
    726719//<-
     
    792785
    793786  n= pVariables;
    794   vert= (Exponent_t *)Alloc( (idelem+1) * sizeof(Exponent_t) );
    795 
    796   Q = (pointSet **)Alloc( idelem * sizeof(pointSet*) );        // support hulls
     787  vert= (Exponent_t *)omAlloc( (idelem+1) * sizeof(Exponent_t) );
     788
     789  Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) );        // support hulls
    797790  for ( i= 0; i < idelem; i++ )
    798791    Q[i] = new pointSet( pVariables, i+1, pLength((gls->m)[i])+1 );
     
    821814  } // i
    822815
    823   Free( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );
     816  omFreeSize( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );
    824817
    825818#ifdef mprDEBUG_PROT
     
    852845
    853846  n= pVariables;
    854   vert= (Exponent_t *)Alloc( (idelem+1) * sizeof(Exponent_t) );
     847  vert= (Exponent_t *)omAlloc( (idelem+1) * sizeof(Exponent_t) );
    855848  id= idInit( idelem, 1 );
    856849
     
    885878  } // i
    886879
    887   Free( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );
     880  omFreeSize( (ADDRESS) vert, (idelem+1) * sizeof(Exponent_t) );
    888881
    889882#ifdef mprDEBUG_PROT
     
    13541347  // remap results of LP to sets Qi
    13551348  c=0;
    1356   optSum= (setID*)Alloc( (LP->m) * sizeof(struct setID) );
     1349  optSum= (setID*)omAlloc( (LP->m) * sizeof(struct setID) );
    13571350  for ( i= 0; i < LP->m; i++ )
    13581351  {
     
    14091402
    14101403  // clean up
    1411   Free( (ADDRESS) optSum, (LP->m) * sizeof(struct setID) );
     1404  omFreeSize( (ADDRESS) optSum, (LP->m) * sizeof(struct setID) );
    14121405
    14131406  mprSTICKYPROT(ST_SPARSE_RC);
     
    14301423  Exponent_t *epp_mon, *eexp;
    14311424
    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));
    14341427
    14351428  totDeg= numSet0;
     
    14381431  mprSTICKYPROT2("  resultant deg: %d\n", numSet0);
    14391432
    1440   uRPos= NewIntvec3( numSet0, pLength((gls->m)[0])+1, 0 );
     1433  uRPos= new intvec( numSet0, pLength((gls->m)[0])+1, 0 );
    14411434
    14421435  // sparse Matrix represented as a module where
     
    14891482
    14901483  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));
    14931486
    14941487#ifdef mprDEBUG_ALL
     
    15361529  int j,k,l;
    15371530
    1538   vert.point=(Coord_t*)Alloc( (pVariables+2) * sizeof(Coord_t) );
     1531  vert.point=(Coord_t*)omAlloc( (pVariables+2) * sizeof(Coord_t) );
    15391532
    15401533  vs= new pointSet( dim );
     
    15531546  }
    15541547
    1555   Free( (ADDRESS) vert.point, (pVariables+2) * sizeof(Coord_t) );
     1548  omFreeSize( (ADDRESS) vert.point, (pVariables+2) * sizeof(Coord_t) );
    15561549
    15571550  return vs;
     
    17251718    delete Qi[i];
    17261719  }
    1727   Free( (ADDRESS) Qi, idelem * sizeof(pointSet*) );
     1720  omFreeSize( (ADDRESS) Qi, idelem * sizeof(pointSet*) );
    17281721
    17291722  delete E;
     
    20912084        nDelete( resVectorList[i].numColVector+j );
    20922085    }
    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 ) );
    20982092
    20992093  // free matrix m
     
    21032097      for ( j= 1; j <= numVectors; j++ )
    21042098        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);
    21072101  }
    21082102}
     
    21862180    if ( numVectors == veclistmax )
    21872181    {
    2188       resVectorList= (resVector * )ReAlloc( resVectorList,
     2182      resVectorList= (resVector * )omReallocSize( resVectorList,
    21892183                                            (veclistmax) * sizeof( resVector ),
    21902184                                            (veclistmax + veclistblock) * sizeof( resVector ) );
     
    22252219  veclistblock= 512;
    22262220  veclistmax= veclistblock;
    2227   resVectorList= (resVector *)Alloc( veclistmax*sizeof( resVector ) );
     2221  resVectorList= (resVector *)omAlloc( veclistmax*sizeof( resVector ) );
    22282222
    22292223  // Init resVector()s
     
    23872381      resVectorList[k].numColParNr= NULL;
    23882382      resVectorList[k].numColVectorSize= numVectors;
    2389       resVectorList[k].numColVector= (number *)Alloc( numVectors*sizeof( number ) );
     2383      resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) );
    23902384      for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0);
    23912385
     
    24212415      resVectorList[k].numColVectorSize= 0;
    24222416      resVectorList[k].numColVector= NULL;
    2423       resVectorList[k].numColParNr= (int *)Alloc0( (pVariables+1) * sizeof(int) );
     2417      resVectorList[k].numColParNr= (int *)omAlloc0( (pVariables+1) * sizeof(int) );
    24242418
    24252419      pi= (gls->m)[ resVectorList[k].elementOfS ];
     
    24512445  // create the matrix M
    24522446  createMatrix();
     2447 
    24532448}
    24542449
     
    27122707{
    27132708  ideal newGls= idCopy( gls );
    2714   newGls->m= (poly *)ReAlloc( newGls->m,
     2709  newGls->m= (poly *)omReallocSize( newGls->m,
    27152710                              IDELEMS(gls) * sizeof(poly),
    27162711                              (IDELEMS(gls) + 1) * sizeof(poly) );
     
    27872782  // we need mdg results of D(p0,p1,...,pn)
    27882783  number *presults;
    2789   presults= (number *)Alloc( mdg * sizeof( number ) );
     2784  presults= (number *)omAlloc( mdg * sizeof( number ) );
    27902785  for (i=0; i < mdg; i++) presults[i]= nInit(0);
    27912786
    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 ) );
    27942789  for (i=0; i < n; i++) pev[i]= nInit(0);
    27952790
     
    29302925  //              c(0)*u0^tdg + c(1)*u0^tdg-1 + ... + c(tdg-1)*u0 + c(tdg)
    29312926  number *presults;
    2932   presults= (number *)Alloc( (tdg + 1) * sizeof( number ) );
     2927  presults= (number *)omAlloc( (tdg + 1) * sizeof( number ) );
    29332928  for ( i=0; i <= tdg; i++ ) presults[i]= nInit(0);
    29342929
    29352930  rootContainer ** roots;
    2936   roots= (rootContainer **) Alloc( loops * sizeof(rootContainer*) );
     2931  roots= (rootContainer **) omAlloc( loops * sizeof(rootContainer*) );
    29372932  for ( i=0; i < loops; i++ ) roots[i]= new rootContainer(); // 0..n-2
    29382933
    2939   number *pevpoint= (number *)Alloc( n * sizeof( number ) );
     2934  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
    29402935  for (i=0; i < n; i++) pevpoint[i]= nInit(0);
    29412936
    2942   number *pev= (number *)Alloc( n * sizeof( number ) );
     2937  number *pev= (number *)omAlloc( n * sizeof( number ) );
    29432938  for (i=0; i < n; i++) pev[i]= nInit(0);
    29442939
     
    30463041  // free some stuff: pev, presult
    30473042  for ( i=0; i < n; i++ ) nDelete( pev + i );
    3048   Free( (ADDRESS)pev, n * sizeof( number ) );
     3043  omFreeSize( (ADDRESS)pev, n * sizeof( number ) );
    30493044
    30503045  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 ) );
    30523047
    30533048  return roots;
     
    30663061
    30673062  rootContainer ** roots;
    3068   roots= (rootContainer **) Alloc( loops * sizeof(rootContainer*) );
     3063  roots= (rootContainer **) omAlloc( loops * sizeof(rootContainer*) );
    30693064  for ( i=0; i < loops; i++ ) roots[i]= new rootContainer(); // 0..n-2
    30703065
    3071   number *pevpoint= (number *)Alloc( n * sizeof( number ) );
     3066  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
    30723067  for (i=0; i < n; i++) pevpoint[i]= nInit(0);
    30733068
     
    31063101    pures= resMat->getUDet( pevpoint );
    31073102
    3108     number *ncpoly= (number *)Alloc( (tdg+1) * sizeof(number) );
     3103    number *ncpoly= (number *)omAlloc( (tdg+1) * sizeof(number) );
    31093104
    31103105#ifdef MPR_MASI
     
    31593154  // free some stuff: pev, presult
    31603155  for ( i=0; i < n; i++ ) nDelete( pevpoint + i );
    3161   Free( (ADDRESS)pevpoint, n * sizeof( number ) );
     3156  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
    31623157
    31633158  return roots;
     
    32093204
    32103205//-----------------------------------------------------------------------------
    3211 
    3212 #endif // ! ASO_GENERATE
    32133206
    32143207// local Variables: ***
Note: See TracChangeset for help on using the changeset viewer.