48 template <
typename Value>
50 protected std::vector<Value>
53 typedef std::vector<Value>
Base;
118 Base::operator=(rhs);
141 return Base::operator[](
index(i, j));
146 return Base::operator[](
index(i, j));
151 Base::operator[](
index(i, j)) = value;
163 values[j] = Base::operator[](
index(i, j));
177 values[j] = Base::operator[](
index(j, i));
205 using Base::capacity;
206 using Base::max_size;
226 rows_ = size_pair.first;
227 cols_ = size_pair.second;
306 "Matrices have different row sizes.");
308 "Matrices have different column sizes.");
320 "Matrices have different row sizes.");
322 "Matrices have different column sizes.");
327 template <
int ROWS,
int COLS>
362 template <
typename Value>
370 os << std::setprecision(6) << std::setw(6) << matrix(i, j) <<
' ';
Int overflow exception.
Definition: Exception.h:221
A two-dimensional matrix. Similar to std::vector, but uses a binary operator(,) for element access.
Definition: Matrix.h:51
std::pair< Size, Size > const indexPair(Size index) const
Calculate the row and column from an index into the underlying vector. Note that Matrix uses the (row...
Definition: Matrix.h:265
SizeType cols_
Number of columns (width of a row)
Definition: Matrix.h:352
Base::allocator_type allocator_type
Definition: Matrix.h:74
Base::iterator iterator
Definition: Matrix.h:66
const_reverse_iterator ConstReverseIterator
Definition: Matrix.h:84
Base::reverse_iterator reverse_iterator
Definition: Matrix.h:67
difference_type DifferenceType
Definition: Matrix.h:80
const Base & asVector()
Definition: Matrix.h:340
void resize(size_type i, size_type j, value_type value=value_type())
Definition: Matrix.h:217
std::ostream & operator<<(std::ostream &os, const Matrix< Value > &matrix)
Print the contents to a stream.
Definition: Matrix.h:363
~Matrix()
Definition: Matrix.h:124
container_type row(size_type const i) const
Return the i-th row of the matrix as a vector.
Definition: Matrix.h:155
Matrix(const SizeType rows, const SizeType cols, ValueType value=ValueType())
Definition: Matrix.h:104
Matrix()
Definition: Matrix.h:98
reverse_iterator ReverseIterator
Definition: Matrix.h:86
iterator Iterator
Definition: Matrix.h:85
reference Reference
Definition: Matrix.h:90
Base ContainerType
Definition: Matrix.h:79
container_type col(size_type const i) const
Return the i-th column of the matrix as a vector.
Definition: Matrix.h:169
reference operator()(size_type const i, size_type const j)
Definition: Matrix.h:134
Base::const_reverse_iterator const_reverse_iterator
Definition: Matrix.h:65
SizeType rows() const
Number of rows.
Definition: Matrix.h:232
const_iterator ConstIterator
Definition: Matrix.h:83
bool operator<(Matrix const &rhs) const
Less-than comparator. Comparison is done lexicographically: first by row, then by column.
Definition: Matrix.h:317
const_reference operator()(size_type const i, size_type const j) const
Definition: Matrix.h:129
SizeType const index(SizeType row, SizeType col) const
Calculate the index into the underlying vector from row and column. Note that Matrix uses the (row,...
Definition: Matrix.h:252
Base::value_type value_type
Definition: Matrix.h:72
allocator_type AllocatorType
Definition: Matrix.h:93
value_type ValueType
Definition: Matrix.h:91
void resize(std::pair< Size, Size > const &size_pair, value_type value=value_type())
Definition: Matrix.h:224
bool operator==(Matrix const &rhs) const
Equality comparator.
Definition: Matrix.h:303
Base container_type
Definition: Matrix.h:59
Base::pointer pointer
Definition: Matrix.h:70
Base::difference_type difference_type
Definition: Matrix.h:61
std::pair< Size, Size > sizePair() const
Definition: Matrix.h:243
Matrix(const Matrix &source)
Definition: Matrix.h:110
size_type SizeType
Definition: Matrix.h:81
const_reference getValue(size_type const i, size_type const j) const
Definition: Matrix.h:139
Base::const_reference const_reference
Definition: Matrix.h:69
const_reference ConstReference
Definition: Matrix.h:88
std::vector< Value > Base
Definition: Matrix.h:53
SizeType cols() const
Number of columns.
Definition: Matrix.h:238
Base::reference reference
Definition: Matrix.h:71
SizeType rows_
Number of rows (height of a column)
Definition: Matrix.h:350
void clear()
Definition: Matrix.h:210
pointer Pointer
Definition: Matrix.h:89
void setValue(size_type const i, size_type const j, value_type value)
Definition: Matrix.h:149
Base::size_type size_type
Definition: Matrix.h:62
SizeType colIndex(SizeType index) const
Calculate the column from an index into the underlying vector. Note that Matrix uses the (row,...
Definition: Matrix.h:277
Matrix & operator=(const Matrix &rhs)
Definition: Matrix.h:116
Base::const_iterator const_iterator
Definition: Matrix.h:64
SizeType rowIndex(SizeType index) const
Calculate the row from an index into the underlying vector. Note that Matrix uses the (row,...
Definition: Matrix.h:289
void setMatrix(const ValueType matrix[ROWS][COLS])
set matrix to 2D arrays values
Definition: Matrix.h:328
reference getValue(size_type const i, size_type const j)
Definition: Matrix.h:144
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:94
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22