cgv
Loading...
Searching...
No Matches
cgv::math::mat< T > Class Template Reference

A matrix type (full column major storage) The matrix can be loaded directly into OpenGL without need for transposing! More...

#include <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 col_iterator
 
typedef const col_iterator const_col_iterator
 
typedef std::reverse_iterator< col_iterator > reverse_col_iterator
 
typedef std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
 
typedef step_iterator< iterator > row_iterator
 
typedef const row_iterator const_row_iterator
 
typedef std::reverse_iterator< row_iteratorreverse_row_iterator
 
typedef std::reverse_iterator< const_row_iteratorconst_reverse_row_iterator
 
typedef step_iterator< iterator > diag_iterator
 
typedef const diag_iterator const_diag_iterator
 
typedef std::reverse_iterator< diag_iteratorreverse_diag_iterator
 
typedef std::reverse_iterator< const_diag_iteratorconst_reverse_diag_iterator
 
typedef step_iterator< iterator > anti_diag_iterator
 
typedef const anti_diag_iterator const_anti_diag_iterator
 
typedef std::reverse_iterator< anti_diag_iteratorreverse_anti_diag_iterator
 
typedef std::reverse_iterator< const_anti_diag_iteratorconst_reverse_anti_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
 
col_iterator col_begin (int c)
 
col_iterator col_end (int c)
 
const_col_iterator col_begin (int c) const
 
const_col_iterator col_end (int c) const
 
reverse_col_iterator col_rbegin (int c)
 
reverse_col_iterator col_rend (int c)
 
const_reverse_col_iterator col_rbegin (int c) const
 
const_reverse_col_iterator col_rend (int c) const
 
row_iterator row_begin (int r)
 
row_iterator row_end (int r)
 
const_row_iterator row_begin (int r) const
 
const_row_iterator row_end (int r) const
 
reverse_row_iterator row_rbegin (int r)
 
reverse_row_iterator row_rend (int r)
 
const_reverse_row_iterator row_rbegin (int r) const
 
const_reverse_row_iterator row_rend (int r) const
 
diag_iterator diag_begin (int d=0)
 
diag_iterator diag_end (int d=0)
 
const_diag_iterator diag_begin (int d=0) const
 
const_diag_iterator diag_end (int d=0) const
 
reverse_diag_iterator diag_rbegin (int d=0)
 
reverse_diag_iterator diag_rend (int d=0)
 
const_reverse_diag_iterator diag_rbegin (int d=0) const
 
const_reverse_diag_iterator diag_rend (int d=0) const
 
anti_diag_iterator anti_diag_begin (int d=0)
 
anti_diag_iterator anti_diag_end (int d=0)
 
const_anti_diag_iterator anti_diag_begin (int d=0) const
 
const_anti_diag_iterator anti_diag_end (int d=0) const
 
reverse_anti_diag_iterator anti_diag_rbegin (int d=0)
 
reverse_anti_diag_iterator anti_diag_rend (int d=0)
 
const_reverse_anti_diag_iterator anti_diag_rbegin (int d=0) const
 
const_reverse_anti_diag_iterator anti_diag_rend (int d=0) const
 
 mat ()
 standard constructor
 
 mat (unsigned nrows, unsigned ncols)
 constructor creates a nrows x ncols full matrix
 
 mat (unsigned nrows, unsigned ncols, const T &c)
 construct a matrix with all elements set to c
 
 mat (unsigned nrows, unsigned ncols, const T *marray, bool column_major=true)
 creates a matrix from an array if the matrix data is stored in a row major fashion set column_major to false
 
template<typename S >
 mat (const mat< S > &m)
 copy constructor for matrix with different element type
 
void set_extern_data (unsigned nrows, unsigned ncols, T *data)
 set data pointer to an external data array
 
void destruct ()
 
unsigned size () const
 number of stored elements
 
unsigned nrows () const
 number of rows
 
unsigned ncols () const
 number of columns
 
template<typename S >
mat< T > & operator= (const mat< S > &m)
 assignment of a matrix with a different element type
 
mat< T > & operator= (const T &s)
 assignment of a scalar s to each element of the matrix
 
void resize (unsigned rows, unsigned cols)
 resize the matrix, the content of the matrix will be destroyed
 
 operator T* ()
 cast operator for non const array
 
 operator const T * () const
 cast operator const array
 
