fmatvec  0.0.0
Fast Matrix/Vector Library
Public Types | Public Member Functions | Static Public Attributes | List of all members
fmatvec::Vector< Fixed< M >, AT > Class Template Reference

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

#include <fixed_vector.h>

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

Public Types

typedef AT * iterator
 
typedef const AT * const_iterator
 
typedef AT value_type
 
- Public Types inherited from fmatvec::Matrix< General, Fixed< M >, Fixed< 1 >, AT >
typedef AT value_type
 
typedef General shape_type
 

Public Member Functions

 Vector (Noinit ini)
 
 Vector (Init ini=INIT, const AT &a=AT())
 
 Vector (int m, Noinit ini)
 
 Vector (int m, Init ini=INIT, const AT &a=AT())
 
 Vector (const Vector< Fixed< M >, AT > &x)=default
 Copy Constructor. More...
 
template<class Row >
 Vector (const Vector< Row, AT > &A)
 Copy Constructor. More...
 
template<class Type , class Row , class Col >
 Vector (const Matrix< Type, Row, Col, AT > &A)
 Copy Constructor. More...
 
 Vector (const char *str)
 String Constructor. More...
 
Vector< Fixed< M >, AT > & operator= (const Vector< Fixed< M >, AT > &x)=default
 Assignment operator. More...
 
template<class Row >
Vector< Fixed< M >, AT > & operator= (const Vector< Row, AT > &x)
 Assignment operator. More...
 
template<class Row >
Vector< Fixed< M >, AT > & operator<<= (const Vector< Row, AT > &x)
 Vector assignment. More...
 
template<class AT2 >
 operator Vector< Fixed< M >, 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
 Element operator. More...
 
Vector< Fixed< M >, AT > & init (const AT &val=AT())
 Initialization. More...
 
Vector< Fixed< M >, AT > & init (Init, const AT &a=AT())
 
Vector< Fixed< M >, AT > & init (Noinit, const AT &a=AT())
 
constexpr int size () const
 Size. More...
 
void resize (int m)
 
int inc () const
 Increment. More...
 
template<int M1, int M2>
const Vector< Fixed< M2-M1+1 >, AT > operator() (const Range< Fixed< M1 >, Fixed< M2 >> &I) 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...
 
const RowVector< Fixed< M >, AT > T () const
 Cast to AT. More...
 
template<class Type , class Row , class Col >
void set (const Range< Var, Var > &I, const Matrix< Type, Row, Col, AT > &A)
 set a subvector - specified by the range - to the given vector
 
- Public Member Functions inherited from fmatvec::Matrix< General, Fixed< M >, Fixed< 1 >, AT >
AT & operator() (int i, int j)
 Standard constructor. 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
 
int rows () const
 Number of rows. More...
 
int cols () const
 Number of columns. More...
 
 operator std::vector< std::vector< AT >> () const
 Cast to std::vector<std::vector<AT>>. More...
 

Static Public Attributes

static constexpr bool isVector {true}
 
- Static Public Attributes inherited from fmatvec::Matrix< General, Fixed< M >, Fixed< 1 >, AT >
static constexpr bool isVector
 

Detailed Description

template<int M, class AT>
class fmatvec::Vector< Fixed< M >, AT >

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

Template class Vector of type General, 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<int M, class AT >
fmatvec::Vector< Fixed< M >, AT >::Vector ( const Vector< Fixed< M >, AT > &  x)
default

Copy Constructor.

Constructs a reference to the vector x.

Attention
The physical memory of the vector x will not be copied, only referenced.
Parameters
xThe vector that will be referenced.

◆ Vector() [2/5]

template<int M, class AT >
template<class Row >
fmatvec::Vector< Fixed< M >, AT >::Vector ( const Vector< Row, AT > &  A)
inline

Copy Constructor.

See Vector(const Vector<General, AT>&)

◆ Vector() [3/5]

template<int M, class AT >
template<class Type , class Row , class Col >
fmatvec::Vector< Fixed< M >, AT >::Vector ( const Matrix< Type, Row, Col, AT > &  A)
inlineexplicit

Copy Constructor.

See Vector(const Vector<General, AT>&)

◆ Vector() [4/5]

template<int M, class AT >
fmatvec::Vector< Fixed< M >, 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<int M, class AT >
fmatvec::Vector< Fixed< M >, 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

◆ e()

template<int M, class AT >
const AT& fmatvec::Vector< Fixed< M >, AT >::e ( int  i) const
inline

Element operator.

See e(int)

◆ inc()

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

Increment.

Todo:
Docu
Returns
The increment.

◆ init()

template<int M, class AT >
Vector< Fixed< M >, AT > & fmatvec::Vector< Fixed< M >, 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<int M, class AT >
fmatvec::Vector< Fixed< M >, 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<int M, class AT >
AT& fmatvec::Vector< Fixed< M >, 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/2]

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

Element operator.

See operator()(int)

◆ operator<<=()

template<int M, class AT >
template<class Row >
Vector<Fixed<M>,AT>& fmatvec::Vector< Fixed< M >, 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<int M, class AT >
Vector<Fixed<M>,AT>& fmatvec::Vector< Fixed< M >, AT >::operator= ( const Vector< Fixed< M >, AT > &  x)
inlinedefault

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<int M, class AT >
template<class Row >
Vector<Fixed<M>,AT>& fmatvec::Vector< Fixed< M >, 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.

◆ resize()

template<int M, class AT >
void fmatvec::Vector< Fixed< M >, AT >::resize ( int  m)
inline

Resize a fixed vector Do nothing for the fixed dimension and throw for any other dimension.

◆ size()

template<int M, class AT >
constexpr int fmatvec::Vector< Fixed< M >, AT >::size ( ) const
inline

Size.

Returns
The size of the vector.

◆ T()

template<int M, class AT >
const RowVector< Fixed< M >, AT > fmatvec::Vector< Fixed< M >, AT >::T ( ) const
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.

return the transpose of the Vector, i.e. a RowVector


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