19 #ifndef _DVECTORBASE_H_ 20 #define _DVECTORBASE_H_ 77 memsize = (d > 0) ? d : 4;
81 for(
int i = 0; i <
memsize; i++)
101 for(
int i = 0; i < VectorBase<R>::dimen; i++)
102 new(&(mem[i])) R(old[i]);
121 memsize = old.memsize;
125 for(
int i = 0; i < VectorBase<R>::dimen; i++)
126 new(&(mem[i])) R(old[i]);
143 memsize = old.memsize;
147 for(
int i = 0; i < VectorBase<R>::dimen; i++)
148 new(&(mem[i])) R(old[i]);
233 for(
int i = memsize - 1; i >= 0; i--)
253 void reDim(
int newdim,
const bool setZero =
true)
255 assert(memsize >= 0);
258 reSize(
int(newdim + 0.2 * memsize));
281 for(i = 0; i < VectorBase<R>::dim(); i++)
282 new(&(newmem[i])) R(mem[i]);
285 for(; i < newsize; i++)
286 new(&(newmem[i])) R();
289 for(i = memsize - 1; i >= 0; i--)
309 #ifdef ENABLE_CONSISTENCY_CHECKS 330 assert(newsize >=
dim());
347 memsize = (d > 0) ? d : 4;
392 #endif // _DVECTORBASE_H_ DVectorBase< R > & operator=(const VectorBase< R > &vec)
Assignment operator.
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase's dimension to newdim.
DVectorBase< R > & operator=(const DVectorBase< R > &vec)
Assignment operator.
bool isConsistent() const
Consistency check.
VectorBase< R > & operator=(const VectorBase< S > &vec)
Assignment operator.
Memory allocation routines.
Dynamic dense vectors.Class DVectorBase is a derived class of VectorBase adding automatic memory mana...
Dense vector.Class VectorBase provides dense linear algebra vectors. It does not provide memory manag...
int memsize
Length of array of values mem.
void spx_alloc(T &p, int n=1)
Allocate memory.
void reSize(int newsize)
Resets DVectorBase's memory size to newsize.
DVectorBase< R > & operator=(const VectorBase< S > &vec)
Assignment operator.
bool isConsistent() const
Consistency check.
Debugging, floating point type and parameter definitions.
DVectorBase< R > & operator=(const DVectorBase< S > &vec)
Assignment operator.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
int dim() const
Dimension of vector.
Everything should be within this namespace.
int memSize() const
Returns DVectorBase's memory size.
Sparse vectors.Class SVectorBase provides packed sparse vectors. Such are a sparse vectors...
#define MSGinconsistent(name)
void spx_free(T &p)
Release memory.