maal::boost::Vector Class Reference

Vector class that include the boost::ublas::vector. More...

#include <jrl/mal/boostvector.hh>

Public Member Functions

Constructors
 Vector (const InternalVector::size_type size=0)
 Classical constructor. More...
 
 Vector (InternalVector *clone, const bool proprio=false)
 Build only the capsule around a already existing boost vector object. More...
 
 Vector (const Vector &copy)
 Build a new internal vector from existing boost vector object by copying the data. More...
 
virtual ~Vector (void)
 
InternalVector & accessToMotherLib (void)
 Access to the boost internal vector. More...
 
const InternalVector & accessToMotherLib (void) const
 Access to the boost internal vector. More...
 
VectorinitFromMotherLib (const InternalVector &bv)
 Copy the values and data of an existing boost vector. More...
 
Modifiors
unsigned int size (void) const
 
Vectorresize (const InternalVector::size_type nbRows, const bool setZero=true)
 
Vectorfill (const FloatType value)
 
VectorsetZero (void)
 
Vectoropposite (Vector &res) const
 
Vector opposite (void) const
 
Accessors

Access to an element, a block of element or the hidden double-array matrix.

const FloatTypedatablock (void) const
 Access to the C-style double matrix. More...
 
FloatTypedatablock (void)
 Access to the C-style double matrix. More...
 
const FloatTypeelementAt (const InternalVector::size_type row) const
 Access to the i-th element in R-only. More...
 
FloatTypeelementAt (const InternalVector::size_type row)
 Access to the i-th element in RW-mode. More...
 
Vectorextract (const InternalVector::size_type top, const InternalVector::size_type nbrows, Vector &C) const
 Extract a part of the vector. More...
 
Vector extract (const InternalVector::size_type top, const InternalVector::size_type nbrows) const
 Extract a part of the vector. More...
 

Protected Attributes

InternalVector staticVector
 
InternalVector * dynamicVector
 
InternalVector & vector
 
bool proprio
 

Static Protected Attributes

static const bool AUTORESIZE = true
 
static const bool CHECKRESIZE = true
 

Operators

Classical operators: use v1 + v2 for addition, v1(i) for i-th element...

class Matrix
 
Vector operator+ (const Vector &v1, const Vector &v2)
 
Vector operator- (const Vector &v1, const Vector &v2)
 
Vector operator* (const Vector &v1, const Vector &v2)
 
Vector operator* (const Vector &v1, const FloatType x)
 
Vector operator* (const FloatType x, const Vector &v1)
 
Vector operator- (const Vector &v1)
 
std::istream & operator>> (std::istream &is, Vector &v1)
 
std::ostream & operator<< (std::ostream &os, const Vector &v1)
 
Vectoroperator+= (const Vector &v1)
 
Vectoroperator-= (const Vector &v1)
 
Vectoroperator*= (const Vector &v1)
 
Vectoroperator*= (const FloatType x)
 
const FloatTypeoperator() (const InternalVector::size_type i) const
 
FloatTypeoperator() (const InternalVector::size_type i)
 
Vectoroperator= (const Vector &v1)
 

Scalar Operator E->R

FloatType norm (void) const
 
FloatType norm1 (void) const
 Norm 1 sum( |xi| )
More...
 
FloatType max (void) const
 Not implemented yet. More...
 
FloatType min (void) const
 Not implemented yet. More...
 
FloatType sumSquare (void) const
 Not implemented yet. More...
 
FloatType normInfty (void) const
 Infinity norm: max( |xi| ). More...
 
FloatType scalarProduct (const Vector &v2) const
 Scalar product: v1.v2 = sum( x1*x2 ). More...
 
static FloatType scalarProduct (const Vector &v1, const Vector &v2)
 Scalar product: v1.v2 = sum( x1*x2 ). More...
 

Operator Functions ExE->E

Each C-style function is implemented as a C++ operator.

VectorcrossProduct (const Vector &v2, Vector &res) const
 
Vector crossProduct (const Vector &v2)
 
Vector multiply (const Vector &v2) const
 
Vectormultiply (const Vector &v2, Vector &res) const
 
