A library for working with phylogenetic and population genetic data.
v0.32.0
Matrix< T > Class Template Reference

#include <genesis/placement/function/emd.hpp>

Detailed Description

template<typename T>
class genesis::utils::Matrix< T >

Definition at line 53 of file placement/function/emd.hpp.

Public Member Functions

 Matrix ()
 
 Matrix (Matrix &&)=default
 
 Matrix (Matrix const &)=default
 
 Matrix (size_t rows, size_t cols)
 
 Matrix (size_t rows, size_t cols, std::initializer_list< T > const &init_list)
 
 Matrix (size_t rows, size_t cols, std::vector< T > &&data)
 
 Matrix (size_t rows, size_t cols, std::vector< T > const &data)
 
 Matrix (size_t rows, size_t cols, T init)
 
 ~Matrix ()=default
 
T & at (const size_t row, const size_t col)
 
T const & at (const size_t row, const size_t col) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
MatrixCol< self_type, value_typecol (size_t col)
 
MatrixCol< const self_type, const value_typecol (size_t col) const
 
size_t cols () const
 
container_type const & data () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool operator!= (Matrix< T > const &other) const
 
T & operator() (const size_t row, const size_t col)
 
T const & operator() (const size_t row, const size_t col) const
 
Matrixoperator= (Matrix &&)=default
 
Matrixoperator= (Matrix const &)=default
 
bool operator== (Matrix< T > const &other) const
 
MatrixRow< self_type, value_typerow (size_t row)
 
MatrixRow< const self_type, const value_typerow (size_t row) const
 
size_t rows () const
 
size_t size () const
 
void swap (Matrix &other)
 

Public Types

using const_iterator = typename container_type::const_iterator
 
using container_type = std::vector< T >
 
using iterator = typename container_type::iterator
 
using self_type = Matrix< T >
 
using value_type = T
 

Friends

void swap (Matrix &lhs, Matrix &rhs)
 
void transpose_inplace (Matrix< T > &)
 Transpose a Matrix inplace, without allocating a new Matrix. More...
 

Constructor & Destructor Documentation

◆ Matrix() [1/8]

Matrix ( )
inline

Definition at line 79 of file containers/matrix.hpp.

◆ Matrix() [2/8]

Matrix ( size_t  rows,
size_t  cols 
)
inline

Definition at line 85 of file containers/matrix.hpp.

◆ Matrix() [3/8]

Matrix ( size_t  rows,
size_t  cols,
init 
)
inline

Definition at line 91 of file containers/matrix.hpp.

◆ Matrix() [4/8]

Matrix ( size_t  rows,
size_t  cols,
std::vector< T > const &  data 
)
inline

Definition at line 97 of file containers/matrix.hpp.

◆ Matrix() [5/8]

Matrix ( size_t  rows,
size_t  cols,
std::vector< T > &&  data 
)
inline

Definition at line 112 of file containers/matrix.hpp.

◆ Matrix() [6/8]

Matrix ( size_t  rows,
size_t  cols,
std::initializer_list< T > const &  init_list 
)
inline

Definition at line 127 of file containers/matrix.hpp.

◆ ~Matrix()

~Matrix ( )
default

◆ Matrix() [7/8]

Matrix ( Matrix< T > const &  )
default

◆ Matrix() [8/8]

Matrix ( Matrix< T > &&  )
default

Member Function Documentation

◆ at() [1/2]

T& at ( const size_t  row,
const size_t  col 
)
inline

Definition at line 205 of file containers/matrix.hpp.

◆ at() [2/2]

T const& at ( const size_t  row,
const size_t  col 
) const
inline

Definition at line 217 of file containers/matrix.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 299 of file containers/matrix.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 309 of file containers/matrix.hpp.

◆ cbegin()

const_iterator cbegin ( ) const
inline

Definition at line 319 of file containers/matrix.hpp.

◆ cend()

const_iterator cend ( ) const
inline

Definition at line 324 of file containers/matrix.hpp.

◆ col() [1/2]

MatrixCol<self_type, value_type> col ( size_t  col)
inline

Definition at line 271 of file containers/matrix.hpp.

◆ col() [2/2]

MatrixCol<const self_type, const value_type> col ( size_t  col) const
inline

Definition at line 283 of file containers/matrix.hpp.

◆ cols()

size_t cols ( ) const
inline

Definition at line 181 of file containers/matrix.hpp.

◆ data()

container_type const& data ( ) const
inline

Definition at line 196 of file containers/matrix.hpp.

◆ empty()

bool empty ( ) const
inline

Definition at line 191 of file containers/matrix.hpp.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 304 of file containers/matrix.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 314 of file containers/matrix.hpp.

◆ operator!=()

bool operator!= ( Matrix< T > const &  other) const
inline

Definition at line 340 of file containers/matrix.hpp.

◆ operator()() [1/2]

T& operator() ( const size_t  row,
const size_t  col 
)
inline

Definition at line 229 of file containers/matrix.hpp.

◆ operator()() [2/2]

T const& operator() ( const size_t  row,
const size_t  col 
) const
inline

Definition at line 236 of file containers/matrix.hpp.

◆ operator=() [1/2]

Matrix& operator= ( Matrix< T > &&  )
default

◆ operator=() [2/2]

Matrix& operator= ( Matrix< T > const &  )
default

◆ operator==()

bool operator== ( Matrix< T > const &  other) const
inline

Definition at line 333 of file containers/matrix.hpp.

◆ row() [1/2]

MatrixRow<self_type, value_type> row ( size_t  row)
inline

Definition at line 247 of file containers/matrix.hpp.

◆ row() [2/2]

MatrixRow<const self_type, const value_type> row ( size_t  row) const
inline

Definition at line 259 of file containers/matrix.hpp.

◆ rows()

size_t rows ( ) const
inline

Definition at line 176 of file containers/matrix.hpp.

◆ size()

size_t size ( ) const
inline

Definition at line 186 of file containers/matrix.hpp.

◆ swap()

void swap ( Matrix< T > &  other)
inline

Definition at line 156 of file containers/matrix.hpp.

Friends And Related Function Documentation

◆ swap

void swap ( Matrix< T > &  lhs,
Matrix< T > &  rhs 
)
friend

Definition at line 164 of file containers/matrix.hpp.

◆ transpose_inplace

void transpose_inplace ( Matrix< T > &  )
friend

Transpose a Matrix inplace, without allocating a new Matrix.

Only needs additional storage for 1 bit per element of the matrix, compared to the full reallocation of the transpose() function. It is however somewhat slower (4-5x more time in our debug build).

Definition at line 146 of file utils/containers/matrix/operators.hpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename container_type::const_iterator

Definition at line 73 of file containers/matrix.hpp.

◆ container_type

using container_type = std::vector<T>

Definition at line 71 of file containers/matrix.hpp.

◆ iterator

using iterator = typename container_type::iterator

Definition at line 72 of file containers/matrix.hpp.

◆ self_type

using self_type = Matrix<T>

Definition at line 68 of file containers/matrix.hpp.

◆ value_type

using value_type = T

Definition at line 69 of file containers/matrix.hpp.


The documentation for this class was generated from the following files: