cgv
|
A diagonal matrix type which internally stores the elements on the main diagonal in a vector. More...
#include <diag_mat.h>
Public Types | |
typedef vec< T >::value_type | value_type |
typedef vec< T >::reference | reference |
typedef vec< T >::const_reference | const_reference |
typedef vec< T >::pointer | pointer |
typedef vec< T >::const_pointer | const_pointer |
typedef vec< T >::iterator | iterator |
typedef vec< T >::const_iterator | const_iterator |
typedef vec< T >::reverse_iterator | reverse_iterator |
typedef vec< T >::const_reverse_iterator | const_reverse_iterator |
typedef iterator | diag_iterator |
typedef const diag_iterator | const_diag_iterator |
typedef std::reverse_iterator< diag_iterator > | reverse_diag_iterator |
typedef std::reverse_iterator< const_diag_iterator > | const_reverse_diag_iterator |
Public Member Functions | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
diag_iterator | diag_begin () |
diag_iterator | diag_end () |
const_diag_iterator | diag_begin () const |
const_diag_iterator | diag_end () const |
reverse_diag_iterator | diag_rbegin () |
reverse_diag_iterator | diag_rend () |
const_reverse_diag_iterator | diag_rbegin () const |
const_reverse_diag_iterator | diag_rend () const |
unsigned | size () const |
size of storage | |
unsigned | nrows () const |
number of rows | |
unsigned | ncols () const |
number of columns | |
diag_mat () | |
standard constructor | |
diag_mat (unsigned n) | |
creates nxn diagonal matrix | |
diag_mat (unsigned n, const T &c) | |
creates nxn diagonal matrix and set all diagonal elements to c | |
diag_mat (unsigned n, const T *marray) | |
diag_mat (const vec< T > &dv) | |
creates a diagonal matrix and set the diagonal vector to dv | |
diag_mat (const mat< T > &m) | |
creates a diagonal matrix and set the diagonal vector to diagonal entries of m | |
diag_mat (const diag_mat< T > &m) | |
copy constructor | |
virtual | ~diag_mat () |
destructor | |
T * | data () |
cast into array of element type | |
const T * | data () const |
cast into array of const element type | |
diag_mat< T > | sub_mat (unsigned top_left, unsigned size) const |
create sub diagonal matrix d(top_left)...d(top_left+size) | |
operator const mat< T > () const | |
cast into const full storage matrix | |
void | resize (unsigned n) |
void | identity () |
set diagonal matrix to identity | |
void | fill (const T &c) |
fills all diagonal entries with c | |
void | zeros () |
fills all diagonal entries with zero | |
void | exchange_diagonal_elements (unsigned i, unsigned j) |
exchange diagonal elements i and j | |
const T & | operator() (unsigned i) const |
const access to the ith diagonal element | |
T & | operator() (unsigned i) |
non const access to the ith diagonal element | |
const T & | operator[] (unsigned i) const |
const access to the ith diagonal element | |
T & | operator[] (unsigned i) |
non const access to the ith diagonal element | |
bool | is_square () |
returns true because diagonal matrices are always square | |
void | transpose () |
diag_mat< T > & | operator= (const diag_mat< T > &m) |
assignment of a matrix with the same element type | |
template<typename S > | |
diag_mat< T > & | operator= (const diag_mat< S > &m) |
assignment of a matrix with a different element type | |
template<typename S > | |
diag_mat< T > & | operator= (const vec< S > &v) |
assignment of a vector with a vector to set the diagonal | |
diag_mat< T > & | operator= (const T &s) |
assignment of a scalar s to each element of the matrix | |
T | frobenius_norm () const |
returns the frobenius norm of matrix m | |
void | identity (unsigned dim) |
set dim x dim identity matrix | |
void | zero () |
set zero matrix | |
diag_mat< T > & | operator+= (const diag_mat< T > &d) |
in place addition of diagonal matrix | |
diag_mat< T > & | operator-= (const diag_mat< T > &d) |
in place subtraction of diagonal matrix | |
diag_mat< T > & | operator*= (const T &s) |
in place multiplication with scalar s | |
diag_mat< T > | operator* (const T &s) const |
multiplication with scalar s | |
diag_mat< T > | operator+ (const diag_mat< T > &d) const |
addition of diagonal matrix | |
diag_mat< T > | operator- (const diag_mat< T > &d) const |
subtraction of diagonal matrix | |
vec< T > | operator* (const vec< T > &v) const |
multiplication with vector | |
const up_tri_mat< T > | operator* (const up_tri_mat< T > &m) |
matrix multiplication of matrix m by a diagonal matrix s | |
operator mat< T > () | |
cast into full matrix type | |
Public Attributes | |
vec< T > | _data |
pointer to data storage | |
A diagonal matrix type which internally stores the elements on the main diagonal in a vector.
Definition at line 15 of file diag_mat.h.
typedef const diag_iterator cgv::math::diag_mat< T >::const_diag_iterator |
Definition at line 34 of file diag_mat.h.
typedef vec<T>::const_iterator cgv::math::diag_mat< T >::const_iterator |
Definition at line 29 of file diag_mat.h.
typedef vec<T>::const_pointer cgv::math::diag_mat< T >::const_pointer |
Definition at line 26 of file diag_mat.h.
typedef vec<T>::const_reference cgv::math::diag_mat< T >::const_reference |
Definition at line 24 of file diag_mat.h.
typedef std::reverse_iterator<const_diag_iterator> cgv::math::diag_mat< T >::const_reverse_diag_iterator |
Definition at line 36 of file diag_mat.h.
typedef vec<T>::const_reverse_iterator cgv::math::diag_mat< T >::const_reverse_iterator |
Definition at line 31 of file diag_mat.h.
typedef iterator cgv::math::diag_mat< T >::diag_iterator |
Definition at line 33 of file diag_mat.h.
typedef vec<T>::iterator cgv::math::diag_mat< T >::iterator |
Definition at line 28 of file diag_mat.h.
typedef vec<T>::pointer cgv::math::diag_mat< T >::pointer |
Definition at line 25 of file diag_mat.h.
typedef vec<T>::reference cgv::math::diag_mat< T >::reference |
Definition at line 23 of file diag_mat.h.
typedef std::reverse_iterator<diag_iterator> cgv::math::diag_mat< T >::reverse_diag_iterator |
Definition at line 35 of file diag_mat.h.
typedef vec<T>::reverse_iterator cgv::math::diag_mat< T >::reverse_iterator |
Definition at line 30 of file diag_mat.h.
typedef vec<T>::value_type cgv::math::diag_mat< T >::value_type |
Definition at line 22 of file diag_mat.h.
|
inline |
standard constructor
Definition at line 75 of file diag_mat.h.
|
inlineexplicit |
creates nxn diagonal matrix
Definition at line 80 of file diag_mat.h.
|
inline |
creates nxn diagonal matrix and set all diagonal elements to c
Definition at line 85 of file diag_mat.h.
References cgv::math::diag_mat< T >::fill().
|
inline |
Definition at line 92 of file diag_mat.h.
|
inline |
creates a diagonal matrix and set the diagonal vector to dv
Definition at line 97 of file diag_mat.h.
|
inline |
creates a diagonal matrix and set the diagonal vector to diagonal entries of m
Definition at line 102 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, cgv::math::mat< T >::ncols(), and cgv::math::mat< T >::nrows().
|
inline |
copy constructor
Definition at line 111 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inlinevirtual |
destructor
Definition at line 119 of file diag_mat.h.
|
inline |
Definition at line 38 of file diag_mat.h.
|
inline |
Definition at line 40 of file diag_mat.h.
|
inline |
cast into array of element type
Definition at line 124 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
cast into array of const element type
Definition at line 130 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
Definition at line 47 of file diag_mat.h.
|
inline |
Definition at line 49 of file diag_mat.h.
|
inline |
Definition at line 48 of file diag_mat.h.
|
inline |
Definition at line 50 of file diag_mat.h.
|
inline |
Definition at line 51 of file diag_mat.h.
|
inline |
Definition at line 53 of file diag_mat.h.
|
inline |
Definition at line 52 of file diag_mat.h.
|
inline |
Definition at line 54 of file diag_mat.h.
|
inline |
Definition at line 39 of file diag_mat.h.
|
inline |
Definition at line 41 of file diag_mat.h.
|
inline |
exchange diagonal elements i and j
Definition at line 183 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
fills all diagonal entries with c
Definition at line 169 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::size().
Referenced by cgv::math::diag_mat< T >::diag_mat(), cgv::math::diag_mat< T >::identity(), cgv::math::diag_mat< T >::operator=(), cgv::math::diag_mat< T >::zero(), and cgv::math::diag_mat< T >::zeros().
|
inline |
returns the frobenius norm of matrix m
Definition at line 256 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::size().
|
inline |
set diagonal matrix to identity
Definition at line 163 of file diag_mat.h.
References cgv::math::diag_mat< T >::fill().
|
inline |
set dim x dim identity matrix
Definition at line 269 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::size().
|
inline |
returns true because diagonal matrices are always square
Definition at line 214 of file diag_mat.h.
|
inline |
number of columns
Definition at line 69 of file diag_mat.h.
References cgv::math::diag_mat< T >::size().
Referenced by cgv::math::diag_mat< T >::operator*().
|
inline |
number of rows
Definition at line 63 of file diag_mat.h.
References cgv::math::diag_mat< T >::size().
Referenced by cgv::math::diag_mat< T >::operator+=(), cgv::math::diag_mat< T >::operator-=(), cgv::math::random::uniform(), cgv::math::random::uniform(), cgv::math::random::uniform(), and cgv::math::random::uniform().
|
inline |
cast into const full storage matrix
Definition at line 144 of file diag_mat.h.
|
inline |
cast into full matrix type
Definition at line 356 of file diag_mat.h.
|
inline |
non const access to the ith diagonal element
Definition at line 195 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
const access to the ith diagonal element
Definition at line 189 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
Referenced by cgv::math::diag_mat< std::complex< T > >::operator const mat< std::complex< T > >(), and cgv::math::diag_mat< T >::operator*().
|
inline |
multiplication with scalar s
Definition at line 306 of file diag_mat.h.
|
inline |
matrix multiplication of matrix m by a diagonal matrix s
Definition at line 342 of file diag_mat.h.
References cgv::math::diag_mat< T >::operator()(), and cgv::math::diag_mat< T >::size().
|
inline |
multiplication with vector
Definition at line 332 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, cgv::math::vec< T >::dim(), cgv::math::diag_mat< T >::ncols(), and cgv::math::diag_mat< T >::size().
|
inline |
in place multiplication with scalar s
Definition at line 299 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
addition of diagonal matrix
Definition at line 314 of file diag_mat.h.
|
inline |
in place addition of diagonal matrix
Definition at line 283 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::nrows().
|
inline |
subtraction of diagonal matrix
Definition at line 322 of file diag_mat.h.
|
inline |
in place subtraction of diagonal matrix
Definition at line 291 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::nrows().
|
inline |
assignment of a matrix with a different element type
Definition at line 232 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data, and cgv::math::diag_mat< T >::size().
|
inline |
assignment of a matrix with the same element type
Definition at line 224 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
assignment of a scalar s to each element of the matrix
Definition at line 250 of file diag_mat.h.
References cgv::math::diag_mat< T >::fill().
|
inline |
assignment of a vector with a vector to set the diagonal
Definition at line 243 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
non const access to the ith diagonal element
Definition at line 207 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
const access to the ith diagonal element
Definition at line 201 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
|
inline |
Definition at line 42 of file diag_mat.h.
|
inline |
Definition at line 44 of file diag_mat.h.
|
inline |
Definition at line 43 of file diag_mat.h.
|
inline |
Definition at line 45 of file diag_mat.h.
|
inline |
Definition at line 157 of file diag_mat.h.
|
inline |
size of storage
Definition at line 57 of file diag_mat.h.
References cgv::math::diag_mat< T >::_data.
Referenced by cgv::math::diag_mat< T >::fill(), cgv::math::diag_mat< T >::frobenius_norm(), cgv::math::diag_mat< T >::identity(), cgv::math::diag_mat< T >::ncols(), cgv::math::diag_mat< T >::nrows(), cgv::math::diag_mat< std::complex< T > >::operator const mat< std::complex< T > >(), cgv::math::diag_mat< std::complex< T > >::operator mat< std::complex< T > >(), cgv::math::diag_mat< T >::operator*(), cgv::math::diag_mat< T >::operator*(), cgv::math::diag_mat< T >::operator=(), and cgv::math::diag_mat< T >::sub_mat().
|
inline |
create sub diagonal matrix d(top_left)...d(top_left+size)
Definition at line 136 of file diag_mat.h.
References cgv::math::diag_mat< T >::size().
|
inline |
Definition at line 220 of file diag_mat.h.
|
inline |
set zero matrix
Definition at line 277 of file diag_mat.h.
References cgv::math::diag_mat< T >::fill().
|
inline |
fills all diagonal entries with zero
Definition at line 177 of file diag_mat.h.
References cgv::math::diag_mat< T >::fill().
vec<T> cgv::math::diag_mat< T >::_data |
pointer to data storage
Definition at line 20 of file diag_mat.h.
Referenced by cgv::math::diag_mat< T >::data(), cgv::math::diag_mat< T >::data(), cgv::math::diag_mat< T >::diag_mat(), cgv::math::diag_mat< T >::diag_mat(), cgv::math::diag_mat< T >::exchange_diagonal_elements(), cgv::math::diag_mat< T >::fill(), cgv::math::diag_mat< T >::frobenius_norm(), cgv::math::diag_mat< T >::identity(), cgv::math::diag_mat< std::complex< T > >::operator mat< std::complex< T > >(), cgv::math::diag_mat< T >::operator()(), cgv::math::diag_mat< T >::operator()(), cgv::math::diag_mat< T >::operator*(), cgv::math::diag_mat< T >::operator*=(), cgv::math::diag_mat< T >::operator+=(), cgv::math::diag_mat< T >::operator-=(), cgv::math::diag_mat< T >::operator=(), cgv::math::diag_mat< T >::operator=(), cgv::math::diag_mat< T >::operator=(), cgv::math::diag_mat< T >::operator[](), cgv::math::diag_mat< T >::operator[](), and cgv::math::diag_mat< T >::size().