Matrix operators.
Definition in file utils/containers/matrix/operators.hpp.
#include <cassert>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <type_traits>
#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 | is_square (Matrix< T > const &data) |
Return whether a Matrix is a square matrix, that is, whether its number of rows and number of columns are idetical. More... | |
template<typename T > | |
bool | 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<> | |
std::ostream & | operator<< (std::ostream &os, const Matrix< signed char > &matrix) |
Template specialization for signed char , in order to print nicely. 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<> | |
std::ostream & | operator<< (std::ostream &os, const Matrix< unsigned char > &matrix) |
Template specialization for unsigned char , in order to print nicely. 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... | |
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 > | |
void | 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 | 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 > | transpose (Matrix< T > const &mat) |
Transpose a Matrix. More... | |
template<typename T > | |
void | transpose_inplace (Matrix< T > &mat) |
Transpose a Matrix inplace, without allocating a new Matrix. 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... | |