fmatvec  2.0.0
Fast Matrix/Vector Library
Public Types | Public Member Functions | List of all members
fmatvec::Vector< Ref, AT > Class Template Reference

This is a vector class of general shape in dense storage format. More...

#include <vector.h>

Inheritance diagram for fmatvec::Vector< Ref, AT >:
[legend]

Public Types

typedef AT * iterator
 
typedef const AT * const_iterator
 
typedef AT value_type
 
- Public Types inherited from fmatvec::Matrix< General, Ref, Ref, AT >
typedef AT value_type
 

Public Member Functions

 Vector ()
 Standard constructor. More...
 
 Vector (int m, Noinit ini)
 
 Vector (int m, Init ini=INIT, const AT &a=AT())
 
 Vector (const Vector< Ref, AT > &x)
 Copy Constructor. More...
 
template<class Row >
 Vector (const Vector< Row, AT > &x)
 
template<class Type , class Row , class Col >
 Vector (const Matrix< Type, Row, Col, AT > &x)
 
 Vector (int m, AT *ele)
 Regular Constructor. More...
 
 Vector (const char *str)
 String Constructor. More...
 
Vector< Ref, AT > & resize (int m, Noinit)
 
Vector< Ref, AT > & resize (int m, Init ini=INIT, const AT &a=AT())
 
Vector< Ref, AT > & operator= (const Vector< Ref, AT > &x)
 Assignment operator. More...
 
template<class Row >
Vector< Ref, AT > & operator= (const Vector< Row, AT > &x)
 Assignment operator. More...
 
Vector< Ref, AT > & operator&= (Vector< Ref, AT > &x)
 Reference operator. More...
 
Vector< Ref, AT > & operator&= (Matrix< General, Ref, Ref, AT > &A)
 Reference operator. More...
 
template<class Row >
Vector< Ref, AT > & operator<<= (const Vector< Row, AT > &x)
 Vector assignment. More...
 
template<class AT2 >
 operator Vector< Ref, AT2 > () const
 
AT & operator() (int i)
 Element operator. More...
 
const AT & operator() (int i) const
 Element operator. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
AT & e (int i)
 
const AT & e (int i) const
 
Vector< Ref, AT > & init (const AT &val=AT())
 Initialization. More...
 
Vector< Ref, AT > & init (Init, const AT &a=AT())
 
Vector< Ref, AT > & init (Noinit, const AT &a=AT())
 
int size () const
 Size. More...
 
int inc () const
 Increment. More...
 
const Vector< Ref, AT > operator() (const Range< Var, Var > &I) const
 Subvector operator. More...
 
AT * operator() ()
 
const AT * operator() () const
 
 operator std::vector< AT > () const
 Cast to std::vector<AT>. More...
 
 Vector (const std::vector< AT > &v)
 std::vector<AT> Constructor. Constructs and initializes a vector with a std::vector<AT> object. More...
 
template<class Row >
void set (const fmatvec::Range< Var, Var > &I, const Vector< Row, AT > &x)
 Cast to AT. More...
 
template<class Row >
void add (const fmatvec::Range< Var, Var > &I, const Vector< Row, AT > &x)
 
void ref (Vector< Ref, AT > &x, const fmatvec::Range< Var, Var > &I)
 
void ref (Matrix< General, Ref, Ref, AT > &A, int j)
 
void ref (Matrix< General, Ref, Ref, AT > &A, const fmatvec::Range< Var, Var > &I, int j)
 
const RowVector< Ref, AT > T () const
 
- Public Member Functions inherited from fmatvec::Matrix< General, Ref, Ref, AT >
 Matrix ()
 Standard constructor. More...
 
 Matrix (int m_, int n_, Noinit)
 
 Matrix (int m_, int n_, Init ini=INIT, const AT &a=AT())
 
 Matrix (int m_, int n_, Eye ini, const AT &a=1)
 
 Matrix (const Matrix< General, Ref, Ref, AT > &A)
 Copy Constructor. More...
 
template<class Row , class Col >
 Matrix (const Matrix< General, Row, Col, AT > &A)
 Copy Constructor. More...
 
template<class Type , class Row , class Col >
 Matrix (const Matrix< Type, Row, Col, AT > &A)
 Copy Constructor. More...
 
 Matrix (int m_, int n_, AT *ele_)
 Regular Constructor. More...
 
 Matrix (const std::string &strs)
 String Constructor. More...
 
 Matrix (const char *strs)
 
 ~Matrix ()=default
 Destructor.
 
Matrix< General, Ref, Ref, AT > & resize (int m_, int n_, Noinit)
 
