| 
    mu
    
   | 
 
A generic matrix. More...
#include <matrix.h>
Public Types | |
| using | value_type = typename std::array< Vector< M, T >, N >::value_type | 
| using | size_type = typename std::array< Vector< M, T >, N >::size_type | 
| using | iterator = typename std::array< Vector< M, T >, N >::iterator | 
| using | const_iterator = typename std::array< Vector< M, T >, N >::const_iterator | 
Public Member Functions | |
| constexpr | Matrix ()=default | 
| Construct a new Matrix object.  More... | |
| template<typename... TArgs> | |
| Matrix (TArgs const(&&... rows)[M]) | |
| Construct a new Matrix object from a number of NxM values.  More... | |
| template<std::size_t Nn, std::size_t Mm, class U > | |
| Matrix (const Matrix< Nn, Mm, U > &m) | |
| Construct a new Matrix from an existing Matrix of a different type.  More... | |
| Matrix (const std::array< Vector< M, T >, N > &a) | |
| Construct a new Matrix object from an std::array of Vectors.  More... | |
| template<typename U = T> | |
| Matrix (const std::array< Vector< M, U >, N > &a) | |
| Construct a new Matrix object from an std::array of Vectors of a different type.  More... | |
| template<typename U = T, std::enable_if_t< std::is_arithmetic< U >::value, int > = 0> | |
| Matrix (const std::array< std::array< U, M >, N > &a) | |
| Construct a new Matrix object from an std::array of std::arrays. possibly of a different type.  More... | |
| template<typename U = T, std::enable_if_t< std::is_arithmetic< U >::value, int > = 0> | |
| Matrix (const U &value) | |
| Construct a new Matrix object from a single value possibly of a different type.  More... | |
| ~Matrix ()=default | |
| Destroy the Matrix object.  | |
| Matrix (const Matrix &other)=default | |
| Copy construct a new Matrix object.  More... | |
| Matrix (Matrix &&other) noexcept=default | |
| Move construct a new Matrix object.  More... | |
| Matrix & | operator= (const Matrix &other)=default | 
| Copy assignment operator.  More... | |
| Matrix & | operator= (Matrix &&other) noexcept=default | 
| Move assignment operator.  More... | |
| Vector< M, T > & | operator[] (size_type idx) noexcept | 
| access a row within the matrix  More... | |
| const Vector< M, T > & | operator[] (size_type idx) const noexcept | 
| const access a row within the matrix  More... | |
| Vector< M, T > & | at (size_type idx) | 
| access a row within the matrix  More... | |
| const Vector< M, T > & | at (size_type idx) const | 
| const access a row within the matrix  More... | |
| constexpr std::array< size_type, 2 > | size () const noexcept | 
| returns the matrix dimensions as an array of size 2  More... | |
| constexpr size_type | n_rows () const noexcept | 
| returns the number of rows  More... | |
| constexpr size_type | n_cols () const noexcept | 
| returns the number of columns  More... | |
| iterator | begin () noexcept | 
| returns an iterator starting at the first row  More... | |
| const_iterator | begin () const noexcept | 
| returns a const iterator starting at the first row  More... | |
| iterator | end () noexcept | 
| returns a iterator starting at one after the last row  More... | |
| const_iterator | end () const noexcept | 
| returns a const iterator starting at one after the last row  More... | |
| Vector< M, T > | row (const size_type &idx) const | 
| get a matrix row as a vector  More... | |
| Vector< N, T > | col (const size_type &idx) const | 
| get a matrix column as a vector  More... | |
| T | min () const | 
| get the min value of the matrix  More... | |
| T | max () const | 
| get the max value of the matrix  More... | |
| T | sum () const | 
| sum up all the elements of the matrix  More... | |
| template<typename U = T> | |
| U | mean () const | 
| mean of all the elements of the matrix  More... | |
| auto | diag () const | 
| returns the diagonal of the matrix as a vector  More... | |
| T | det () const | 
| calculates the determinant of the matrix  More... | |
| void | transpose () | 
| transposes this Matrix object  More... | |
| Matrix< M, N, T > | transposed () const | 
| creates and returns a transposed Matrix object  More... | |
| template<typename U = void, std::size_t N2, std::size_t M2, typename T2 > | |
| std::conditional_t< std::is_same< U, void >::value, Matrix< N, M2, T >, Matrix< N, M2, U > > | dot (const Matrix< N2, M2, T2 > &rhs) const | 
| dot product of two matrices  More... | |
| template<typename U = void, std::size_t N2, typename T2 > | |
| std::conditional_t< std::is_same< U, void >::value, Vector< N, T >, Vector< N, U > > | dot (const Vector< N2, T2 > &rhs) const | 
| dot product of a matrix and a vector  More... | |
| template<class U = T> | |
| U | std () const | 
| calculates the standard deviation  More... | |
| template<typename U = T> | |
| bool | operator== (const Matrix< N, M, U > &rhs) const | 
| equality operator  More... | |
| template<typename U = T> | |
| bool | operator!= (const Matrix< N, M, U > &rhs) const | 
| unequality operator  More... | |
| template<typename U = T> | |
| Matrix< N, M, T > & | operator+= (const Matrix< N, M, U > &rhs) | 
| plus equal operator  More... | |
| template<typename U = T> | |
| Matrix< N, M, T > & | operator-= (const Matrix< N, M, U > &rhs) | 
| minus equal operator  More... | |
| template<typename U = T> | |
| Matrix< N, M, T > & | operator*= (const Matrix< N, M, U > &rhs) | 
| multiplication equal operator  More... | |
| template<typename U = T> | |
| Matrix< N, M, T > & | operator/= (const Matrix< N, M, U > &rhs) | 
| divison equal operator  More... | |
| template<class TScalar > | |
| std::enable_if_t< std::is_arithmetic< TScalar >::value, Matrix< N, M, T > & > | operator+= (const TScalar &scalar) | 
| add a scalar to this matrix  More... | |
| template<class TScalar > | |
| std::enable_if_t< std::is_arithmetic< TScalar >::value, Matrix< N, M, T > & > | operator-= (const TScalar &scalar) | 
| subtract a scalar from every element of this matrix  More... | |
| template<class TScalar > | |
| std::enable_if_t< std::is_arithmetic< TScalar >::value, Matrix< N, M, T > & > | operator*= (const TScalar &scalar) | 
| multiply a scalar with this matrix  More... | |
| template<class TScalar > | |
| std::enable_if_t< std::is_arithmetic< TScalar >::value, Matrix< N, M, T > & > | operator/= (const TScalar &scalar) | 
| divide every element of this matrix by a scalar  More... | |
Protected Attributes | |
| std::array< Vector< M, T >, N > | data_ | 
Friends | |
| template<std::size_t Nn, std::size_t Mm, class U > | |
| std::ostream & | operator<< (std::ostream &os, const Matrix< Nn, Mm, U > &m) | 
| print matrix values  More... | |
A generic matrix.
Can be instantiated with an arithmetic type as defined by the standard library.
| N | first matrix dimension (rows) | 
| M | second matrix dimension (columns) | 
| T | the type of the values inside the matrix | 
forward declaration of the Matrix class
| X | |
| Y | |
| Z | 
      
  | 
  default | 
      
  | 
  inline | 