bool is_square () const
 returns true if matrix is a square matrix
 
template<typename S >
void fill (const S &v)
 fills all elements of the matrix with v
 
T & operator() (unsigned i, unsigned j)
 access to the element in the ith row in column j
 
const T & operator() (unsigned i, unsigned j) const
 const access to the element in the ith row on column j
 
template<typename S >
bool operator== (const mat< S > &m) const
 test for equality
 
template<typename S >
bool operator!= (const mat< S > &m) const
 test for inequality
 
mat< T > & operator*= (const T &s)
 
const mat< T > operator* (const T &s) const
 scalar multiplication

 
mat< T > & operator/= (const T &s)
 in place division by a scalar
 
const mat< T > operator/ (const T &s) const
 division by a scalar
 
mat< T > & operator+= (const T &s)
 in place addition by a scalar
 
const mat< T > operator+ (const T &s)
 componentwise addition of a scalar
 
mat< T > & operator-= (const T &s)
 in place substraction of a scalar
 
const mat< T > operator- (const T &s)
 componentwise subtraction of a scalar
 
const mat< T > operator- () const
 negation operator
 
template<typename S >
mat< T > & operator+= (const mat< S > &m)
 in place addition of matrix
 
template<typename S >
mat< T > & operator-= (const mat< S > &m)
 in place subtraction of matrix
 
template<typename S >
const mat< T > operator+ (const mat< S > m2) const
 matrix addition
 
template<typename S >
const mat< T > operator- (const mat< S > m2) const
 matrix subtraction
 
template<typename S >
const mat< T > operator*= (const mat< S > &m2)
 in place matrix multiplication with a ncols x ncols matrix m2
 
template<typename S >
const mat< T > operator* (const mat< S > &m2) const
 multiplication with a ncols x M matrix m2
 
template<typename S >
const vec< T > operator* (const vec< S > &v) const
 matrix vector multiplication
 
mat< T > sub_mat (unsigned top, unsigned left, unsigned rows, unsigned cols) const
 create submatrix m(top,left)...m(top+rows,left+cols)
 
const vec< T > row (unsigned i) const
 extract a row from the matrix as a vector
 
void set_row (unsigned i, const vec< T > &v)
 set row i of the matrix to vector v
 
const vec< T > col (unsigned j) const
 extract a column of the matrix as a vector
 
void set_col (unsigned j, const vec< T > &v)
 set column j of the matrix to vector v
 
void copy (unsigned top, unsigned left, unsigned rows, unsigned cols, mat< T > &submat) const
 copy submatrix m(top,left)...m(top+rows,left+cols) into submat
 
void paste (int top, int left, const mat< T > &m)
 paste matrix m at position: top, left
 
void swap_rows (unsigned i, unsigned j)
 exchange row i with row j
 
void swap_columns (unsigned i, unsigned j)
 exchange column i with column j
 
void swap_diagonal_elements (unsigned i, unsigned j)
 exchange diagonal elements (i,i) (j,j)
 
trace () const
 returns the trace
 
maxcoeff () const
 
mincoeff () const
 
void transpose ()
 transpose matrix
 
void fliplr ()
 
void flipud ()
 
void ceil ()
 ceil all components of the matrix
 
void floor ()
 floor all components of the matrix
 
void round ()
 round to integer
 
frobenius_norm () const
 returns the frobenius norm of matrix m
 
void identity ()
 set identity matrix
 
void identity (unsigned dim)
 set dim x dim identity matrix
 
void zeros ()
 set zero matrix
 
void zeros (unsigned rows, unsigned cols)
 resize and fill matrix with zeros
 
void ones (unsigned rows, unsigned cols)
 resize and fill matrix with ones
 

Protected Attributes

vec< T > _data
 pointer to data storage
 
unsigned _ncols
 number of columns
 
unsigned _nrows
 number of rows
 

Detailed Description

template<typename T>
class cgv::math::mat< T >

A matrix type (full column major storage) The matrix can be loaded directly into OpenGL without need for transposing!

Definition at line 207 of file mat.h.

Member Typedef Documentation

◆ anti_diag_iterator

template<typename T >
typedef step_iterator<iterator > cgv::math::mat< T >::anti_diag_iterator

Definition at line 244 of file mat.h.

◆ col_iterator

template<typename T >
typedef iterator cgv::math::mat< T >::col_iterator

Definition at line 229 of file mat.h.

◆ const_anti_diag_iterator

template<typename T >
typedef const anti_diag_iterator cgv::math::mat< T >::const_anti_diag_iterator

Definition at line 245 of file mat.h.

◆ const_col_iterator

template<typename T >
typedef const col_iterator cgv::math::mat< T >::const_col_iterator

Definition at line 230 of file mat.h.

◆ const_diag_iterator

template<typename T >
typedef const diag_iterator cgv::math::mat< T >::const_diag_iterator

Definition at line 240 of file mat.h.

◆ const_iterator

template<typename T >
typedef vec<T>::const_iterator cgv::math::mat< T >::const_iterator

Definition at line 225 of file mat.h.

◆ const_pointer

template<typename T >
typedef vec<T>::const_pointer cgv::math::mat< T >::const_pointer

Definition at line 223 of file mat.h.

◆ const_reference

template<typename T >
typedef vec<T>::const_reference cgv::math::mat< T >::const_reference

Definition at line 221 of file mat.h.

◆ const_reverse_anti_diag_iterator

template<typename T >
typedef std::reverse_iterator<const_anti_diag_iterator> cgv::math::mat< T >::const_reverse_anti_diag_iterator

Definition at line 247 of file mat.h.

◆ const_reverse_col_iterator

template<typename T >
typedef std::reverse_iterator<const_col_iterator> cgv::math::mat< T >::const_reverse_col_iterator

Definition at line 232 of file mat.h.

◆ const_reverse_diag_iterator

template<typename T >
typedef std::reverse_iterator<const_diag_iterator> cgv::math::mat< T >::const_reverse_diag_iterator

Definition at line 242 of file mat.h.

◆ const_reverse_iterator

template<typename T >
typedef vec<T>::const_reverse_iterator cgv::math::mat< T >::const_reverse_iterator

Definition at line 227 of file mat.h.

◆ const_reverse_row_iterator

template<typename T >
typedef std::reverse_iterator<const_row_iterator> cgv::math::mat< T >::const_reverse_row_iterator

Definition at line 237 of file mat.h.

◆ const_row_iterator

template<typename T >
typedef const row_iterator cgv::math::mat< T >::const_row_iterator

Definition at line 235 of file mat.h.

◆ diag_iterator

template<typename T >
typedef step_iterator<iterator > cgv::math::mat< T >::diag_iterator

Definition at line 239 of file mat.h.

◆ iterator

template<typename T >
typedef vec<T>::iterator cgv::math::mat< T >::iterator

Definition at line 224 of file mat.h.

◆ pointer

template<typename T >
typedef vec<T>::pointer cgv::math::mat< T >::pointer

Definition at line 222 of file mat.h.

◆ reference

template<typename T >
typedef vec<T>::reference cgv::math::mat< T >::reference

Definition at line 220 of file mat.h.

◆ reverse_anti_diag_iterator

template<typename T >
typedef std::reverse_iterator<anti_diag_iterator> cgv::math::mat< T >::reverse_anti_diag_iterator

Definition at line 246 of file mat.h.

◆ reverse_col_iterator

template<typename T >
typedef std::reverse_iterator<col_iterator> cgv::math::mat< T >::reverse_col_iterator

Definition at line 231 of file mat.h.

◆ reverse_diag_iterator

template<typename T >
typedef std::reverse_iterator<diag_iterator> cgv::math::mat< T >::reverse_diag_iterator

Definition at line 241 of file mat.h.

◆ reverse_iterator

template<typename T >
typedef vec<T>::reverse_iterator cgv::math::mat< T >::reverse_iterator

Definition at line 226 of file mat.h.

◆ reverse_row_iterator

template<typename T >
typedef std::reverse_iterator<row_iterator> cgv::math::mat< T >::reverse_row_iterator

Definition at line 236 of file mat.h.

◆ row_iterator

template<typename T >
typedef step_iterator<iterator> cgv::math::mat< T >::row_iterator

Definition at line 234 of file mat.h.

◆ value_type

template<typename T >
typedef vec<T>::value_type cgv::math::mat< T >::value_type

Definition at line 219 of file mat.h.

Constructor & Destructor Documentation

