28#ifndef _DSVECTORBASE_H_
29#define _DSVECTORBASE_H_
37template <
class R >
class VectorBase;
38template <
class S >
class SSVectorBase;
39template <
class R >
class SLinSolver;
76 for(
int i = 0; i < n; i++)
236 void add(
int i,
const R& v)
250 void add(
int n,
const int i[],
const R v[])
263 int len = (newmax < siz) ? siz : newmax;
276 for(i = 0; i < siz; i++)
305#ifdef ENABLE_CONSISTENCY_CHECKS
351 int len = (newmax < siz) ? siz : newmax;
354 setMem(len, theelem);
void makeMem(int n)
Ensure there is room for n new nonzeros.
void add(int i)
Append one uninitialized nonzero.
void add(int n, const int i[], const R v[])
Append n nonzeros.
bool isConsistent() const
Consistency check.
void allocMem(int n)
Allocate memory for n nonzeros.
DSVectorBase(const SVectorBase< S > &old)
Copy constructor.
void add(int i, const R &v)
Append one nonzero (i,v).
DSVectorBase(const DSVectorBase< R > &old)
Copy constructor.
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
DSVectorBase(const DSVectorBase< S > &old)
Copy constructor.
DSVectorBase(int n=8)
Default constructor.
DSVectorBase< R > & operator=(const DSVectorBase< R > &vec)
Assignment operator.
DSVectorBase< R > & operator=(const DSVectorBase< S > &vec)
Assignment operator.
virtual ~DSVectorBase()
Destructor.
void setMax(int newmax=1)
Reset nonzero memory to >= newmax.
DSVectorBase< R > & operator=(const SVectorBase< S > &vec)
Assignment operator.
Nonzero< R > * theelem
Memory.
Sparse vector nonzero element.
Sparse Linear Solver virtual base class.
void setMem(int n, Nonzero< R > *elmem)
Set the memory area where the nonzeros will be stored.
void add(int i, const R &v)
Append one nonzero (i,v).
void set_size(int s)
Set size of the vector.
SVectorBase< R > & operator=(const VectorBase< S > &vec)
Assignment operator.
void clear()
Remove all indices.
int size() const
Number of used indices.
Everything should be within this namespace.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
void spx_free(T &p)
Release memory.
void spx_alloc(T &p, int n=1)
Allocate memory.
#define SPX_MSG_INCONSISTENT(name)