Vector multiply (const FloatType x) const
 
Vectormultiply (const FloatType x, Vector &res) const
 
Vector addition (const Vector &v2) const
 
Vectoraddition (const Vector &v2, Vector &res) const
 
Vector substraction (const Vector &v2) const
 
Vectorsubstraction (const Vector &v2, Vector &res) const
 
static VectorcrossProduct (const Vector &v1, const Vector &v2, Vector &res)
 
static Vectormultiply (const Vector &v1, const Vector &v2, Vector &res)
 
static Vectormultiply (const Vector &v1, const FloatType x, Vector &res)
 
static Vectoraddition (const Vector &v1, const Vector &v2, Vector &res)
 
static Vectorsubstraction (const Vector &v1, const Vector &v2, Vector &res)
 

Internal functions (autoresize)

bool autoresize (void)
 
static void _resize (InternalVector &vct1, const InternalVector &vct2)
 
static bool _checksize (const InternalVector &vct1, const InternalVector &vct2)
 
static bool _checksizeVerb (const InternalVector &vct1, const InternalVector &vct2)
 
static bool _checksize (const InternalVector &vct1, const InternalVector::size_type s2)
 
static bool _checksizeVerb (const InternalVector &vct1, const InternalVector::size_type s2)
 

Detailed Description

Vector class that include the boost::ublas::vector.

The class simply encapsulates the ublas::vector object, and implement a set of standard functions. When the maal::boost::Vector object is constructed, it automatically builds the internal ublas::vector object. The internal object can be access through accessToMotherLib. Finally, it is possible to build the capsule around an existing boost ublas::vector through the appropriate constructor.

Constructor & Destructor Documentation

◆ Vector() [1/3]

maal::boost::Vector::Vector ( const InternalVector::size_type  size = 0)
inline

Classical constructor.

Build the internal vector from the demanded size.

◆ Vector() [2/3]

maal::boost::Vector::Vector ( InternalVector *  clone,
const bool  proprio = false 
)
inline

Build only the capsule around a already existing boost vector object.

◆ Vector() [3/3]

maal::boost::Vector::Vector ( const Vector copy)
inline

Build a new internal vector from existing boost vector object by copying the data.

◆ ~Vector()

virtual maal::boost::Vector::~Vector ( void  )
inlinevirtual

References dynamicVector, and proprio.

Member Function Documentation

◆ _checksize() [1/2]

static bool maal::boost::Vector::_checksize ( const InternalVector &  vct1,
const InternalVector &  vct2 
)
inlinestaticprotected

◆ _checksize() [2/2]

static bool maal::boost::Vector::_checksize ( const InternalVector &  vct1,
const InternalVector::size_type  s2 
)
inlinestaticprotected

References CHECKRESIZE.

◆ _checksizeVerb() [1/2]

static bool maal::boost::Vector::_checksizeVerb ( const InternalVector &  vct1,
const InternalVector &  vct2 
)
inlinestaticprotected

References CHECKRESIZE.

◆ _checksizeVerb() [2/2]

static bool maal::boost::Vector::_checksizeVerb ( const InternalVector &  vct1,
const InternalVector::size_type  s2 
)
inlinestaticprotected

References CHECKRESIZE.

◆ _resize()

static void maal::boost::Vector::_resize ( InternalVector &  vct1,
const InternalVector &  vct2 
)
inlinestaticprotected

References AUTORESIZE.

Referenced by crossProduct(), and multiply().

◆ accessToMotherLib() [1/2]

InternalVector& maal::boost::Vector::accessToMotherLib ( void  )
inline

Access to the boost internal vector.

References vector.

◆ accessToMotherLib() [2/2]

const InternalVector& maal::boost::Vector::accessToMotherLib ( void  ) const
inline

Access to the boost internal vector.

References vector.

◆ addition() [1/3]

static Vector& maal::boost::Vector::addition ( const Vector v1,
const Vector v2,
Vector res 
)
inlinestatic

References addition().

Referenced by addition(), and operator+=().

◆ addition() [2/3]

Vector maal::boost::Vector::addition ( const Vector v2) const
inline