Matrix< General, Ref, Ref, AT > & resize (int m, int n, Init ini=INIT, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & resize (int m, int n, Eye ini, const AT &a=1)
 
Matrix< General, Ref, Ref, AT > & operator= (const Matrix< General, Ref, Ref, AT > &A)
 Assignment operator. More...
 
template<class Type , class Row , class Col >
Matrix< General, Ref, Ref, AT > & operator= (const Matrix< Type, Row, Col, AT > &A)
 Assignment operator. More...
 
Matrix< General, Ref, Ref, AT > & operator&= (Matrix< General, Ref, Ref, AT > &A)
 Reference operator. More...
 
template<class Type , class Row , class Col >
Matrix< General, Ref, Ref, AT > & operator<<= (const Matrix< Type, Row, Col, AT > &A)
 Matrix assignment. More...
 
template<class AT2 >
 operator Matrix< General, Ref, Ref, AT2 > () const
 
AT & operator() (int i, int j)
 Element operator. More...
 
const AT & operator() (int i, int j) const
 Element operator. More...
 
AT & e (int i, int j)
 
const AT & e (int i, int j) const
 
AT * operator() ()
 Pointer operator. More...
 
const AT * operator() () const
 Pointer operator. More...
 
int rows () const
 Number of rows. More...
 
int cols () const
 Number of columns. More...
 
int ldim () const
 Leading dimension. More...
 
const CBLAS_TRANSPOSE blasTrans () const
 Transposed status. More...
 
const CBLAS_ORDER blasOrder () const
 Storage convention. More...
 
const Matrix< General, Ref, Ref, AT > operator() (const Range< Var, Var > &I, const Range< Var, Var > &J) const
 Submatrix operator. More...
 
const SquareMatrix< Ref, AT > operator() (const Range< Var, Var > &I) const
 Submatrix operator.
 
const RowVector< Ref, AT > row (int i) const
 Row operator.
 
const Vector< Ref, AT > col (int j) const
 Column operator.
 
Matrix< General, Ref, Ref, AT > & init (const AT &val=AT())
 Initialization. More...
 
Matrix< General, Ref, Ref, AT > & init (Init, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & init (Eye, const AT &val=1)
 
Matrix< General, Ref, Ref, AT > & init (Noinit, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & init0 (const AT &val=AT())
 
Matrix< General, Ref, Ref, AT > & init0 (Init, const AT &a=AT())
 
 operator std::vector< std::vector< AT >> () const
 Cast to std::vector<std::vector<AT>>. More...
 
 Matrix (const std::vector< std::vector< AT >> &m)
 std::vector<std::vector<AT>> Constructor. Constructs and initializes a matrix with a std::vector<std::vector<AT>> object. An FMATVEC_ASSERT checks for constant length of each row. More...
 
const Matrix< General, Ref, Ref, AT > T () const
 Cast to AT. More...
 
template<class Row >
void set (int j, const Vector< Row, AT > &x)
 
template<class Col >
void set (int i, const RowVector< Col, AT > &x)
 
template<class Type , class Row , class Col >
void set (const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 
template<class Row >
void add (int j, const Vector< Row, AT > &x)
 
template<class Col >
void add (int i, const RowVector< Col, AT > &x)
 
template<class Type , class Row , class Col >
void add (const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 
template<class Type , class Row , class Col >
void sub (const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 
void ref (Matrix< General, Ref, Ref, AT > &A, const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J)
 
void ref (Matrix< Symmetric, Ref, Ref, AT > &A, const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J)
 
int countElements () const
 Count nonzero elements. More...
 

Detailed Description

template<class AT>
class fmatvec::Vector< Ref, AT >

This is a vector class of general shape in dense storage format.

Template class Vector of type General<Ref,Ref>, id. shape is general and storage form is dense. The template parameter AT defines the atomic type of the vector. Valid types are int, float, double, complex<float> and complex<double>

Constructor & Destructor Documentation

◆ Vector() [1/5]

template<class AT >
fmatvec::Vector< Ref, AT >::Vector ( )
inlineexplicit

Standard constructor.

Constructs a vector with no size.

◆ Vector() [2/5]

template<class AT >
fmatvec::Vector< Ref, AT >::Vector ( const Vector< Ref, AT > &  x)
inline

Copy Constructor.

Constructs a copy of the vector x.

Parameters
xThe vector that will be copied.

◆ Vector() [3/5]

template<class AT >
fmatvec::Vector< Ref, AT >::Vector ( int  m,
AT *  ele 
)
inlineexplicit

Regular Constructor.

Constructs a vector of size m with the pyhsical memory given by ele_;

Parameters
mThe size.
eleThe physical memory the vector will point to.

◆ Vector() [4/5]

template<class AT >
fmatvec::Vector< Ref, AT >::Vector ( const char *  str)
inline

String Constructor.

Constructs and initializes a vector with a string in a matlab-like notation. The entries are seperated by semicolons. For example

Vector<double> x("[3;1;2]");

constructs the vector

\[ x=\begin{pmatrix}3\\ 1 \\ 2\end{pmatrix} \]

Parameters
strThe string the vector will be initialized with.

◆ Vector() [5/5]

template<class AT >
fmatvec::Vector< Ref, AT >::Vector ( const std::vector< AT > &  v)
inlineexplicit

std::vector<AT> Constructor. Constructs and initializes a vector with a std::vector<AT> object.

Parameters
vThe std::vector<AT> the vector will be initialized with.

Member Function Documentation

◆ inc()

template<class AT >
int fmatvec::Vector< Ref, AT >::inc ( ) const
inline

Increment.

Todo:
Docu
Returns
The increment.

◆ init()

template<class AT >
Vector< Ref, AT > & fmatvec::Vector< Ref, AT >::init ( const AT &  val = AT())
inline

Initialization.

Initializes all elements of the calling vector with the value given by a.

Parameters
aValue all elements will be initialized with.
Returns
A reference to the calling vector.

◆ operator std::vector< AT >()

template<class AT >
fmatvec::Vector< Ref, AT >::operator std::vector< AT > ( ) const
inlineexplicit

Cast to std::vector<AT>.

Returns
The std::vector<AT> representation of the vector

◆ operator&=() [1/2]

template<class AT >
Vector<Ref,AT>& fmatvec::Vector< Ref, AT >::operator&= ( Vector< Ref, AT > &  x)
inline

Reference operator.

References the vector given by x.

Parameters
xThe vector to be referenced.
Returns
A reference to the calling vector.

◆ operator&=() [2/2]

template<class AT >
Vector<Ref,AT>& fmatvec::Vector< Ref, AT >::operator&= ( Matrix< General, Ref, Ref, AT > &  A)
inline

Reference operator.

References the matrix given by x.

Parameters
xThe matrix to be referenced.
Returns
A reference to the calling vector.

◆ operator()() [1/3]

template<class AT >
AT& fmatvec::Vector< Ref, AT >::operator() ( int  i)
inline

Element operator.

Returns a reference to the i-th element.

Parameters
iThe i-th element.
Returns
A reference to the element x(i).
Remarks
The bounds are checked in debug mode.
See also
operator()(int) const

◆ operator()() [2/3]

template<class AT >
const AT& fmatvec::Vector< Ref, AT >::operator() ( int  i) const
inline

Element operator.

See operator()(int)

◆ operator()() [3/3]

template<class AT >
const Vector< Ref, AT > fmatvec::Vector< Ref, AT >::operator() ( const Range< Var, Var > &  I) const
inline

Subvector operator.

See operator()(const Range<Var,Var>&)

◆ operator<<=()

template<class AT >
template<class Row >
Vector<Ref,AT>& fmatvec::Vector< Ref, AT >::operator<<= ( const Vector< Row, AT > &  x)
inline

Vector assignment.

Copies the vector given by x.

Parameters
xThe vector to be copied.
Returns
A reference to the calling vector.

◆ operator=() [1/2]

template<class AT >
Vector<Ref,AT>& fmatvec::Vector< Ref, AT >::operator= ( const Vector< Ref, AT > &  x)
inline

Assignment operator.

Copies the vector given by x.

Parameters
xThe vector to be assigned.
Returns
A reference to the calling vector.

◆ operator=() [2/2]

template<class AT >
template<class Row >
Vector<Ref,AT>& fmatvec::Vector< Ref, AT >::operator= ( const Vector< Row, AT > &  x)
inline

Assignment operator.

Copies the vector given by x.

Parameters
xThe vector to be assigned.
Returns
A reference to the calling vector.

◆ set()

template<class AT >
template<class Row >
void fmatvec::Vector< Ref, AT >::set ( const fmatvec::Range< Var, Var > &  I,
const Vector< Row, AT > &  x 
)
inline

Cast to AT.

Returns
The AT representation of the vector

AT Constructor. Constructs and initializes a vector with a AT object.

Parameters
xThe AT the vector will be initialized with.

◆ size()

template<class AT >
int fmatvec::Vector< Ref, AT >::size ( ) const
inline

Size.

Returns
The size of the vector.

The documentation for this class was generated from the following file: