A toolkit for working with phylogenetic data. v0.19.0
math/matrix.hpp File Reference
`#include "genesis/utils/containers/matrix.hpp"`
`#include "genesis/utils/math/statistics.hpp"`
`#include <vector>`

Go to the source code of this file.

## Namespaces

genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.

genesis::utils

## Functions

Matrix< double > correlation_matrix (Matrix< double > const &data)
Calculate the correlation Matrix of a given `data` Matrix. More...

Matrix< double > covariance_matrix (Matrix< double > const &data)
Calculate the covariance Matrix of a given `data` Matrix. More...

template<typename T = double, typename A = double, typename B = double>
Matrix< T > matrix_addition (Matrix< A > const &a, Matrix< B > const &b)
Calculate the element-wise sum of two Matrices. More...

template<typename T = double, typename A = double, typename B = double>
Matrix< T > matrix_addition (Matrix< A > const &matrix, B const &scalar)
Calculate the element-wise sum of a Matrix and a scalar. More...

std::vector< MeanStddevPair > matrix_col_mean_stddev (Matrix< double > const &data, double epsilon=-1.0)
Calcualte the column-wise mean and standard deviation of a Matrix. More...

template<typename T >
std::vector< MinMaxPair< T > > matrix_col_minmax (Matrix< T > const &data)
Calculate the column-wise min and max values of a Matrix. More...

double matrix_col_pearson_correlation_coefficient (Matrix< double > const &mat1, size_t col1, Matrix< double > const &mat2, size_t col2)
Calculate the Pearson Correlation Coefficient between two columns of two Matrices. More...

Quartiles matrix_col_quartiles (Matrix< double > const &data, size_t col)

std::vector< Quartiles > matrix_col_quartiles (Matrix< double > const &data)

double matrix_col_spearmans_rank_correlation_coefficient (Matrix< double > const &mat1, size_t col1, Matrix< double > const &mat2, size_t col2)
Calculate Spearman's Rank Correlation Coefficient between two columns of two Matrices. More...

template<typename T >
std::vector< T > matrix_col_sums (Matrix< T > const &data)
Calculate the sum of each column and return the result as a vector. More...

MeanStddevPair matrix_mean_stddev (Matrix< double > const &data, double epsilon=-1.0)
Calcualte the mean and standard deviation of all elements in a Matrix. More...

template<typename T >
MinMaxPair< T > matrix_minmax (Matrix< T > const &data)
Calculate the min and max values of a Matrix. More...

template<typename T = double, typename A = double, typename B = double>
Matrix< T > matrix_multiplication (Matrix< A > const &a, Matrix< B > const &b)
Calculate the product of two Matrices. More...

template<typename T = double, typename A = double, typename B = double>
std::vector< T > matrix_multiplication (std::vector< A > const &a, Matrix< B > const &b)
Calculate the product of a `vector` `a` with a Matrices `b`, as if the vector was a Matrix with only one row. More...

template<typename T = double, typename A = double, typename B = double>
std::vector< T > matrix_multiplication (Matrix< A > const &a, std::vector< B > const &b)
Calculate the product of a Matrices `a` with a `vector` `b`, as if the vector was a Matrix with only one column. More...

template<typename T = double, typename A = double, typename B = double>
Matrix< T > matrix_multiplication (Matrix< A > const &matrix, B const &scalar)
Calculate the element-wise multiplication of a Matrix and a scalar. More...

Quartiles matrix_quartiles (Matrix< double > const &data)
Calculate the Quartiles of the elmements in Matrix of `double`. More...

std::vector< MeanStddevPair > matrix_row_mean_stddev (Matrix< double > const &data, double epsilon=-1.0)
Calcualte the row-wise mean and standard deviation of a Matrix. More...

template<typename T >
std::vector< MinMaxPair< T > > matrix_row_minmax (Matrix< T > const &data)
Calculate the row-wise min and max values of a Matrix. More...

double matrix_row_pearson_correlation_coefficient (Matrix< double > const &mat1, size_t row1, Matrix< double > const &mat2, size_t row2)
Calculate the Pearson Correlation Coefficient between two row of two Matrices. More...

Quartiles matrix_row_quartiles (Matrix< double > const &data, size_t row)

std::vector< Quartiles > matrix_row_quartiles (Matrix< double > const &data)

double matrix_row_spearmans_rank_correlation_coefficient (Matrix< double > const &mat1, size_t row1, Matrix< double > const &mat2, size_t row2)
Calculate Spearman's Rank Correlation Coefficient between two row of two Matrices. More...

template<typename T >
std::vector< T > matrix_row_sums (Matrix< T > const &data)
Calculate the sum of each row and return the result as a vector. More...

template<typename T >
Matrix< T > matrix_sort_by_col_sum_symmetric (Matrix< T > const &data)
Sort rows and columns of a Matrix by the sum or the columns. More...

template<typename T >
Matrix< T > matrix_sort_by_row_sum_symmetric (Matrix< T > const &data)
Sort rows and columns of a Matrix by the sum or the rows. More...

template<typename T >
Matrix< T > matrix_sort_diagonal_symmetric (Matrix< T > const &data)
Sort a Matrix so that the highest entries are on the diagonal. More...

template<typename T = double, typename A = double, typename B = double>
Matrix< T > matrix_subtraction (Matrix< A > const &a, Matrix< B > const &b)
Calculate the element-wise difference of two Matrices. More...

template<typename T >
matrix_sum (Matrix< T > const &data)
Calculate the sum of all elements in a Matrix. More...

std::vector< MinMaxPair< double > > normalize_cols (Matrix< double > &data)
Normalize the columns of a Matrix so that all values are in the range `[ 0.0, 1.0 ]`. More...

std::vector< MinMaxPair< double > > normalize_rows (Matrix< double > &data)
Normalize the rows of a Matrix so that all values are in the range `[ 0.0, 1.0 ]`. More...

std::vector< MeanStddevPair > standardize_cols (Matrix< double > &data, bool scale_means=true, bool scale_std=true)
Standardize the columns of a Matrix by subtracting the mean and scaling to unit variance. More...

std::vector< MeanStddevPair > standardize_rows (Matrix< double > &data, bool scale_means=true, bool scale_std=true)
Standardize the rows of a Matrix by subtracting the mean and scaling to unit variance. More...

Matrix< double > sums_of_squares_and_cross_products_matrix (Matrix< double > const &data)
Calculate the Sums of Squares and Cross Products Matrix (SSCP Matrix). More...