|
MAV'RIC
|
Templated matrix class. More...
#include <matrix.hpp>
Public Member Functions | |
| Mat (T value=0.0f, bool diag=false) | |
| Default constructor. | |
| Mat (const Mat< N, P > &mat) | |
| Copy constructor. | |
| Mat (const std::array< T, N *P > arr) | |
| Constructor from array. | |
| Mat (const std::initializer_list< T > list) | |
| Constructor from list. | |
| uint32_t | rows (void) |
| Get number of rows. | |
| uint32_t | cols (void) |
| Get number of columns. | |
| uint32_t | index (uint32_t i, uint32_t j) |
| Return index in internal data array from row/column. | |
| const T & | operator() (const uint32_t &i, const uint32_t &j) const |
| Safe access to matrix element. | |
| T & | operator() (const uint32_t &i, const uint32_t &j) |
| const T & | operator[] (const uint32_t &index) const |
| Direct access to matrix data. | |
| T & | operator[] (const uint32_t &index) |
| Mat | add (const Mat &m) const |
| Add to a matrix. | |
| Mat | add (const T value) const |
| Add to a scalar. | |
| Mat | operator+ (const Mat &m) const |
| Add to a matrix. | |
| Mat | operator+ (T value) const |
| Add to a scalar. | |
| void | add_inplace (const Mat &m) |
| Increment by a matrix (inplace operation) | |
| void | add_inplace (const T value) |
| Increment by a scalar (inplace operation) | |
| void | operator+= (const Mat &m) |
| Increment by a matrix (inplace operation) | |
| void | operator+= (const T value) |
| Increment by a scalar (inplace operation) | |
| Mat | subtract (const Mat &m) const |
| Subtract a matrix. | |
| Mat | subtract (const T value) const |
| Subtract a scalar. | |
| Mat | operator- (const Mat &m) const |
| Subtract a matrix. | |
| Mat | operator- (const T value) const |
| Subtract a scalar. | |
| void | subtract_inplace (const Mat &m) |
| Decrement by a matrix (inplace operation) | |
| void | subtract_inplace (const T value) |
| Decrement by a scalar (inplace operation) | |
| void | operator-= (const Mat &m) |
| Decrement by a matrix (inplace operation) | |
| void | operator-= (const T value) |
| Decrement by a scalar (inplace operation) | |
| Mat | multiply (const Mat &m) const |
| Multiply by a matrix. | |
| Mat | multiply (const T value) const |
| Multiply by a scalar. | |
| Mat | operator* (const Mat &m) const |
| Multiply by a matrix. | |
| Mat | operator* (const T value) const |
| Multiply by a scalar. | |
| void | multiply_inplace (const Mat &m) |
| Multiply by a matrix (inplace operation) | |
| void | multiply_inplace (const T value) |
| Multiply by a scalar (inplace operation) | |
| void | operator*= (const Mat &m) |
| Multiply by a matrix (inplace operation) | |
| void | operator*= (const T value) |
| Multiply by a scalar (inplace operation) | |
| template<uint32_t Q> | |
| Mat< N, Q, T > | dot (const Mat< P, Q, T > &m) const |
| Dot product. | |
| template<uint32_t Q> | |
| Mat< N, Q, T > | operator% (const Mat< P, Q, T > &m) const |
| Dot product. | |
| Mat< P, N, T > | transpose (void) const |
| Get transposed matrix. | |
| Mat< P, N, T > | operator~ (void) const |
| Get transposed matrix. | |
| Mat | inverse (bool &success) const |
| Get inversed matrix. | |
| Mat | inv (bool &success) const |
| Get inversed matrix. | |
| template<uint32_t I, uint32_t J, uint32_t Q, uint32_t R> | |
| Mat | insert (const Mat< Q, R, T > &m) const |
| Insert a matrix into this one. | |
| template<uint32_t I, uint32_t J, uint32_t Q, uint32_t R> | |
| bool | insert_inplace (const Mat< Q, R, T > &m) |
| Insert a matrix into this one. | |
| void | clip (const Mat &min, const Mat &max) |
| Clips matrix values between that of two matrices (element-wise) | |
| void | clip (float min, float max) |
| Clips matrix values. | |
Friends | |
| class | mat::op |
| template<typename TT > | |
| Mat | operator+ (const T value, const Mat &m) |
| Add a scalar to the matrix (ex: value + m) | |
| template<typename TT > | |
| Mat | operator- (const T value, const Mat &m) |
| Subtract a matrix to a scalar (ex: value - m) | |
| template<typename TT > | |
| Mat | operator* (const T value, const Mat &m) |
| Multiply a scalar to a matrix (ex: value * m) | |
Templated matrix class.
| N | Number of rows |
| P | Number of columns |
| T | Type of data (default: float) |
| Mat< N, P, T >::Mat | ( | T | value = 0.0f, |
| bool | diag = false |
||
| ) |
Default constructor.
| value | Value used to fill the matrix |
| diag | Flag indicating if the matrix is diagonal |
Copy constructor.
| mat | Matrix to copy |
Constructor from array.
Compile-time size check, does not work on avr32
| array | Array of values |
| Mat< N, P, T >::Mat | ( | const std::initializer_list< T > | list | ) |
Constructor from list.
Runtime size check, works on avr32
| array | Array of values |
| Mat< N, P, T > Mat< N, P, T >::add | ( | const Mat< N, P, T > & | m | ) | const |
Add to a matrix.
| m | Matrix to add |