◆ mat() [1/5]

template<typename T >
cgv::math::mat< T >::mat ( )
inline

standard constructor

Definition at line 461 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ mat() [2/5]

template<typename T >
cgv::math::mat< T >::mat ( unsigned  nrows,
unsigned  ncols 
)
inline

constructor creates a nrows x ncols full matrix

Definition at line 469 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), and cgv::math::mat< T >::nrows().

◆ mat() [3/5]

template<typename T >
cgv::math::mat< T >::mat ( unsigned  nrows,
unsigned  ncols,
const T &  c 
)
inline

construct a matrix with all elements set to c

Definition at line 476 of file mat.h.

References cgv::math::mat< T >::_data, cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), and cgv::math::mat< T >::nrows().

◆ mat() [4/5]

template<typename T >
cgv::math::mat< T >::mat ( unsigned  nrows,
unsigned  ncols,
const T *  marray,
bool  column_major = true 
)
inline

creates a matrix from an array if the matrix data is stored in a row major fashion set column_major to false

Definition at line 486 of file mat.h.

References cgv::math::mat< T >::_data, cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), cgv::math::mat< T >::nrows(), cgv::math::mat< T >::operator()(), and cgv::math::mat< T >::size().

◆ mat() [5/5]

template<typename T >
template<typename S >
cgv::math::mat< T >::mat ( const mat< S > &  m)
inline

copy constructor for matrix with different element type

Definition at line 510 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), cgv::math::mat< T >::nrows(), and cgv::math::mat< T >::operator()().

Member Function Documentation

◆ anti_diag_begin() [1/2]

template<typename T >
anti_diag_iterator cgv::math::mat< T >::anti_diag_begin ( int  d = 0)
inline

Definition at line 396 of file mat.h.

◆ anti_diag_begin() [2/2]

template<typename T >
const_anti_diag_iterator cgv::math::mat< T >::anti_diag_begin ( int  d = 0) const
inline

Definition at line 418 of file mat.h.

◆ anti_diag_end() [1/2]

template<typename T >
anti_diag_iterator cgv::math::mat< T >::anti_diag_end ( int  d = 0)
inline

Definition at line 404 of file mat.h.

◆ anti_diag_end() [2/2]

template<typename T >
const_anti_diag_iterator cgv::math::mat< T >::anti_diag_end ( int  d = 0) const
inline

Definition at line 426 of file mat.h.

◆ anti_diag_rbegin() [1/2]

template<typename T >
reverse_anti_diag_iterator cgv::math::mat< T >::anti_diag_rbegin ( int  d = 0)
inline

Definition at line 440 of file mat.h.

◆ anti_diag_rbegin() [2/2]

template<typename T >
const_reverse_anti_diag_iterator cgv::math::mat< T >::anti_diag_rbegin ( int  d = 0) const
inline

Definition at line 450 of file mat.h.

◆ anti_diag_rend() [1/2]

template<typename T >
reverse_anti_diag_iterator cgv::math::mat< T >::anti_diag_rend ( int  d = 0)
inline

Definition at line 445 of file mat.h.

◆ anti_diag_rend() [2/2]

template<typename T >
const_reverse_anti_diag_iterator cgv::math::mat< T >::anti_diag_rend ( int  d = 0) const
inline

Definition at line 455 of file mat.h.

◆ begin() [1/2]

template<typename T >
iterator cgv::math::mat< T >::begin ( )
inline

Definition at line 253 of file mat.h.

◆ begin() [2/2]

template<typename T >
const_iterator cgv::math::mat< T >::begin ( ) const
inline

Definition at line 255 of file mat.h.

◆ ceil()

template<typename T >
void cgv::math::mat< T >::ceil ( )
inline

ceil all components of the matrix

Definition at line 974 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, and cgv::math::mat< T >::ceil().

Referenced by cgv::math::mat< T >::ceil().

◆ col()

◆ col_begin() [1/2]

template<typename T >
col_iterator cgv::math::mat< T >::col_begin ( int  c)
inline

Definition at line 264 of file mat.h.

◆ col_begin() [2/2]

template<typename T >
const_col_iterator cgv::math::mat< T >::col_begin ( int  c) const
inline

Definition at line 272 of file mat.h.

◆ col_end() [1/2]