Construct a new Matrix object from a number of NxM values.
the number of values in every dimension must match the static size of this Matrix.
| TArgs | 
| rows | 
      
  | 
  inline | 
Construct a new Matrix from an existing Matrix of a different type.
implicit narrowing may be applied 
it is checked that the Matrix sizes are the same 
forwards intialization to Vector for every row
| Nn | |
| Mm | |
| U | 
| m | 

      
  | 
  inline | 
Construct a new Matrix object from an std::array of Vectors.
| a | 
      
  | 
  inline | 
Construct a new Matrix object from an std::array of Vectors of a different type.
implicit narrowing may be applied 
forwards intialization to Vector for every row
| U | 
| a | 

      
  | 
  inline | 
Construct a new Matrix object from an std::array of std::arrays. possibly of a different type.
implicit narrowing may be applied 
forwards intialization to Vector for every row
| U | 
| a | 

      
  | 
  inline | 
Construct a new Matrix object from a single value possibly of a different type.
all the values inside the vector will be set to this value 
implicit narrowing may be applied 
forwards intialization to Vector for every row
| U | 
| value | 

      
  | 
  default | 
Copy construct a new Matrix object.
| other | 
      
  | 
  defaultnoexcept | 
Move construct a new Matrix object.
| other | 
      
  | 
  inline | 
access a row within the matrix
| out | of range | 
| idx | 
      
  | 
  inline | 
const access a row within the matrix
| out | of range | 
| idx | 
      
  | 
  inlinenoexcept | 
returns an iterator starting at the first row

      
  | 
  inlinenoexcept | 
returns a const iterator starting at the first row
      
  | 
  inline | 
get a matrix column as a vector
an invalid index that exceeds the matrix dimension causes a runtime error
| idx | 
      
  | 
  inline | 
calculates the determinant of the matrix
matrix must be symmetrical with N == M

      
  | 
  inline | 