| Mat< N, P, T > Mat< N, P, T >::add | ( | const T | value | ) | const |
Add to a scalar.
| value | Scalar to add |

| void Mat< N, P, T >::add_inplace | ( | const Mat< N, P, T > & | m | ) |
Increment by a matrix (inplace operation)
| m | Matrix to add |

| void Mat< N, P, T >::add_inplace | ( | const T | value | ) |
Increment by a scalar (inplace operation)
| value | Scalar to add |

| void Mat< N, P, T >::clip | ( | const Mat< N, P, T > & | min, |
| const Mat< N, P, T > & | max | ||
| ) |
Clips matrix values between that of two matrices (element-wise)
| min | Matrix with minimum values |
| max | Matrix with maximum values |

Clips matrix values.
| min | Minimum value |
| max | Maximum value |
Get number of columns.
| Mat<N,Q,T> Mat< N, P, T >::dot | ( | const Mat< P, Q, T > & | m | ) | const [inline] |
Dot product.
For some reason, there is a compilation error if this method is defined in matrix.hxx
| m | Matrix to dot-multiply |
| Q | Number of columns of 2nd matrix, also number of columns of result |

| uint32_t Mat< N, P, T >::index | ( | uint32_t | i, |
| uint32_t | j | ||
| ) |
Return index in internal data array from row/column.
| Mat< N, P, T > Mat< N, P, T >::insert | ( | const Mat< Q, R, T > & | m | ) | const |
Insert a matrix into this one.
| m | Matrix to be inserted |
| i | Row index of the first element where the matrix should be inserted |
| j | Column index of the first element where the matrix should be inserted |
| success | False if the inserted matrix was to big to fit (in this case, the elements that fits are still inserted) |
| bool Mat< N, P, T >::insert_inplace | ( | const Mat< Q, R, T > & | m | ) |
Insert a matrix into this one.
| m | Matrix to be inserted |
| I | Row index of the first top left element to be inserted (index in m1) |
| J | Column index of the first top left element to be inserted (index in m1) |
| Q | Number of rows of 2nd matrix |
| R | Number of columns of 2nd matrix |
| Mat< N, P, T > Mat< N, P, T >::inv | ( | bool & | success | ) | const |
Get inversed matrix.
| success | Indicates if the matrix could be inverted |

| Mat< N, P, T > Mat< N, P, T >::inverse | ( | bool & | success | ) | const |
Get inversed matrix.
| success | Indicates if the matrix could be inverted |

| Mat< N, P, T > Mat< N, P, T >::multiply | ( | const Mat< N, P, T > & | m | ) | const |
Multiply by a matrix.
| m | Matrix to multiply |

| Mat< N, P, T > Mat< N, P, T >::multiply | ( | const T | value | ) | const |
Multiply by a scalar.
| value | Scalar to multiply |

| void Mat< N, P, T >::multiply_inplace | ( | const Mat< N, P, T > & | m | ) |
Multiply by a matrix (inplace operation)
| m | Matrix to multiply |

| void Mat< N, P, T >::multiply_inplace | ( | const T | value | ) |
Multiply by a scalar (inplace operation)
| value | Scalar to multiply |

