Changeset c232af in git for Singular/intvec.cc


Ignore:
Timestamp:
Aug 14, 2000, 2:58:28 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
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/intvec.cc

    r4697a8a rc232af  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: intvec.cc,v 1.16 1999-11-15 17:20:07 obachman Exp $ */
     4/* $Id: intvec.cc,v 1.17 2000-08-14 12:56:21 obachman Exp $ */
    55/*
    66* ABSTRACT: class intvec: lists/vectors of integers
     
    1212#include "febase.h"
    1313#include "intvec.h"
    14 #include "mmemory.h"
     14#include <omalloc.h>
    1515
    1616/*0 implementation*/
    1717
    18 #ifdef MDEBUG
    19 intvec::intvec(char* file, int line, int l)
    20 {
    21   v = (int *)mmDBAllocBlock0(sizeof(int)*l, file, line);
    22   row = l;
    23   col = 1;
    24 }
    25 
    26 intvec::intvec(char* file, int line, intvec* iv)
     18
     19intvec::intvec(intvec* iv)
    2720{
    2821  row = iv->rows();
    2922  col = iv->cols();
    30   v   = (int *)mmDBAllocBlock(sizeof(int)*row*col, file, line);
     23  v   = (int *)omAlloc(sizeof(int)*row*col);
    3124  for (int i=0; i<row*col; i++)
    3225  {
     
    3528}
    3629
    37 intvec::intvec(char* file, int line, int s, int e)
     30intvec::intvec(int s, int e)
    3831{
    3932  int inc;
     
    4942    inc = -1;
    5043  }
    51   v = (int *)mmDBAllocBlock(sizeof(int)*row, file, line);
     44  v = (int *)omAlloc(sizeof(int)*row);
    5245  for (int i=0; i<row; i++)
    5346  {
     
    5750}
    5851
    59 intvec::intvec(char* file, int line, int r, int c, int init)
     52intvec::intvec(int r, int c, int init)
    6053{
    6154  row = r;
     
    6356  int l = r*c;
    6457  if ((r>0) && (c>0))
    65     v = (int *)mmDBAllocBlock(sizeof(int)*l, file, line);
    66   else
    67     v = NULL;
    68   for (int i=0; i<l; i++)
    69   {
    70     v[i] = init;
    71   }
    72 }
    73 
    74 #endif // ! MDEBUG
    75 
    76 
    77 intvec::intvec(intvec* iv)
    78 {
    79   row = iv->rows();
    80   col = iv->cols();
    81   v   = (int *)Alloc(sizeof(int)*row*col);
    82   for (int i=0; i<row*col; i++)
    83   {
    84     v[i] = (*iv)[i];
    85   }
    86 }
    87 
    88 intvec::intvec(int s, int e)
    89 {
    90   int inc;
    91   col = 1;
    92   if (s<e)
    93   {
    94     row =  e-s+1;
    95     inc =  1;
    96   }
    97   else
    98   {
    99     row = s-e+1;
    100     inc = -1;
    101   }
    102   v = (int *)Alloc(sizeof(int)*row);
    103   for (int i=0; i<row; i++)
    104   {
    105     v[i] = s;
    106     s+=inc;
    107   }
    108 }
    109 
    110 intvec::intvec(int r, int c, int init)
    111 {
    112   row = r;
    113   col = c;
    114   int l = r*c;
    115   if ((r>0) && (c>0))
    116     v = (int *)Alloc(sizeof(int)*l);
     58    v = (int *)omAlloc(sizeof(int)*l);
    11759  else
    11860    v = NULL;
     
    169111{
    170112  assume(new_length > 0 && col == 1);
    171   v = (int*) ReAlloc0(v, row*sizeof(int), new_length*sizeof(int));
     113  v = (int*) omRealloc0Size(v, row*sizeof(int), new_length*sizeof(int));
    172114  row = new_length;
    173115}
     
    175117char * intvec::String(int dim)
    176118{
    177   return mstrdup(ivString(0, 0, dim));
     119  return omStrDup(ivString(0, 0, dim));
    178120}
    179121
     
    260202intvec * ivCopy(intvec * o)
    261203{
    262   intvec * iv=NewIntvecIv(o);
     204  intvec * iv=new intvec(o);
    263205  return iv;
    264206}
     
    273215  if (a->cols() == 1)
    274216  {
    275     iv = NewIntvec1(ma);
     217    iv = new intvec(ma);
    276218    for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
    277219    if (ma > mn)
     
    289231  }
    290232  if (mn != ma) return NULL;
    291   iv = NewIntvec1(a);
     233  iv = new intvec(a);
    292234  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
    293235  return iv;
     
    303245  if (a->cols() == 1)
    304246  {
    305     iv = NewIntvec1(ma);
     247    iv = new intvec(ma);
    306248    for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
    307249    if (ma > mn)
     
    319261  }
    320262  if (mn != ma) return NULL;
    321   iv = NewIntvec1(a);
     263  iv = new intvec(a);
    322264  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
    323265  return iv;
     
    327269{
    328270  int i, j, r = o->rows(), c = o->cols();
    329   intvec * iv= NewIntvec3(c, r, 0);
     271  intvec * iv= new intvec(c, r, 0);
    330272  for (i=0; i<r; i++)
    331273  {
     
    353295  intvec * iv;
    354296  if (ca != rb) return NULL;
    355   iv = NewIntvec3(ra, cb, 0);
     297  iv = new intvec(ra, cb, 0);
    356298  for (i=0; i<ra; i++)
    357299  {
     
    472414static intvec * ivIndepCols(intvec * imat)
    473415{
    474   intvec * result=NewIntvec3(1,imat->cols(),0);
     416  intvec * result=new intvec(1,imat->cols(),0);
    475417  int i,j;
    476418
     
    489431static intvec * ivBasicSol(intvec * imat)
    490432{
    491   intvec * result = NewIntvec3(2*imat->cols(),imat->cols(),0);
    492   intvec * indep=ivIndepCols(imat),*actsol=NewIntvec1(imat->cols());
     433  intvec * result = new intvec(2*imat->cols(),imat->cols(),0);
     434  intvec * indep=ivIndepCols(imat),*actsol=new intvec(imat->cols());
    493435  int actPosSol=1,actNegSol=imat->cols()+1,i=imat->cols(),j,k;
    494436  int tgcd,tlcm;
     
    552494intvec * ivSolveIntMat(intvec * imat)
    553495{
    554   intvec * result=NewIntvec1(imat->cols());
     496  intvec * result=new intvec(imat->cols());
    555497  intvec * basesol=ivBasicSol(imat);
    556498  int i=imat->cols(),j,k,l,t;
Note: See TracChangeset for help on using the changeset viewer.