template<typename T >
col_iterator cgv::math::mat< T >::col_end ( int  c)
inline

Definition at line 268 of file mat.h.

◆ col_end() [2/2]

template<typename T >
const_col_iterator cgv::math::mat< T >::col_end ( int  c) const
inline

Definition at line 276 of file mat.h.

◆ col_rbegin() [1/2]

template<typename T >
reverse_col_iterator cgv::math::mat< T >::col_rbegin ( int  c)
inline

Definition at line 280 of file mat.h.

◆ col_rbegin() [2/2]

template<typename T >
const_reverse_col_iterator cgv::math::mat< T >::col_rbegin ( int  c) const
inline

Definition at line 288 of file mat.h.

◆ col_rend() [1/2]

template<typename T >
reverse_col_iterator cgv::math::mat< T >::col_rend ( int  c)
inline

Definition at line 284 of file mat.h.

◆ col_rend() [2/2]

template<typename T >
const_reverse_col_iterator cgv::math::mat< T >::col_rend ( int  c) const
inline

Definition at line 292 of file mat.h.

◆ copy()

template<typename T >
void cgv::math::mat< T >::copy ( unsigned  top,
unsigned  left,
unsigned  rows,
unsigned  cols,
mat< T > &  submat 
) const
inline

copy submatrix m(top,left)...m(top+rows,left+cols) into submat

Definition at line 857 of file mat.h.

References cgv::math::mat< T >::ncols(), cgv::math::mat< T >::nrows(), and cgv::math::mat< T >::operator()().

◆ destruct()

template<typename T >
void cgv::math::mat< T >::destruct ( )
inline

Definition at line 529 of file mat.h.

◆ diag_begin() [1/2]

template<typename T >
diag_iterator cgv::math::mat< T >::diag_begin ( int  d = 0)
inline

Definition at line 337 of file mat.h.

◆ diag_begin() [2/2]

template<typename T >
const_diag_iterator cgv::math::mat< T >::diag_begin ( int  d = 0) const
inline

Definition at line 358 of file mat.h.

◆ diag_end() [1/2]

template<typename T >
diag_iterator cgv::math::mat< T >::diag_end ( int  d = 0)
inline

Definition at line 345 of file mat.h.

◆ diag_end() [2/2]

template<typename T >
const_diag_iterator cgv::math::mat< T >::diag_end ( int  d = 0) const
inline

Definition at line 366 of file mat.h.

◆ diag_rbegin() [1/2]

template<typename T >
reverse_diag_iterator cgv::math::mat< T >::diag_rbegin ( int  d = 0)
inline

Definition at line 379 of file mat.h.

◆ diag_rbegin() [2/2]

template<typename T >
const_reverse_diag_iterator cgv::math::mat< T >::diag_rbegin ( int  d = 0) const
inline

Definition at line 387 of file mat.h.

◆ diag_rend() [1/2]

template<typename T >
reverse_diag_iterator cgv::math::mat< T >::diag_rend ( int  d = 0)
inline

Definition at line 383 of file mat.h.

◆ diag_rend() [2/2]

template<typename T >
const_reverse_diag_iterator cgv::math::mat< T >::diag_rend ( int  d = 0) const
inline

Definition at line 391 of file mat.h.

◆ end() [1/2]

template<typename T >
iterator cgv::math::mat< T >::end ( )
inline

Definition at line 254 of file mat.h.

◆ end() [2/2]

template<typename T >
const_iterator cgv::math::mat< T >::end ( ) const
inline

Definition at line 256 of file mat.h.

◆ fill()

template<typename T >
template<typename S >
void cgv::math::mat< T >::fill ( const S &  v)
inline

fills all elements of the matrix with v

Definition at line 603 of file mat.h.

References cgv::math::mat< T >::_data.

Referenced by cgv::math::mat< T >::ones(), cgv::math::mat< T >::operator=(), cgv::math::mat< T >::zeros(), and cgv::math::mat< T >::zeros().

◆ fliplr()

template<typename T >
void cgv::math::mat< T >::fliplr ( )
inline

Definition at line 948 of file mat.h.

◆ flipud()

template<typename T >
void cgv::math::mat< T >::flipud ( )
inline

Definition at line 961 of file mat.h.

◆ floor()

template<typename T >
void cgv::math::mat< T >::floor ( )
inline

floor all components of the matrix