References addition(), and size().

◆ addition() [3/3]

Vector& maal::boost::Vector::addition ( const Vector v2,
Vector res 
) const
inline

◆ autoresize()

bool maal::boost::Vector::autoresize ( void  )
inline

References AUTORESIZE.

◆ crossProduct() [1/3]

static Vector& maal::boost::Vector::crossProduct ( const Vector v1,
const Vector v2,
Vector res 
)
inlinestatic

References crossProduct().

Referenced by crossProduct().

◆ crossProduct() [2/3]

Vector maal::boost::Vector::crossProduct ( const Vector v2)
inline

References crossProduct(), and size().

◆ crossProduct() [3/3]

Vector& maal::boost::Vector::crossProduct ( const Vector v2,
Vector res 
) const
inline

◆ datablock() [1/2]

FloatType* maal::boost::Vector::datablock ( void  )
inline

Access to the C-style double matrix.

References vector, and VRAWDATA.

◆ datablock() [2/2]

const FloatType* maal::boost::Vector::datablock ( void  ) const
inline

Access to the C-style double matrix.

References vector, and VRAWDATA.

◆ elementAt() [1/2]

FloatType& maal::boost::Vector::elementAt ( const InternalVector::size_type  row)
inline

Access to the i-th element in RW-mode.

This C-style function is equivalent to the C++ operator().

References _checksize(), MAAL_CHECKVERBOSE, and vector.

◆ elementAt() [2/2]

const FloatType& maal::boost::Vector::elementAt ( const InternalVector::size_type  row) const
inline

Access to the i-th element in R-only.

This C-style function is equivalent to the C++ operator().

References _checksize(), MAAL_CHECKVERBOSE, and vector.

Referenced by operator()().

◆ extract() [1/2]

Vector maal::boost::Vector::extract ( const InternalVector::size_type  top,
const InternalVector::size_type  nbrows 
) const
inline

Extract a part of the vector.

Not implemented yet.

References extract().

◆ extract() [2/2]

Vector& maal::boost::Vector::extract ( const InternalVector::size_type  top,
const InternalVector::size_type  nbrows,
Vector C 
) const
inline

Extract a part of the vector.

Not implemented yet.

References _checksize(), MAAL_CHECKVERBOSE, and vector.

Referenced by extract().

◆ fill()

Vector& maal::boost::Vector::fill ( const FloatType  value)
inline

References size(), and vector.

◆ initFromMotherLib()

Vector& maal::boost::Vector::initFromMotherLib ( const InternalVector &  bv)
inline

Copy the values and data of an existing boost vector.

References vector.

◆ max()

FloatType maal::boost::Vector::max ( void  ) const
inline

Not implemented yet.

References ML_NOT_IMPLEMENTED.

◆ min()

FloatType maal::boost::Vector::min ( void  ) const
inline

Not implemented yet.

References ML_NOT_IMPLEMENTED.

◆ multiply() [1/6]

Vector maal::boost::Vector::multiply ( const FloatType  x) const
inline

References multiply(), and size().

◆ multiply() [2/6]

Vector& maal::boost::Vector::multiply ( const FloatType  x,
Vector res 
) const
inline

References vector.

◆ multiply() [3/6]

static Vector& maal::boost::Vector::multiply ( const Vector v1,
const FloatType  x,
Vector res 
)
inlinestatic

References multiply().

◆ multiply() [4/6]

static Vector& maal::boost::Vector::multiply ( const Vector v1,
const Vector v2,
Vector res 
)
inlinestatic

References multiply().

Referenced by multiply(), and operator*=().

◆ multiply() [5/6]

Vector maal::boost::Vector::multiply ( const Vector v2) const
inline

References multiply(), and size().

◆ multiply() [6/6]

Vector& maal::boost::Vector::multiply ( const Vector v2,
Vector res 
) const
inline

◆ norm()

FloatType maal::boost::Vector::norm ( void  ) const
inline

References vector.

◆ norm1()

FloatType maal::boost::Vector::norm1 ( void  ) const
inline

Norm 1 sum( |xi| )

References vector.

◆ normInfty()

