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

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

Detailed Description

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

View into a Matrix column.

Definition at line 60 of file col.hpp.

Public Member Functions

 MatrixCol (matrix_type &mat, size_t col)
 
 MatrixCol (MatrixCol &&)=default
 
 MatrixCol (MatrixCol const &)=default
 
 ~MatrixCol ()=default
 
self_typeassign (self_type const &other)
 Overwrite a column by the elements of another column. More...
 
value_typeat (size_t row) const
 Return the element at a given row of the Matrix column. More...
 
Iterator begin () const
 Return an iterator to the beginning of the row. More...
 
size_t col () const
 Get the column index that this object represents. 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 column in form of a std::vector. More...
 
bool operator!= (self_type const &other) const
 Return whether the elements of two columns are not identical, using == for comparing elements. More...
 
MatrixColoperator= (MatrixCol &&)=default
 
MatrixColoperator= (MatrixCol const &)=default
 
self_typeoperator= (std::vector< T > const &vec)
 Overwrite a column by the elements of a std::vector. More...
 
bool operator== (self_type const &other) const
 Return whether the elements of two columns are identical, using == for comparing elements. More...
 
value_typeoperator[] (size_t row) const
 Return the element at a given row of the Matrix column. More...
 
size_t size () const
 Get the size of the column, that is, the number of rows 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 = MatrixCol< MT, T >
 
using value_type = T
 

Classes

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

Constructor & Destructor Documentation

◆ MatrixCol() [1/3]

MatrixCol ( matrix_type mat,
size_t  col 
)
inline

Definition at line 78 of file col.hpp.

◆ ~MatrixCol()

~MatrixCol ( )
default

◆ MatrixCol() [2/3]

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

◆ MatrixCol() [3/3]

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

Member Function Documentation

◆ assign()

self_type& assign ( self_type const &  other)
inline

Overwrite a column by the elements of another column.

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

Definition at line 378 of file col.hpp.

◆ at()

value_type& at ( size_t  row) const
inline

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

Definition at line 293 of file col.hpp.

◆ begin()

Iterator begin ( ) const
inline

Return an iterator to the beginning of the row.

Definition at line 277 of file col.hpp.

◆ col()

size_t col ( ) const
inline

Get the column index that this object represents.

Definition at line 317 of file col.hpp.

◆ end()

Iterator end ( ) const
inline

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

Definition at line 285 of file col.hpp.

◆ matrix()

matrix_type& matrix ( ) const
inline

Get the underlying Matrix.

Definition at line 309 of file col.hpp.

◆ operator std::vector< non_const_value_type >()

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

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

Definition at line 337 of file col.hpp.

◆ operator!=()

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

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

Definition at line 419 of file col.hpp.

◆ operator=() [1/3]

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

◆ operator=() [2/3]

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

◆ operator=() [3/3]

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

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

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

Definition at line 359 of file col.hpp.

◆ operator==()

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

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

Definition at line 399 of file col.hpp.

◆ operator[]()

value_type& operator[] ( size_t  row) const
inline

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

Definition at line 301 of file col.hpp.

◆ size()

size_t size ( ) const
inline

Get the size of the column, that is, the number of rows of the Matrix.

Definition at line 325 of file col.hpp.

◆ to_vector()

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

Explicit conversion to vector.

Definition at line 345 of file col.hpp.

Member Typedef Documentation

◆ matrix_type

using matrix_type = MT

Definition at line 69 of file col.hpp.

◆ non_const_value_type

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

Definition at line 72 of file col.hpp.

◆ self_type

using self_type = MatrixCol<MT, T>

Definition at line 68 of file col.hpp.

◆ value_type

using value_type = T

Definition at line 70 of file col.hpp.


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