returns the diagonal of the matrix as a vector
the vector is of the size of the smallest matrix dimension. either N or M
return type specified as "auto" because otherwise doc does not generate correctly. otherwise would be:

      
  | 
  inline | 
dot product of two matrices
For a Matrix \( A \) of size \( M \times N \) and a Matrix \( B \) of size \( N \times P \) the result is a Matrix \( C \) of size \( M \times P \),
\( C = A \cdot B \) with
\( c_{ij} = A_{i1} B_{1j} + A_{i2} B_{2j} + ... + A_{iN} B_{Nj} = \sum_{k=1}^{N} A_{ik} B_{kj} \)
Second Matrix dimension (N) of first Matrix must be equal to the first Matrix dimension of the second Matrix (N)
For two objects of the same type, specifying the return type is optional. It will be of the type of the two objects by default.
For two objects of different types, specifying the return type is required.
return value is a Matrix of the size of the first Matrix's first dimension (M) and the second Matrix's second dimension (P) containing the type of the two objects or else of the explicitly stated type
https://en.wikipedia.org/wiki/Matrix_multiplication#Definition
| U | |
| N2 | |
| M2 | |
| T2 | 
| rhs | 


      
  | 
  inline | 
dot product of a matrix and a vector
For a Matrix \( A \) of size \( N \times M \) and a Vector \( b \) of size \( M \) the result is a Vector \( c \) of size \( N \),
\( c = A \cdot b \) with
\( c_{j} = A_{j1} b_1 + A_{j2} b_2 + ... + A_{jM} b_M = \sum_{i=1}^{M} A_{ji} b_i \)
Second Matrix dimension (M) must be equal to the size of the Vector (N)
For two objects of the same type, specifying the return type is optional. It will be of the type of the two objects by default.
For two objects of different types, specifying the return type is required.
return value is a Vector of the size of the first Matrix dimension (N) containing the type of the two objects or else of the explicitly stated type
| U | |
| N2 | |
| T2 | 
| rhs | 

      
  | 
  inlinenoexcept | 
returns a iterator starting at one after the last row

      
  | 
  inlinenoexcept | 
returns a const iterator starting at one after the last row
      
  | 
  inline | 
get the max value of the matrix


      
  | 
  inline | 
mean of all the elements of the matrix
specifying the return type is optional. It will be of the type of the Vector by default.
| U | 


      
  | 
  inline | 
get the min value of the matrix


      
  | 
  inlinenoexcept | 
returns the number of columns
      
  | 
  inlinenoexcept | 
returns the number of rows
      
  | 
  inline | 
unequality operator
| rhs | 

      
  | 
  inline | 
multiplication equal operator
subject to implicit conversions
| U | 
| rhs | 
      
  | 
  inline | 
multiply a scalar with this matrix
| TScalar | 
| scalar | 

      
  | 
  inline | 
plus equal operator
subject to implicit conversions
| U | 
| rhs | 
      
  | 
  inline | 
add a scalar to this matrix
| TScalar | 
| scalar | 

      
  | 
  inline | 
minus equal operator
subject to implicit conversions
| U | 
| rhs | 
      
  | 
  inline | 
subtract a scalar from every element of this matrix
| TScalar | 
| scalar | 

      
  | 
  inline | 
divison equal operator
subject to implicit conversions
| U | 
| rhs | 
      
  | 
  inline | 
divide every element of this matrix by a scalar
division by zero on integral types triggers an assert
| TScalar | 
| scalar | 

      
  | 
  default | 
Copy assignment operator.
| other | 

      
  | 
  defaultnoexcept | 
Move assignment operator.
| other | 
      
  | 
  inline | 
equality operator
see mu::Vector operator== for more information.
| rhs | 

      
  | 
  inlinenoexcept | 
access a row within the matrix
does not throw an exception if idx is out of range
| idx | 
      
  | 
  inlinenoexcept | 
const access a row within the matrix
does not throw an exception if idx is out of range
| idx | 
      
  | 
  inline | 
get a matrix row as a vector
an invalid index that exceeds the matrix dimension causes a runtime error
| idx | 

      
  | 
  inlinenoexcept | 
returns the matrix dimensions as an array of size 2
[0] rows 
[1] columns
      
  | 
  inline | 
calculates the standard deviation
\( \sigma = \sqrt{\frac{\sum(x_ij - \mu)^2}{N}} \)
| U | 

      
  | 
  inline | 
sum up all the elements of the matrix


      
  | 
  inline | 
transposes this Matrix object
only works for symmetrical matrices!!!

      
  | 
  inline | 
creates and returns a transposed Matrix object

      
  | 
  friend | 
print matrix values
forwards Vector for every row
| Nn | |
| U | 
| os | |
| v |