FloatType maal::boost::Vector::normInfty ( void  ) const
inline

Infinity norm: max( |xi| ).

References vector.

◆ operator()() [1/2]

FloatType& maal::boost::Vector::operator() ( const InternalVector::size_type  i)
inline

References elementAt().

◆ operator()() [2/2]

const FloatType& maal::boost::Vector::operator() ( const InternalVector::size_type  i) const
inline

References vector.

◆ operator*=() [1/2]

Vector& maal::boost::Vector::operator*= ( const FloatType  x)
inline

References multiply().

◆ operator*=() [2/2]

Vector& maal::boost::Vector::operator*= ( const Vector v1)
inline

References multiply().

◆ operator+=()

Vector& maal::boost::Vector::operator+= ( const Vector v1)
inline

References addition().

◆ operator-=()

Vector& maal::boost::Vector::operator-= ( const Vector v1)
inline

References substraction().

◆ operator=()

Vector& maal::boost::Vector::operator= ( const Vector v1)
inline

References vector.

◆ opposite() [1/2]

Vector& maal::boost::Vector::opposite ( Vector res) const
inline

References vector.

◆ opposite() [2/2]

Vector maal::boost::Vector::opposite ( void  ) const
inline

References size().

◆ resize()

Vector& maal::boost::Vector::resize ( const InternalVector::size_type  nbRows,
const bool  setZero = true 
)
inline

References setZero(), and vector.

Referenced by maal::boost::Matrix::getDiagonal().

◆ scalarProduct() [1/2]

static FloatType maal::boost::Vector::scalarProduct ( const Vector v1,
const Vector v2 
)
inlinestatic

Scalar product: v1.v2 = sum( x1*x2 ).

References vector.

◆ scalarProduct() [2/2]

FloatType maal::boost::Vector::scalarProduct ( const Vector v2) const
inline

Scalar product: v1.v2 = sum( x1*x2 ).

References vector.

◆ setZero()

Vector& maal::boost::Vector::setZero ( void  )
inline

References vector.

Referenced by resize().

◆ size()

unsigned int maal::boost::Vector::size ( void  ) const
inline

◆ substraction() [1/3]

static Vector& maal::boost::Vector::substraction ( const Vector v1,
const Vector v2,
Vector res 
)
inlinestatic

References substraction().

Referenced by operator-=(), and substraction().

◆ substraction() [2/3]

Vector maal::boost::Vector::substraction ( const Vector v2) const
inline

References size(), and substraction().

◆ substraction() [3/3]

Vector& maal::boost::Vector::substraction ( const Vector v2,
Vector res 
) const
inline

◆ sumSquare()

FloatType maal::boost::Vector::sumSquare ( void  ) const
inline

Not implemented yet.

References ML_NOT_IMPLEMENTED.

Friends And Related Function Documentation

◆ Matrix

friend class Matrix
friend

◆ operator* [1/3]

Vector operator* ( const FloatType  x,
const Vector v1 
)
friend

◆ operator* [2/3]

Vector operator* ( const Vector v1,
const FloatType  x 
)
friend

◆ operator* [3/3]

Vector operator* ( const Vector v1,
const Vector v2 
)
friend

◆ operator+

Vector operator+ ( const Vector v1,
const Vector v2 
)
friend

◆ operator- [1/2]

Vector operator- ( const Vector v1)
friend

◆ operator- [2/2]

Vector operator- ( const Vector v1,
const Vector v2 
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Vector v1 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  is,
Vector v1 
)
friend

Member Data Documentation

◆ AUTORESIZE

const bool maal::boost::Vector::AUTORESIZE = true
staticprotected

Referenced by _resize(), and autoresize().

◆ CHECKRESIZE

const bool maal::boost::Vector::CHECKRESIZE = true
staticprotected

Referenced by _checksize(), and _checksizeVerb().

◆ dynamicVector

InternalVector* maal::boost::Vector::dynamicVector
protected

Referenced by ~Vector().

◆ proprio

bool maal::boost::Vector::proprio
protected

Referenced by ~Vector().

◆ staticVector

InternalVector maal::boost::Vector::staticVector
protected

◆ vector