A library for working with phylogenetic and population genetic data.
v0.27.0
MatrixRow< MT, T > Class Template Reference

#include <genesis/utils/containers/matrix/row.hpp>

Detailed Description

template<typename MT, typename T>
class genesis::utils::MatrixRow< MT, T >

View into a Matrix row.

Definition at line 60 of file row.hpp.

Public Member Functions

 MatrixRow (matrix_type &mat, size_t row)
 
 MatrixRow (MatrixRow &&)=default
 
 MatrixRow (MatrixRow const &)=default
 
 ~MatrixRow ()=default
 
self_typeassign (self_type const &other)
 Overwrite a row by the elements of another row. More...
 
value_typeat (size_t column) const
 Return the element at a given column of the Matrix row. More...
 
Iterator begin () const
 Return an iterator to the beginning of the row. More...
 
Iterator end () const
 Return an iterator to past-the-end of the row. More...
 
matrix_typematrix () const
 Get the underlying Matrix. More...
 
 operator std::vector< non_const_value_type > () const
 Get a copy of the row in form of a std::vector. More...
 
bool operator!= (self_type const &other) const
 Return whether the elements of two rows are identical, using == for comparing elements. More...
 
MatrixRowoperator= (MatrixRow &&)=default
 
MatrixRowoperator= (MatrixRow const &)=default
 
self_typeoperator= (std::vector< T > const &vec)
 Overwrite a row by the elements of a std::vector. More...
 
bool operator== (self_type const &other) const
 Return whether the elements of two rows are identical, using == for comparing elements. More...
 
value_typeoperator[] (size_t column) const
 Return the element at a given column of the Matrix row. More...
 
size_t row () const
 Get the row index that this object represents. More...
 
size_t size () const
 Get the size of the row, that is, the number of columns of the Matrix. More...
 
std::vector< non_const_value_typeto_vector () const
 Explicit conversion to vector. More...
 

Public Types

using matrix_type = MT
 
using non_const_value_type = typename std::remove_const< T >::type
 
using self_type = MatrixRow< MT, T >
 
using value_type = T
 

Classes

class  Iterator
 Random access iterator into a Matrix row. More...
 

Constructor & Destructor Documentation

◆ MatrixRow() [1/3]

MatrixRow ( matrix_type mat,
size_t  row 
)
inline

Definition at line 78 of file row.hpp.

◆ ~MatrixRow()

~MatrixRow ( )
default

◆ MatrixRow() [2/3]

MatrixRow ( MatrixRow< MT, T > const &  )
default

◆ MatrixRow() [3/3]

MatrixRow ( MatrixRow< MT, T > &&  )
default

Member Function Documentation

◆ assign()

self_type& assign ( self_type const &  other)
inline

Overwrite a row by the elements of another row.

The sizes of both rows need to match each other. The given row can also be a row of the same Matrix.

Definition at line 378 of file row.hpp.

◆ at()

value_type& at ( size_t  column) const
inline

Return the element at a given column of the Matrix row.

Definition at line 293 of file row.hpp.

◆ begin()

Iterator begin ( ) const
inline

Return an iterator to the beginning of the row.

Definition at line 277 of file row.hpp.

◆ end()

Iterator end ( ) const
inline

Return an iterator to past-the-end of the row.

Definition at line 285 of file row.hpp.

◆ matrix()

matrix_type& matrix ( ) const
inline

Get the underlying Matrix.

Definition at line 309 of file row.hpp.

◆ operator std::vector< non_const_value_type >()

operator std::vector< non_const_value_type > ( ) const
inline

Get a copy of the row in form of a std::vector.

Definition at line 337 of file row.hpp.

◆ operator!=()

bool operator!= ( self_type const &  other) const
inline

Return whether the elements of two rows are identical, using == for comparing elements.

Definition at line 419 of file row.hpp.

◆ operator=() [1/3]

MatrixRow& operator= ( MatrixRow< MT, T > &&  )
default

◆ operator=() [2/3]

MatrixRow& operator= ( MatrixRow< MT, T > const &  )
default

◆ operator=() [3/3]

self_type& operator= ( std::vector< T > const &  vec)
inline

Overwrite a row by the elements of a std::vector.

The size of the vector needs to match the number of columns of the Matrix.

Definition at line 359 of file row.hpp.

◆ operator==()

bool operator== ( self_type const &  other) const
inline

Return whether the elements of two rows are identical, using == for comparing elements.

Definition at line 399 of file row.hpp.

◆ operator[]()

value_type& operator[] ( size_t  column) const
inline

Return the element at a given column of the Matrix row.

Definition at line 301 of file row.hpp.

◆ row()

size_t row ( ) const
inline

Get the row index that this object represents.

Definition at line 317 of file row.hpp.

◆ size()

size_t size ( ) const
inline

Get the size of the row, that is, the number of columns of the Matrix.

Definition at line 325 of file row.hpp.

◆ to_vector()

std::vector<non_const_value_type> to_vector ( ) const
inline

Explicit conversion to vector.

Definition at line 345 of file row.hpp.

Member Typedef Documentation

◆ matrix_type

using matrix_type = MT

Definition at line 69 of file row.hpp.

◆ non_const_value_type

using non_const_value_type = typename std::remove_const<T>::type

Definition at line 72 of file row.hpp.

◆ self_type

using self_type = MatrixRow<MT, T>

Definition at line 68 of file row.hpp.

◆ value_type

using value_type = T

Definition at line 70 of file row.hpp.


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