ug4
ug::MathMatrix< N, M, T > Class Template Reference

A class for fixed size, dense matrices. More...

#include <math_matrix.h>

Public Types

typedef std::size_t size_type
 
typedef T value_type
 

Public Member Functions

void assign (const MathVector< N, value_type > &vec, const std::size_t row)
 
value_typeentry (std::size_t row, std::size_t col)
 
const value_typeentry (std::size_t row, std::size_t col) const
 
 MathMatrix ()
 
 MathMatrix (const MathMatrix &v)
 
std::size_t num_cols () const
 
std::size_t num_rows () const
 
value_typeoperator() (std::size_t row, std::size_t col)
 
const value_typeoperator() (std::size_t row, std::size_t col) const
 
value_type operator* (const MathMatrix &v) const
 Multiplies the matrix element-wise with another matrix and sums up the entries. More...
 
MathMatrixoperator*= (const value_type &val)
 Multiplies all elements of the matrix with the given value. More...
 
MathMatrixoperator+= (const MathMatrix &B)
 Adds a matrix to 'this' one: \( A_{this} \leftarrow A_{this} + B\). More...
 
MathMatrixoperator+= (const value_type &val)
 Adds the given value to all elements of the matrix. More...
 
MathMatrixoperator-= (const MathMatrix &B)
 Subtracts a matrix from 'this' one: \( A_{this} \leftarrow A_{this} - B\). More...
 
MathMatrixoperator-= (const value_type &val)
 Subtracts the given value from all elements of the matrix. More...
 
MathMatrixoperator/= (const value_type &val)
 Divides all elements of the matrix by the given value. More...
 
MathMatrixoperator= (const MathMatrix &v)
 Assigns the elements of the given matrix to this one. More...
 
MathMatrixoperator= (const value_type &val)
 Assigns the given value to all elements of the matrix. More...
 
value_typeoperator[] (std::size_t index)
 
const value_typeoperator[] (std::size_t index) const
 

Static Public Attributes

static const std::size_t ColSize = M
 
static const std::size_t RowSize = N
 

Protected Member Functions

void assign (const MathMatrix &v)
 

Protected Attributes

value_type m_data [N][M]
 

Detailed Description

template<std::size_t N, std::size_t M, typename T>
class ug::MathMatrix< N, M, T >

A class for fixed size, dense matrices.

A static memory NxM matrix

Member Typedef Documentation

◆ size_type

template<std::size_t N, std::size_t M, typename T >
typedef std::size_t ug::MathMatrix< N, M, T >::size_type

◆ value_type

template<std::size_t N, std::size_t M, typename T >
typedef T ug::MathMatrix< N, M, T >::value_type

Constructor & Destructor Documentation

◆ MathMatrix() [1/2]

template<std::size_t N, std::size_t M, typename T >
ug::MathMatrix< N, M, T >::MathMatrix ( )
inline

◆ MathMatrix() [2/2]

template<std::size_t N, std::size_t M, typename T >
ug::MathMatrix< N, M, T >::MathMatrix ( const MathMatrix< N, M, T > &  v)
inline

Member Function Documentation

◆ assign() [1/2]

template<std::size_t N, std::size_t M, typename T >
void ug::MathMatrix< N, M, T >::assign ( const MathMatrix< N, M, T > &  v)
inlineprotected

◆ assign() [2/2]

template<std::size_t N, std::size_t M, typename T >
void ug::MathMatrix< N, M, T >::assign ( const MathVector< N, value_type > &  vec,
const std::size_t  row 
)
inline

◆ entry() [1/2]

template<std::size_t N, std::size_t M, typename T >
value_type& ug::MathMatrix< N, M, T >::entry ( std::size_t  row,
std::size_t  col 
)
inline

Referenced by ug::operator<<().

◆ entry() [2/2]

template<std::size_t N, std::size_t M, typename T >
const value_type& ug::MathMatrix< N, M, T >::entry ( std::size_t  row,
std::size_t  col 
) const
inline

◆ num_cols()

template<std::size_t N, std::size_t M, typename T >
std::size_t ug::MathMatrix< N, M, T >::num_cols ( ) const
inline

◆ num_rows()

template<std::size_t N, std::size_t M, typename T >
std::size_t ug::MathMatrix< N, M, T >::num_rows ( ) const
inline

◆ operator()() [1/2]

template<std::size_t N, std::size_t M, typename T >
value_type& ug::MathMatrix< N, M, T >::operator() ( std::size_t  row,
std::size_t  col 
)
inline

◆ operator()() [2/2]

template<std::size_t N, std::size_t M, typename T >
const value_type& ug::MathMatrix< N, M, T >::operator() ( std::size_t  row,
std::size_t  col 
) const
inline

◆ operator*()

template<std::size_t N, std::size_t M, typename T >
value_type ug::MathMatrix< N, M, T >::operator* ( const MathMatrix< N, M, T > &  v) const
inline

Multiplies the matrix element-wise with another matrix and sums up the entries.

Parameters
vThe Matrix.
Returns
A scalar value of the element-wise summed up products

References ug::MathMatrix< N, M, T >::m_data.

◆ operator*=()

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator*= ( const value_type val)
inline

Multiplies all elements of the matrix with the given value.

Parameters
valThe factor.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator+=() [1/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator+= ( const MathMatrix< N, M, T > &  B)
inline

Adds a matrix to 'this' one: \( A_{this} \leftarrow A_{this} + B\).

Parameters
BThe matrix to be added.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator+=() [2/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator+= ( const value_type val)
inline

Adds the given value to all elements of the matrix.

Parameters
valThe value to be added.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator-=() [1/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator-= ( const MathMatrix< N, M, T > &  B)
inline

Subtracts a matrix from 'this' one: \( A_{this} \leftarrow A_{this} - B\).

Parameters
BThe matrix to be subtracted.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator-=() [2/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator-= ( const value_type val)
inline

Subtracts the given value from all elements of the matrix.

Parameters
valThe value to be subtracted.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator/=()

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator/= ( const value_type val)
inline

Divides all elements of the matrix by the given value.

Parameters
valThe divisor.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator=() [1/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator= ( const MathMatrix< N, M, T > &  v)
inline

Assigns the elements of the given matrix to this one.

Parameters
vThe matrix to be assigned.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::assign().

◆ operator=() [2/2]

template<std::size_t N, std::size_t M, typename T >
MathMatrix& ug::MathMatrix< N, M, T >::operator= ( const value_type val)
inline

Assigns the given value to all elements of the matrix.

Parameters
valThe value to be assigned to the matrix.
Returns
A reference to this matrix.

References ug::MathMatrix< N, M, T >::m_data.

◆ operator[]() [1/2]

template<std::size_t N, std::size_t M, typename T >
value_type* ug::MathMatrix< N, M, T >::operator[] ( std::size_t  index)
inline

◆ operator[]() [2/2]

template<std::size_t N, std::size_t M, typename T >
const value_type* ug::MathMatrix< N, M, T >::operator[] ( std::size_t  index) const
inline

Member Data Documentation

◆ ColSize

template<std::size_t N, std::size_t M, typename T >
const std::size_t ug::MathMatrix< N, M, T >::ColSize = M
static

◆ m_data

◆ RowSize

template<std::size_t N, std::size_t M, typename T >
const std::size_t ug::MathMatrix< N, M, T >::RowSize = N
static

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