1 #ifndef LOCARNA_MATRIX_HH
2 #define LOCARNA_MATRIX_HH
34 typedef typename std::vector<elem_t>::size_type
37 typedef std::pair<size_type, size_type>
80 if (from ==
nullptr)
return;
193 template <
class UnaryOperator>
196 std::transform(
mat_.begin(),
mat_.end(),
mat_.begin(), f);
215 out << mat(i, j) <<
" ";
simple 2D matrix class, provides access via operator (int,int)
Definition: matrix.hh:31
void fill(const elem_t &val)
Fill the whole matrix with the given value.
Definition: matrix.hh:168
void clear()
Definition: matrix.hh:179
void resize(size_type xdim, size_type ydim)
Definition: matrix.hh:102
void set(size_type i, size_type j, const elem_t &x)
Definition: matrix.hh:157
std::vector< elem_t >::size_type size_type
size type (from underlying vector)
Definition: matrix.hh:35
T elem_t
type of elements
Definition: matrix.hh:33
void transform(UnaryOperator f)
Definition: matrix.hh:195
Matrix(size_type xdim, size_type ydim, const elem_t *from=nullptr)
Definition: matrix.hh:78
const elem_t & operator()(size_type i, size_type j) const
Definition: matrix.hh:118
std::pair< size_type, size_type > size_pair_type
type for pair of sizes
Definition: matrix.hh:38
Matrix()
Definition: matrix.hh:66
size_type ydim_
second dimension
Definition: matrix.hh:43
elem_t & operator()(size_type i, size_type j)
Definition: matrix.hh:131
size_pair_type sizes() const
Definition: matrix.hh:91
const elem_t & get(size_type i, size_type j) const
Definition: matrix.hh:144
std::vector< elem_t > mat_
vector storing the matrix entries
Definition: matrix.hh:41
size_type addr(size_type i, size_type j) const
Definition: matrix.hh:55
size_type xdim_
first dimension
Definition: matrix.hh:42
Definition: aligner.cc:15
std::ostream & operator<<(std::ostream &out, const AlignerRestriction &r)
Definition: aligner_restriction.hh:135
std::istream & operator>>(std::istream &in, Matrix< T > &mat)
Definition: matrix.hh:232