philsupertramp/game-math
|
#include "Matrix.h"
Go to the source code of this file.
Functions | |
template<typename T > | |
Matrix< T > | HadamardMulti (const Matrix< T > &lhs, const Matrix< T > &rhs) |
template<typename T > | |
Matrix< T > | HadamardDiv (const Matrix< T > &lhs, const Matrix< T > &rhs) |
template<typename T > | |
Matrix< T > | KroneckerMulti (const Matrix< T > &lhs, const Matrix< T > &rhs) |
template<typename T > | |
Matrix< T > | HorizontalConcat (const Matrix< T > &lhs, const Matrix< T > &rhs) |
template<typename T > | |
size_t | Corr (const Matrix< T > &A, const Matrix< T > &B) |
template<typename T > | |
Matrix< T > | from_vptr (const T *value, MatrixDimension size) |
template<typename T > | |
size_t | argmax (const Matrix< T > &mat) |
template<typename T > | |
size_t | argmin (const Matrix< T > &mat) |
template<typename T > | |
Matrix< T > | where (const std::function< bool(T)> &condition, const Matrix< T > &in, const Matrix< T > &valIfTrue, const Matrix< T > &valIfFalse) |
template<typename T > | |
Matrix< size_t > | where_value (const Matrix< T > &in, T value) |
template<typename T > | |
Matrix< size_t > | where_true (const Matrix< T > &in) |
template<typename T > | |
Matrix< size_t > | where_false (const Matrix< T > &in) |
template<typename T > | |
std::vector< std::pair< Matrix< T >, Matrix< T > > > | zip (const Matrix< T > &a, const Matrix< T > &b) |
template<typename T > | |
T | max (const Matrix< T > &mat) |
template<typename T > | |
Matrix< T > | max (const Matrix< T > &mat, int axis) |
template<typename T > | |
T | min (const Matrix< T > &mat) |
template<typename T > | |
Matrix< T > | min (const Matrix< T > &mat, int axis) |
template<typename T > | |
T | elemMax (const Matrix< T > &mat, const size_t &elemIndex) |
template<typename T > | |
T | elemMin (const Matrix< T > &mat, const size_t &elemIndex) |
template<typename T > | |
Matrix< T > | mean (const Matrix< T > &mat, int axis=-1) |
template<typename T > | |
T | elemMean (const Matrix< T > &mat, const size_t &elemIndex) |
template<typename T > | |
Matrix< T > | diag_elements (const Matrix< T > &in) |
template<typename T > | |
Matrix< T > | unique (const Matrix< T > &in, int axis=0) |
size_t argmax | ( | const Matrix< T > & | mat | ) |
Search index of value with maximum value Caution! This value does represent the index in a ongoing array.
T |
mat |
size_t argmin | ( | const Matrix< T > & | mat | ) |
Search index of value with lowest value Caution! This value does represent the index in a ongoing array.
T | matrix value type |
mat | element to search in |
Counts correlations between A
and B
T | value type of A and B |
A | matrix to compare |
B | matrix to compare with |
Returns Vector of diagonal elements from matrix.
T | given datatype |
in | input matrix |
T elemMax | ( | const Matrix< T > & | mat, |
const size_t & | elemIndex | ||
) |
Max value from given element index in matrix
T | given datatype |
mat | matrix to search in |
elemIndex | index of element to compute max value of |
T elemMean | ( | const Matrix< T > & | mat, |
const size_t & | elemIndex | ||
) |
mean operation on element with given index
T | given datatype |
mat | input matrix |
elemIndex | index of element to compute mean of |
T elemMin | ( | const Matrix< T > & | mat, |
const size_t & | elemIndex | ||
) |
Min value from given element index in matrix
T | given datatype |
mat | matrix to search in |
elemIndex | index of element to compute max value of |
Matrix< T > from_vptr | ( | const T * | value, |
MatrixDimension | size | ||
) |
Converts array of elements of type T
into matrix of given size
T | value type |
value | pointer to array of elements of type T |
size | dimension of target matrix |
Element wise division
T | value type |
lhs | left hand side with dimension n1, m1 |
rhs | right hand side with dimension n1, m1 |
Matrix< T > HadamardMulti | ( | const Matrix< T > & | lhs, |
const Matrix< T > & | rhs | ||
) |
Helper utilities Element wise multiplication
T | value type |
lhs | left hand side with dimension n1, m1 |
rhs | right hand side with dimension n1, m1 |
Matrix< T > HorizontalConcat | ( | const Matrix< T > & | lhs, |
const Matrix< T > & | rhs | ||
) |
Horizontal concatenation of 2 matrices of same Row size
T | value type |
lhs | left hand side with dimension n1, m1 |
rhs | right hand side with dimension n1, m2 |
Matrix< T > KroneckerMulti | ( | const Matrix< T > & | lhs, |
const Matrix< T > & | rhs | ||
) |
A form of matrix multiplication For explicit reference please consult https://en.wikipedia.org/wiki/Kronecker_product
T | value type |
lhs | left hand side with dimension n1, m1 |
rhs | right hand side with dimension n2, m2 |
T max | ( | const Matrix< T > & | mat | ) |
Max value of given Matrix
T | given datatype |
mat | matrix to search max value in |
Calculates mean over given axis
T | given dataatype |
mat | matrix to calculate mean of |
axis | axis along which to calculate the mean (-1: no axis - over all elements, 0: row wise, 1: column wise) |
T min | ( | const Matrix< T > & | mat | ) |
Min value of given matrix
T | given datatype |
mat | matrix to search min value in |
Returns unique values of given matrix.
T | given datatype |
in | input matrix |
Matrix< T > where | ( | const std::function< bool(T)> & | condition, |
const Matrix< T > & | in, | ||
const Matrix< T > & | valIfTrue, | ||
const Matrix< T > & | valIfFalse | ||
) |
Returns elements chosen from valIfTrue
or valIfFalse
depending on condition
T | value type |
condition | lambda/function to test a condition on every element of in |
in | input values |
valIfTrue | value vector with values in case in meets condition |
valIfFalse | value vector with values in case in does not meet condition |
Evaluates elements of a given vector. Responds with indices of true values.
in | vector to evaluate in |
Evaluates elements of a given vector. Responds with indices of true values.
in | vector to evaluate in |
Evaluates elements of a given vector. Responds with indices of true values.
in | vector to evaluate in |