| Mat<N,Q,T> Mat< N, P, T >::operator% | ( | const Mat< P, Q, T > & | m | ) | const [inline] |
Dot product.
For some reason, there is a compilation error if this method is defined in matrix.hxx
| m | Matrix to dot-multiply |
| Q | Number of columns of 2nd matrix, also number of columns of result |
| const T & Mat< N, P, T >::operator() | ( | const uint32_t & | i, |
| const uint32_t & | j | ||
| ) | const |
Safe access to matrix element.
| i | Row |
| j | Column |
| Mat< N, P, T > Mat< N, P, T >::operator* | ( | const Mat< N, P, T > & | m | ) | const |
Multiply by a matrix.
| m | Matrix to multiply |

| Mat< N, P, T > Mat< N, P, T >::operator* | ( | const T | value | ) | const |
Multiply by a scalar.
| value | Scalar to multiply |

| void Mat< N, P, T >::operator*= | ( | const Mat< N, P, T > & | m | ) |
Multiply by a matrix (inplace operation)
| m | Matrix to multiply |
| void Mat< N, P, T >::operator*= | ( | const T | value | ) |
Multiply by a scalar (inplace operation)
| value | Scalar to multiply |
| Mat< N, P, T > Mat< N, P, T >::operator+ | ( | const Mat< N, P, T > & | m | ) | const |
Add to a matrix.
| m | Matrix to add |

| Mat< N, P, T > Mat< N, P, T >::operator+ | ( | T | value | ) | const |
Add to a scalar.
| value | Scalar to add |

| void Mat< N, P, T >::operator+= | ( | const Mat< N, P, T > & | m | ) |
Increment by a matrix (inplace operation)
| m | Matrix to add |
| void Mat< N, P, T >::operator+= | ( | const T | value | ) |
Increment by a scalar (inplace operation)
| value | Scalar to add |
| Mat< N, P, T > Mat< N, P, T >::operator- | ( | const Mat< N, P, T > & | m | ) | const |
Subtract a matrix.
| m | Matrix to subtract |

| Mat< N, P, T > Mat< N, P, T >::operator- | ( | const T | value | ) | const |
Subtract a scalar.
| value | Scalar to subtract |

| void Mat< N, P, T >::operator-= | ( | const Mat< N, P, T > & | m | ) |
Decrement by a matrix (inplace operation)
| m | Matrix to subtract |
| void Mat< N, P, T >::operator-= | ( | const T | value | ) |
Decrement by a scalar (inplace operation)
| value | Scalar to subtract |
| const T & Mat< N, P, T >::operator[] | ( | const uint32_t & | index | ) | const |
Direct access to matrix data.
| index | Index in array (index=i*P+j for i-th row and j-th column) |
| Mat< P, N, T > Mat< N, P, T >::operator~ | ( | void | ) | const |
Get transposed matrix.

Get number of rows.
| Mat< N, P, T > Mat< N, P, T >::subtract | ( | const Mat< N, P, T > & | m | ) | const |
Subtract a matrix.
| m | Matrix to subtract |

| Mat< N, P, T > Mat< N, P, T >::subtract | ( | const T | value | ) | const |
Subtract a scalar.
| value | Scalar to subtract |

| void Mat< N, P, T >::subtract_inplace | ( | const Mat< N, P, T > & | m | ) |
Decrement by a matrix (inplace operation)
| m | Matrix to subtract |

| void Mat< N, P, T >::subtract_inplace | ( | const T | value | ) |
Decrement by a scalar (inplace operation)
| value | Scalar to subtract |

| Mat< P, N, T > Mat< N, P, T >::transpose | ( | void | ) | const |
Get transposed matrix.


friend class mat::op [friend] |
Friend with op class, so that methods of op can access private members of Mat<N,P,T>
| Mat operator* | ( | const T | value, |
| const Mat< N, P, T > & | m | ||
| ) | [friend] |
Multiply a scalar to a matrix (ex: value * m)
| value | Scalar to multiply |
| m | Matrix to multiply |
| Mat operator+ | ( | const T | value, |
| const Mat< N, P, T > & | m | ||
| ) | [friend] |
Add a scalar to the matrix (ex: value + m)
| value | Scalar to add |
| m | Scalar to add |
| Mat operator- | ( | const T | value, |
| const Mat< N, P, T > & | m | ||
| ) | [friend] |
Subtract a matrix to a scalar (ex: value - m)
| value | Scalar to subtract |
1.7.6.1