Definition at line 982 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, and cgv::math::mat< T >::floor().

Referenced by cgv::math::mat< T >::floor(), and cgv::math::mat< T >::round().

◆ frobenius_norm()

template<typename T >
T cgv::math::mat< T >::frobenius_norm ( ) const
inline

returns the frobenius norm of matrix m

Definition at line 1001 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ identity() [1/2]

template<typename T >
void cgv::math::mat< T >::identity ( )
inline

set identity matrix

Definition at line 1013 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, and cgv::math::mat< T >::zeros().

◆ identity() [2/2]

template<typename T >
void cgv::math::mat< T >::identity ( unsigned  dim)
inline

set dim x dim identity matrix

Definition at line 1022 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::zeros().

◆ is_square()

template<typename T >
bool cgv::math::mat< T >::is_square ( ) const
inline

returns true if matrix is a square matrix

Definition at line 596 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ maxcoeff()

template<typename T >
T cgv::math::mat< T >::maxcoeff ( ) const
inline

Definition at line 915 of file mat.h.

◆ mincoeff()

template<typename T >
T cgv::math::mat< T >::mincoeff ( ) const
inline

Definition at line 925 of file mat.h.

◆ ncols()

◆ nrows()

◆ ones()

template<typename T >
void cgv::math::mat< T >::ones ( unsigned  rows,
unsigned  cols 
)
inline

resize and fill matrix with ones

Definition at line 1043 of file mat.h.

References cgv::math::mat< T >::fill(), and cgv::math::mat< T >::resize().

◆ operator const T *()

template<typename T >
cgv::math::mat< T >::operator const T * ( ) const
inline

cast operator const array

Definition at line 590 of file mat.h.

References cgv::math::mat< T >::_data.

◆ operator T*()

template<typename T >
cgv::math::mat< T >::operator T* ( )
inline

cast operator for non const array

Definition at line 584 of file mat.h.

References cgv::math::mat< T >::_data.

◆ operator!=()

template<typename T >
template<typename S >
bool cgv::math::mat< T >::operator!= ( const mat< S > &  m) const
inline

◆ operator()() [1/2]

◆ operator()() [2/2]

template<typename T >
const T & cgv::math::mat< T >::operator() ( unsigned  i,
unsigned  j 
) const
inline

const access to the element in the ith row on column j

Definition at line 614 of file mat.h.

References cgv::math::mat< T >::_data, cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ operator*() [1/3]

template<typename T >
template<typename S >
const mat< T > cgv::math::mat< T >::operator* ( const mat< S > &  m2) const
inline

◆ operator*() [2/3]

template<typename T >
const mat< T > cgv::math::mat< T >::operator* ( const T &  s) const
inline

scalar multiplication

Definition at line 647 of file mat.h.

◆ operator*() [3/3]

template<typename T >
template<typename S >
const vec< T > cgv::math::mat< T >::operator* ( const vec< S > &  v) const
inline

◆ operator*=() [1/2]

template<typename T >
template<typename S >
const mat< T > cgv::math::mat< T >::operator*= ( const mat< S > &  m2)
inline

in place matrix multiplication with a ncols x ncols matrix m2

Definition at line 749 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), cgv::math::mat< T >::nrows(), and cgv::math::mat< T >::operator()().

◆ operator*=() [2/2]

template<typename T >
mat< T > & cgv::math::mat< T >::operator*= ( const T &  s)
inline

Definition at line 640 of file mat.h.

◆ operator+() [1/2]

template<typename T >
template<typename S >
const mat< T > cgv::math::mat< T >::operator+ ( const mat< S >  m2) const
inline

matrix addition

Definition at line 730 of file mat.h.

◆ operator+() [2/2]

template<typename T >
const mat< T > cgv::math::mat< T >::operator+ ( const T &  s)
inline

componentwise addition of a scalar

Definition at line 678 of file mat.h.

◆ operator+=() [1/2]

template<typename T >
template<typename S >
mat< T > & cgv::math::mat< T >::operator+= ( const mat< S > &  m)
inline

◆ operator+=() [2/2]

template<typename T >
mat< T > & cgv::math::mat< T >::operator+= ( const T &  s)
inline

in place addition by a scalar

Definition at line 671 of file mat.h.

References cgv::math::mat< T >::_data.

