SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::component::linearsolver::NewMatVector Class Reference

#include <NewMatVector.h>

Inheritance diagram for sofa::component::linearsolver::NewMatVector:

Public Member Functions

 NewMatVector ()
 
 ~NewMatVector () override
 
void resize (Index dim) override
 Resize the vector, and reset all values to 0. More...
 
SReal element (Index i) const override
 Read the value of element i. More...
 
void set (Index i, SReal v) override
 Write the value of element i. More...
 
void add (Index i, SReal v) override
 Add v to the existing value of element i. More...
 
SReal & operator[] (Index i)
 
SReal operator[] (Index i) const
 
Index size () const override
 Number of elements. More...
 
NEWMAT::GetSubMatrix sub (Index i, Index n)
 
template<class T >
void getsub (Index i, Index n, T &v)
 
template<class T >
void setsub (Index i, Index n, const T &v)
 
void clear () override
 v = 0 More...
 
void eq (const NewMatVector &a)
 v = a More...
 
void eq (const NewMatVector &a, const NewMatVector &b, double f=1.0)
 v = a+b*f More...
 
void peq (const NewMatVector &a, double f=1.0)
 v += a*f More...
 
void teq (double f)
 v *= f More...
 
double dot (const NewMatVector &a) const
 
double norm () const
 
template<class T >
void operator= (const T &m)
 
- Public Member Functions inherited from sofa::defaulttype::BaseVector
virtual ~BaseVector ()
 
virtual const floatelements (Index i0, Index n, float *src) const
 Get the values of n elements, starting at element i0, into given float buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual const doubleelements (Index i0, Index n, double *src) const
 Get the values of n elements, starting at element i0, into given double buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual const intelements (Index i0, Index n, int *src) const
 Get the values of n elements, starting at element i0, into given int buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual void set (Index i0, Index n, const float *src)
 Write the values of n float elements, starting at element i0. More...
 
virtual void set (Index i0, Index n, const double *src)
 Write the values of n double elements, starting at element i0. More...
 
virtual void set (Index i0, Index n, const int *src)
 Write the values of n int elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const float *src)
 Add to the values of n float elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const double *src)
 Add to the values of n double elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const int *src)
 Add to the values of n int elements, starting at element i0. More...
 
virtual void clear (Index i)
 Reset the value of element i to 0. More...
 
virtual ElementType getElementType () const
 
virtual std::size_t getElementSize () const
 
virtual bool isFull () const
 Return true if this vector is full, i.a. all elements are stored in memory. More...
 
bool isSparse () const
 

Friends

std::ostream & operator<< (std::ostream &out, const NewMatVector &v)
 

Additional Inherited Members

- Protected Member Functions inherited from sofa::defaulttype::BaseVector
template<class T >
const T * elementsDefaultImpl (Index i0, Index n, T *buffer) const
 
template<class T >
void setDefaultImpl (Index i0, Index n, const T *src)
 
template<class T >
void addDefaultImpl (Index i0, Index n, const T *src)
 

Constructor details

sofa::component::linearsolver::NewMatVector::NewMatVector ( )
inline
sofa::component::linearsolver::NewMatVector::~NewMatVector ( )
inlineoverride

Function details

void sofa::component::linearsolver::NewMatVector::add ( Index  i,
SReal  v 
)
inlineoverridevirtual

Add v to the existing value of element i.

Implements sofa::defaulttype::BaseVector.

void sofa::component::linearsolver::NewMatVector::clear ( )
inlineoverridevirtual

v = 0

Implements sofa::defaulttype::BaseVector.

double sofa::component::linearsolver::NewMatVector::dot ( const NewMatVector a) const
inline
Returns
v.a
SReal sofa::component::linearsolver::NewMatVector::element ( Index  i) const
inlineoverridevirtual

Read the value of element i.

Implements sofa::defaulttype::BaseVector.

void sofa::component::linearsolver::NewMatVector::eq ( const NewMatVector a)
inline

v = a

void sofa::component::linearsolver::NewMatVector::eq ( const NewMatVector a,
const NewMatVector b,
double  f = 1.0 
)
inline

v = a+b*f

template<class T >
void sofa::component::linearsolver::NewMatVector::getsub ( Index  i,
Index  n,
T &  v 
)
inline
double sofa::component::linearsolver::NewMatVector::norm ( ) const
inline
Returns
sqrt(v.v)
template<class T >
void sofa::component::linearsolver::NewMatVector::operator= ( const T &  m)
inline
SReal& sofa::component::linearsolver::NewMatVector::operator[] ( Index  i)
inline
SReal sofa::component::linearsolver::NewMatVector::operator[] ( Index  i) const
inline
void sofa::component::linearsolver::NewMatVector::peq ( const NewMatVector a,
double  f = 1.0 
)
inline

v += a*f

void sofa::component::linearsolver::NewMatVector::resize ( Index  dim)
inlineoverridevirtual

Resize the vector, and reset all values to 0.

Implements sofa::defaulttype::BaseVector.

void sofa::component::linearsolver::NewMatVector::set ( Index  i,
SReal  v 
)
inlineoverridevirtual

Write the value of element i.

Implements sofa::defaulttype::BaseVector.

template<class T >
void sofa::component::linearsolver::NewMatVector::setsub ( Index  i,
Index  n,
const T &  v 
)
inline
Index sofa::component::linearsolver::NewMatVector::size ( ) const
inlineoverridevirtual

Number of elements.

Implements sofa::defaulttype::BaseVector.

NEWMAT::GetSubMatrix sofa::component::linearsolver::NewMatVector::sub ( Index  i,
Index  n 
)
inline
void sofa::component::linearsolver::NewMatVector::teq ( double  f)
inline

v *= f

Related details

std::ostream& operator<< ( std::ostream &  out,
const NewMatVector v 
)
friend