Changeset 327475 in git for Singular/fglmhom.cc


Ignore:
Timestamp:
Jul 15, 1999, 3:37:33 PM (25 years ago)
Author:
Tim Wichmann <wichmann@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
877605d1338b4f0ed83344657f95df0a346fca17
Parents:
457bd7daf379c8a6dd5fa01fc2193ed676a5f9f3
Message:
* Added Support for HAVE_EXPLICIT_CONSTR


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

Legend:

Unmodified
Added
Removed
  • Singular/fglmhom.cc

    r457bd7d r327475  
    11// emacs edit mode for this file is -*- C++ -*-
    2 // $Id: fglmhom.cc,v 1.12 1999-03-09 12:28:46 obachman Exp $
     2// $Id: fglmhom.cc,v 1.13 1999-07-15 13:37:33 wichmann Exp $
    33
    44/****************************************
     
    6767        mon.sm= NULL;
    6868    }
     69#ifndef HAVE_EXPLICIT_CONSTR
     70    void initialize( poly m, int b, BOOLEAN ind )
     71    {
     72        basis = b;
     73        inDest = ind;
     74        mon.dm = m;
     75        mon.sm = NULL;
     76    }
     77    void initialize( const homogElem h )
     78    {
     79        basis = h.basis;
     80        inDest = h.inDest;
     81        mon.dm = h.mon.dm;
     82        mon.sm = h.mon.sm;
     83    }
     84#endif
    6985};
    7086
     
    147163                ++dat->numberofdestbasismonoms;
    148164            if ( dat->numMonoms == dat->monlistmax ) {
    149                 dat->monlist= (homogElem * )ReAlloc( dat->monlist, (dat->monlistmax)*sizeof( homogElem ), (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) );
    150165                int k;
     166#ifdef HAVE_EXPLICIT_CONSTR
     167                // Expand array using Singulars ReAlloc function
     168                dat->monlist=
     169                    (homogElem * )ReAlloc( dat->monlist,
     170                                           (dat->monlistmax)*sizeof( homogElem ),
     171                                           (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) );
    151172                for ( k= dat->monlistmax; k < (dat->monlistmax+dat->monlistblock); k++ )
    152173                    dat->monlist[k].homogElem();
     174#else
     175                // Expand array by generating new one and copying
     176                int newsize = dat->monlistmax  + dat->monlistblock;
     177                homogElem * tempelem = new homogElem[ newsize ];
     178                // Copy old elements
     179                for ( k= dat->monlistmax - 1; k >= 0; k-- )
     180                    tempelem[k].initialize( dat->monlist[k] );
     181                delete [] homogElem;
     182                homogElem = tempelem;
     183#endif
    153184                dat->monlistmax+= dat->monlistblock;
    154185            }
     186#ifdef HAVE_EXPLICIT_CONSTR
    155187            dat->monlist[dat->numMonoms]= homogElem( mon, basis, inDest );
     188#else
     189            dat->monlist[dat->numMonoms].initialize( mon, basis, inDest );
     190#endif
    156191            dat->numMonoms++;
    157192            if ( inSource && ! inDest ) PROT( "\\" );
     
    342377        dat.monlistblock= 512;
    343378        dat.monlistmax= dat.monlistblock;
     379#ifdef HAVE_EXPLICIT_CONSTR
    344380        dat.monlist= (homogElem *)Alloc( dat.monlistmax*sizeof( homogElem ) );
    345381        int j;
    346382        for ( j= dat.monlistmax - 1; j >= 0; j-- ) dat.monlist[j].homogElem();
     383#else
     384        dat.monlist = new homogElem[ dat.monlistmax ];
     385#endif
    347386        dat.numMonoms= 0;
    348387        dat.basisSize= 0;
     
    369408        gaussreduce( dat, numGBelems, groebnerBS );
    370409
     410#ifdef HAVE_EXPLICIT_CONSTR
    371411        Free( (ADDRESS)dat.monlist, dat.monlistmax*sizeof( homogElem ) );
     412#else
     413        delete [] dat.monlist;
     414#endif
    372415        PROT( "<\n" );
    373416    }
Note: See TracChangeset for help on using the changeset viewer.