◆ operator-() [1/3]

template<typename T >
const mat< T > cgv::math::mat< T >::operator- ( ) const
inline

negation operator

Definition at line 701 of file mat.h.

◆ operator-() [2/3]

template<typename T >
template<typename S >
const mat< T > cgv::math::mat< T >::operator- ( const mat< S >  m2) const
inline

matrix subtraction

Definition at line 739 of file mat.h.

◆ operator-() [3/3]

template<typename T >
const mat< T > cgv::math::mat< T >::operator- ( const T &  s)
inline

componentwise subtraction of a scalar

Definition at line 693 of file mat.h.

◆ operator-=() [1/2]

template<typename T >
template<typename S >
mat< T > & cgv::math::mat< T >::operator-= ( const mat< S > &  m)
inline

◆ operator-=() [2/2]

template<typename T >
mat< T > & cgv::math::mat< T >::operator-= ( const T &  s)
inline

in place substraction of a scalar

Definition at line 686 of file mat.h.

References cgv::math::mat< T >::_data.

◆ operator/()

template<typename T >
const mat< T > cgv::math::mat< T >::operator/ ( const T &  s) const
inline

division by a scalar

Definition at line 662 of file mat.h.

◆ operator/=()

template<typename T >
mat< T > & cgv::math::mat< T >::operator/= ( const T &  s)
inline

in place division by a scalar

Definition at line 655 of file mat.h.

References cgv::math::mat< T >::_data.

◆ operator=() [1/2]

template<typename T >
template<typename S >
mat< T > & cgv::math::mat< T >::operator= ( const mat< S > &  m)
inline

◆ operator=() [2/2]

template<typename T >
mat< T > & cgv::math::mat< T >::operator= ( const T &  s)
inline

assignment of a scalar s to each element of the matrix

Definition at line 567 of file mat.h.

References cgv::math::mat< T >::fill().

◆ operator==()

template<typename T >
template<typename S >
bool cgv::math::mat< T >::operator== ( const mat< S > &  m) const
inline

◆ paste()

template<typename T >
void cgv::math::mat< T >::paste ( int  top,
int  left,
const mat< T > &  m 
)
inline

paste matrix m at position: top, left

Definition at line 869 of file mat.h.

References cgv::math::mat< T >::ncols(), and cgv::math::mat< T >::nrows().

◆ rbegin() [1/2]

template<typename T >
reverse_iterator cgv::math::mat< T >::rbegin ( )
inline

Definition at line 257 of file mat.h.

◆ rbegin() [2/2]

template<typename T >
const_reverse_iterator cgv::math::mat< T >::rbegin ( ) const
inline

Definition at line 259 of file mat.h.

◆ rend() [1/2]

template<typename T >
reverse_iterator cgv::math::mat< T >::rend ( )
inline

Definition at line 258 of file mat.h.

◆ rend() [2/2]

template<typename T >
const_reverse_iterator cgv::math::mat< T >::rend ( ) const
inline

Definition at line 260 of file mat.h.

◆ resize()

template<typename T >
void cgv::math::mat< T >::resize ( unsigned  rows,
unsigned  cols 
)
inline

resize the matrix, the content of the matrix will be destroyed

Definition at line 574 of file mat.h.

References cgv::math::mat< T >::_data, cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

Referenced by cgv::math::mat< T >::ones(), cgv::math::mat< T >::operator=(), and cgv::math::mat< T >::zeros().

◆ round()

template<typename T >
void cgv::math::mat< T >::round ( )
inline

round to integer

Definition at line 990 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, and cgv::math::mat< T >::floor().

◆ row()

template<typename T >
const vec< T > cgv::math::mat< T >::row ( unsigned  i) const
inline

extract a row from the matrix as a vector

Definition at line 810 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::operator()().

◆ row_begin() [1/2]

template<typename T >
row_iterator cgv::math::mat< T >::row_begin ( int  r)
inline

Definition at line 297 of file mat.h.

◆ row_begin() [2/2]

template<typename T >
const_row_iterator cgv::math::mat< T >::row_begin ( int  r) const
inline

Definition at line 305 of file mat.h.

◆ row_end() [1/2]

template<typename T >
row_iterator cgv::math::mat< T >::row_end ( int  r)
inline

Definition at line 301 of file mat.h.

