Tiny Vector Matrix library using Expression Templates | Sourceforge Project Page |
#include <tvmet/Matrix.h>
The array syntax A[j][j] isn't supported here. The reason is that operator[] always takes exactly one parameter, but operator() can take any number of parameters (in the case of a rectangular matrix, two paramters are needed). Therefore the cleanest way to do it is with operator() rather than with operator[].
Public Types | |
enum | { Rows = NRows, Cols = NCols, Size = Rows * Cols } |
Dimensions. More... | |
enum | { ops_assign = Rows * Cols, ops = ops_assign, use_meta = ops < 8*8 ? true : false } |
Complexity counter. More... | |
typedef T | value_type |
Data type of the tvmet::Matrix. | |
typedef T & | reference |
Reference type of the tvmet::Matrix data elements. | |
typedef const T & | const_reference |
const reference type of the tvmet::Matrix data elements. | |
typedef T * | iterator |
STL iterator interface. | |
typedef const T * | const_iterator |
STL const_iterator interface. | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
STL reverse iterator interface. | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
STL const reverse iterator interface. | |
typedef MatrixConstReference< T, Rows, Cols > | ConstReference |
typedef MatrixSliceConstReference< T, 0, Rows, 0, Cols, Rows, 1 > | SliceConstReference |
Public Member Functions | |
iterator | begin () |
STL iterator interface. | |
iterator | end () |
STL iterator interface. | |
const_iterator | begin () const |
STL const_iterator interface. | |
const_iterator | end () const |
STL const_iterator interface. | |
reverse_iterator | rbegin () |
STL reverse iterator interface reverse begin. | |
const_reverse_iterator | rbegin () const |
STL const reverse iterator interface reverse begin. | |
reverse_iterator | rend () |
STL reverse iterator interface reverse end. | |
const_reverse_iterator | rend () const |
STL const reverse iterator interface reverse end. | |
~Matrix () | |
Default Destructor. | |
Matrix () | |
Default Constructor. | |
Matrix (const Matrix &rhs) | |
Copy Constructor, not explicit! | |
template<class InputIterator> | |
Matrix (InputIterator first, InputIterator last) | |
Constructor with STL iterator interface. | |
template<class InputIterator> | |
Matrix (InputIterator first, std::size_t sz) | |
Constructor with STL iterator interface. | |
Matrix (value_type rhs) | |
Construct the matrix by value. | |
template<class E> | |
Matrix (const XprMatrix< E, Rows, Cols > &e) | |
Construct a matrix by expression. | |
CommaInitializer< Matrix, Size > | operator= (value_type rhs) |
assign a value_type on array, this can be used for a single value or a comma separeted list of values. | |
value_type *__restrict | data () |
const value_type *__restrict | data () const |
value_type &__restrict | operator() (std::size_t i, std::size_t j) |
value_type | operator() (std::size_t i, std::size_t j) const |
ConstReference | const_ref () const |
Return a const Reference of the internal data. | |
ConstReference | const_sliceref () const |
Return a sliced const Reference of the internal data. | |
XprMatrix< ConstReference, Rows, Cols > | as_expr () const |
Return the vector as const expression. | |
template<class T2> | |
Matrix & | operator= (const Matrix< T2, Rows, Cols > &rhs) |
assign a given matrix of a different type T2 element wise to this matrix. | |
template<class E> | |
Matrix & | operator= (const XprMatrix< E, Rows, Cols > &rhs) |
assign a given XprMatrix element wise to this matrix. | |
Matrix & | operator+= (value_type) |
Matrix & | operator-= (value_type) |
Matrix & | operator *= (value_type) |
Matrix & | operator/= (value_type) |
Matrix & | operator%= (std::size_t) |
Matrix & | operator^= (std::size_t) |
Matrix & | operator &= (std::size_t) |
Matrix & | operator|= (std::size_t) |
Matrix & | operator<<= (std::size_t) |
Matrix & | operator>>= (std::size_t) |
template<class T2> | |
Matrix & | M_add_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_sub_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_mul_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_div_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_mod_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_xor_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_and_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_or_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_shl_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | M_shr_eq (const Matrix< T2, Rows, Cols > &) |
template<class E> | |
Matrix & | M_add_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_sub_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_mul_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_div_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_mod_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_xor_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_and_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_or_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_shl_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | M_shr_eq (const XprMatrix< E, Rows, Cols > &) |
template<class T2> | |
Matrix & | alias_assign (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | alias_add_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | alias_sub_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | alias_mul_eq (const Matrix< T2, Rows, Cols > &) |
template<class T2> | |
Matrix & | alias_div_eq (const Matrix< T2, Rows, Cols > &) |
template<class E> | |
Matrix & | alias_assign (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | alias_add_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | alias_sub_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | alias_mul_eq (const XprMatrix< E, Rows, Cols > &) |
template<class E> | |
Matrix & | alias_div_eq (const XprMatrix< E, Rows, Cols > &) |
std::ostream & | print_xpr (std::ostream &os, std::size_t l=0) const |
Member function for expression level printing. | |
std::ostream & | print_on (std::ostream &os) const |
Member function for printing internal data. | |
Static Public Member Functions | |
static std::size_t | size () |
The size of the matrix. | |
static std::size_t | max_size () |
STL vector max_size() - returns allways rows()*cols(). | |
static bool | empty () |
STL vector empty() - returns allways false. | |
static std::size_t | rows () |
The number of rows of matrix. | |
static std::size_t | cols () |
The number of columns of matrix. | |
static Info | info () |
Get an info object of this matrix. | |
Private Member Functions | |
template<class T2, class Assign> | |
void | assign_to (Matrix< T2, Rows, Cols > &dest, const Assign &assign_fn) const |
assign this to a matrix of a different type T2 using the functional assign_fn. | |
Matrix & | assign_value (value_type rhs) |
This is a helper for assigning a comma separated initializer list. | |
Static Private Member Functions | |
template<class Dest, class Src, class Assign> | |
static void | do_assign (dispatch< true >, Dest &dest, const Src &src, const Assign &assign_fn) |
Wrapper for meta assign. | |
template<class Dest, class Src, class Assign> | |
static void | do_assign (dispatch< false >, Dest &dest, const Src &src, const Assign &assign_fn) |
Wrapper for loop assign. | |
Private Attributes | |
value_type | m_data [Size] |
The data of matrix self. | |
Friends | |
class | CommaInitializer |
Classes | |
struct | Info |
Structure for info printing as Matrix<T, Rows, Cols>. More... |
typedef T tvmet::Matrix< T, NRows, NCols >::value_type |
Data type of the tvmet::Matrix.
typedef T& tvmet::Matrix< T, NRows, NCols >::reference |
Reference type of the tvmet::Matrix data elements.
typedef const T& tvmet::Matrix< T, NRows, NCols >::const_reference |
const reference type of the tvmet::Matrix data elements.
typedef T* tvmet::Matrix< T, NRows, NCols >::iterator |
STL iterator interface.
typedef const T* tvmet::Matrix< T, NRows, NCols >::const_iterator |
STL const_iterator interface.
typedef std::reverse_iterator<iterator> tvmet::Matrix< T, NRows, NCols >::reverse_iterator |
STL reverse iterator interface.
typedef std::reverse_iterator<const_iterator> tvmet::Matrix< T, NRows, NCols >::const_reverse_iterator |
STL const reverse iterator interface.
typedef MatrixConstReference<T, Rows, Cols> tvmet::Matrix< T, NRows, NCols >::ConstReference |
typedef MatrixSliceConstReference< T, 0, Rows, 0, Cols, Rows, 1 > tvmet::Matrix< T, NRows, NCols >::SliceConstReference |
anonymous enum |
anonymous enum |
tvmet::Matrix< T, NRows, NCols >::~Matrix | ( | ) | [inline] |
Default Destructor.
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | ) | [inline, explicit] |
Default Constructor.
The allocated memory region isn't cleared. If you want a clean use the constructor argument zero.
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | const Matrix< T, NRows, NCols > & | rhs | ) | [inline] |
Copy Constructor, not explicit!
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | InputIterator | first, | |
InputIterator | last | |||
) | [inline, explicit] |
Constructor with STL iterator interface.
The data will be copied into the matrix self, there isn't any stored reference to the array pointer.
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | InputIterator | first, | |
std::size_t | sz | |||
) | [inline, explicit] |
Constructor with STL iterator interface.
The data will be copied into the matrix self, there isn't any stored reference to the array pointer.
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | value_type | rhs | ) | [inline, explicit] |
Construct the matrix by value.
tvmet::Matrix< T, NRows, NCols >::Matrix | ( | const XprMatrix< E, Rows, Cols > & | e | ) | [inline, explicit] |
Construct a matrix by expression.
iterator tvmet::Matrix< T, NRows, NCols >::begin | ( | ) | [inline] |
STL iterator interface.
iterator tvmet::Matrix< T, NRows, NCols >::end | ( | ) | [inline] |
STL iterator interface.
const_iterator tvmet::Matrix< T, NRows, NCols >::begin | ( | ) | const [inline] |
STL const_iterator interface.
const_iterator tvmet::Matrix< T, NRows, NCols >::end | ( | ) | const [inline] |
STL const_iterator interface.
reverse_iterator tvmet::Matrix< T, NRows, NCols >::rbegin | ( | ) | [inline] |
STL reverse iterator interface reverse begin.
const_reverse_iterator tvmet::Matrix< T, NRows, NCols >::rbegin | ( | ) | const [inline] |
STL const reverse iterator interface reverse begin.
reverse_iterator tvmet::Matrix< T, NRows, NCols >::rend | ( | ) | [inline] |
STL reverse iterator interface reverse end.
const_reverse_iterator tvmet::Matrix< T, NRows, NCols >::rend | ( | ) | const [inline] |
STL const reverse iterator interface reverse end.
static std::size_t tvmet::Matrix< T, NRows, NCols >::size | ( | ) | [inline, static] |
The size of the matrix.
static std::size_t tvmet::Matrix< T, NRows, NCols >::max_size | ( | ) | [inline, static] |
STL vector max_size() - returns allways rows()*cols().
static bool tvmet::Matrix< T, NRows, NCols >::empty | ( | ) | [inline, static] |
STL vector empty() - returns allways false.
static std::size_t tvmet::Matrix< T, NRows, NCols >::rows | ( | ) | [inline, static] |
The number of rows of matrix.
static std::size_t tvmet::Matrix< T, NRows, NCols >::cols | ( | ) | [inline, static] |
The number of columns of matrix.
CommaInitializer<Matrix, Size> tvmet::Matrix< T, NRows, NCols >::operator= | ( | value_type | rhs | ) | [inline] |
assign a value_type on array, this can be used for a single value or a comma separeted list of values.
value_type* __restrict tvmet::Matrix< T, NRows, NCols >::data | ( | ) | [inline] |
const value_type* __restrict tvmet::Matrix< T, NRows, NCols >::data | ( | ) | const [inline] |
value_type& __restrict tvmet::Matrix< T, NRows, NCols >::operator() | ( | std::size_t | i, | |
std::size_t | j | |||
) | [inline] |
value_type tvmet::Matrix< T, NRows, NCols >::operator() | ( | std::size_t | i, | |
std::size_t | j | |||
) | const [inline] |
ConstReference tvmet::Matrix< T, NRows, NCols >::const_ref | ( | ) | const [inline] |
Return a const Reference of the internal data.
ConstReference tvmet::Matrix< T, NRows, NCols >::const_sliceref | ( | ) | const [inline] |
Return a sliced const Reference of the internal data.
XprMatrix<ConstReference, Rows, Cols> tvmet::Matrix< T, NRows, NCols >::as_expr | ( | ) | const [inline] |
Return the vector as const expression.
static void tvmet::Matrix< T, NRows, NCols >::do_assign | ( | dispatch< true > | , | |
Dest & | dest, | |||
const Src & | src, | |||
const Assign & | assign_fn | |||
) | [inline, static, private] |
Wrapper for meta assign.
static void tvmet::Matrix< T, NRows, NCols >::do_assign | ( | dispatch< false > | , | |
Dest & | dest, | |||
const Src & | src, | |||
const Assign & | assign_fn | |||
) | [inline, static, private] |
Wrapper for loop assign.
void tvmet::Matrix< T, NRows, NCols >::assign_to | ( | Matrix< T2, Rows, Cols > & | dest, | |
const Assign & | assign_fn | |||
) | const [inline, private] |
assign this to a matrix of a different type T2 using the functional assign_fn.
Matrix& tvmet::Matrix< T, NRows, NCols >::operator= | ( | const Matrix< T2, Rows, Cols > & | rhs | ) | [inline] |
assign a given matrix of a different type T2 element wise to this matrix.
The operator=(const Matrix&) is compiler generated.
Matrix& tvmet::Matrix< T, NRows, NCols >::operator= | ( | const XprMatrix< E, Rows, Cols > & | rhs | ) | [inline] |
assign a given XprMatrix element wise to this matrix.
Matrix& tvmet::Matrix< T, NRows, NCols >::assign_value | ( | value_type | rhs | ) | [inline, private] |
This is a helper for assigning a comma separated initializer list.
It's equal to Matrix& operator=(value_type) which does replace it.
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator+= | ( | value_type | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator-= | ( | value_type | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator *= | ( | value_type | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator/= | ( | value_type | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator%= | ( | std::size_t | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator^= | ( | std::size_t | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator &= | ( | std::size_t | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator|= | ( | std::size_t | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator<<= | ( | std::size_t | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::operator>>= | ( | std::size_t | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_add_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_sub_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_mul_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_div_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_mod_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_xor_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_and_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_or_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_shl_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::M_shr_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_add_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_sub_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_mul_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_div_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_mod_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_xor_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_and_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_or_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_shl_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::M_shr_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::alias_assign | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::alias_add_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::alias_sub_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::alias_mul_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T1, NRows, NCols > & tvmet::Matrix< T1, NRows, NCols >::alias_div_eq | ( | const Matrix< T2, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::alias_assign | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::alias_add_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::alias_sub_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::alias_mul_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
Matrix< T, NRows, NCols > & tvmet::Matrix< T, NRows, NCols >::alias_div_eq | ( | const XprMatrix< E, Rows, Cols > & | ) | [inline] |
static Info tvmet::Matrix< T, NRows, NCols >::info | ( | ) | [inline, static] |
Get an info object of this matrix.
std::ostream & tvmet::Matrix< T, NRows, NCols >::print_xpr | ( | std::ostream & | os, | |
std::size_t | l = 0 | |||
) | const [inline] |
Member function for expression level printing.
std::ostream & tvmet::Matrix< T, NRows, NCols >::print_on | ( | std::ostream & | os | ) | const [inline] |
Member function for printing internal data.
friend class CommaInitializer [friend] |
value_type tvmet::Matrix< T, NRows, NCols >::m_data[Size] [private] |
The data of matrix self.
Author: |