A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utils/containers/matrix/operators.hpp File Reference

Detailed Description

Matrix operators.

Definition in file utils/containers/matrix/operators.hpp.

#include <cassert>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "genesis/utils/containers/matrix.hpp"
#include "genesis/utils/core/algorithm.hpp"

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

template<typename T >
bool matrix_is_symmetric (Matrix< T > const &data)
 Return whether a Matrix is symmetric, i.e., whether it is square and m[ i, j ] == m[ j, i ] holds for all entries. More...
 
template<typename T >
void matrix_swap_cols (Matrix< T > &data, size_t col_a, size_t col_b)
 Swap (interchange) two columns of a Matrix, given their indices. More...
 
template<typename T >
void matrix_swap_rows (Matrix< T > &data, size_t row_a, size_t row_b)
 Swap (interchange) two rows of a Matrix, given their indices. More...
 
template<typename T >
Matrix< T > matrix_transpose (Matrix< T > const &data)
 Transpose a Matrix. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Matrix< T > &matrix)
 Print the elements of a Matrix to a stream, using operator << for each element. More...
 
template<typename T >
void print (std::ostream &out, Matrix< T > const &matrix, size_t rows=10, size_t cols=10)
 Print a Matrix to an out stream. See print( Matrix<T> const&, size_t, size_t ) for details. More...
 
template<typename T >
std::string print (Matrix< T > const &matrix, size_t rows=10, size_t cols=10)
 Print a Matrix to a std::string. More...
 
size_t triangular_index (size_t i, size_t j, size_t n)
 Given indices i and j in a quadratic Matrix, find the corresponding linear index. More...
 
std::pair< size_t, size_t > triangular_indices (size_t k, size_t n)
 Given a linear index in a upper triangular Matrix, find the corresponding Matrix indices. More...
 
size_t triangular_size (size_t n)
 Calculate the number of linear indices needed for a triangular Matrix of size n. More...