◆ row_end() [2/2]

template<typename T >
const_row_iterator cgv::math::mat< T >::row_end ( int  r) const
inline

Definition at line 309 of file mat.h.

◆ row_rbegin() [1/2]

template<typename T >
reverse_row_iterator cgv::math::mat< T >::row_rbegin ( int  r)
inline

Definition at line 314 of file mat.h.

◆ row_rbegin() [2/2]

template<typename T >
const_reverse_row_iterator cgv::math::mat< T >::row_rbegin ( int  r) const
inline

Definition at line 324 of file mat.h.

◆ row_rend() [1/2]

template<typename T >
reverse_row_iterator cgv::math::mat< T >::row_rend ( int  r)
inline

Definition at line 319 of file mat.h.

◆ row_rend() [2/2]

template<typename T >
const_reverse_row_iterator cgv::math::mat< T >::row_rend ( int  r) const
inline

Definition at line 329 of file mat.h.

◆ set_col()

template<typename T >
void cgv::math::mat< T >::set_col ( unsigned  j,
const vec< T > &  v 
)
inline

set column j of the matrix to vector v

Definition at line 846 of file mat.h.

References cgv::math::mat< T >::_nrows.

Referenced by cgv::math::thin_plate_spline< T >::map_positions(), and cgv::math::thin_hyper_plate_spline< T >::map_positions().

◆ set_extern_data()

template<typename T >
void cgv::math::mat< T >::set_extern_data ( unsigned  nrows,
unsigned  ncols,
T *  data 
)
inline

set data pointer to an external data array

Definition at line 523 of file mat.h.

References cgv::math::mat< T >::_data, cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, cgv::math::mat< T >::ncols(), and cgv::math::mat< T >::nrows().

◆ set_row()

template<typename T >
void cgv::math::mat< T >::set_row ( unsigned  i,
const vec< T > &  v 
)
inline

set row i of the matrix to vector v

Definition at line 823 of file mat.h.

References cgv::math::mat< T >::_ncols.

◆ size()

template<typename T >
unsigned cgv::math::mat< T >::size ( ) const
inline

number of stored elements

Definition at line 534 of file mat.h.

References cgv::math::mat< T >::_data.

Referenced by cgv::math::mat< T >::mat().

◆ sub_mat()

template<typename T >
mat< T > cgv::math::mat< T >::sub_mat ( unsigned  top,
unsigned  left,
unsigned  rows,
unsigned  cols 
) const
inline

create submatrix m(top,left)...m(top+rows,left+cols)

Definition at line 797 of file mat.h.

References cgv::math::mat< T >::operator()().

◆ swap_columns()

template<typename T >
void cgv::math::mat< T >::swap_columns ( unsigned  i,
unsigned  j 
)
inline

exchange column i with column j

Definition at line 887 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ swap_diagonal_elements()

template<typename T >
void cgv::math::mat< T >::swap_diagonal_elements ( unsigned  i,
unsigned  j 
)
inline

exchange diagonal elements (i,i) (j,j)

Definition at line 896 of file mat.h.

References cgv::math::mat< T >::_ncols.

◆ swap_rows()

template<typename T >
void cgv::math::mat< T >::swap_rows ( unsigned  i,
unsigned  j 
)
inline

exchange row i with row j

Definition at line 879 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ trace()

template<typename T >
T cgv::math::mat< T >::trace ( ) const
inline

returns the trace

Definition at line 906 of file mat.h.

References cgv::math::mat< T >::_ncols, and cgv::math::mat< T >::_nrows.

◆ transpose()

template<typename T >
void cgv::math::mat< T >::transpose ( )
inline

transpose matrix

Definition at line 936 of file mat.h.

References cgv::math::mat< T >::_ncols, cgv::math::mat< T >::_nrows, and cgv::math::mat< T >::operator()().

Referenced by cgv::math::qem< T >::minarg().

◆ zeros() [1/2]

◆ zeros() [2/2]

template<typename T >
void cgv::math::mat< T >::zeros ( unsigned  rows,
unsigned  cols 
)
inline

resize and fill matrix with zeros

Definition at line 1036 of file mat.h.

References cgv::math::mat< T >::fill(), and cgv::math::mat< T >::resize().

Member Data Documentation

◆ _data

◆ _ncols

◆ _nrows


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