|
|
| 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) |
| |
|
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
|
| |
|
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
|
| |
|
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)
|
| |
|
T | trace () const |
| | returns the trace
|
| |
|
void | transpose () |
| | transpose matrix
|
| |
|
void | ceil () |
| | ceil all components of the matrix
|
| |
|
void | floor () |
| | floor all components of the matrix
|
| |
|
void | round () |
| | round to integer
|
| |
|
T | 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
|
| |
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!