74 template <
typename Value>
76 protected std::vector<Value>
79 typedef std::vector<Value>
Base;
144 Base::operator=(rhs);
167 return Base::operator[](
index(i, j));
172 return Base::operator[](
index(i, j));
177 Base::operator[](
index(i, j)) = value;
189 values[j] = Base::operator[](
index(i, j));
203 values[j] = Base::operator[](
index(j, i));
231 using Base::capacity;
232 using Base::max_size;
252 rows_ = size_pair.first;
253 cols_ = size_pair.second;
332 "Matrices have different row sizes.");
334 "Matrices have different column sizes.");
346 "Matrices have different row sizes.");
348 "Matrices have different column sizes.");
353 template <
int ROWS,
int COLS>
388 template <
typename Value>
396 os << std::setprecision(6) << std::setw(6) << matrix(i, j) <<
' ';
Int overflow exception.
Definition: Exception.h:247
A two-dimensional matrix. Similar to std::vector, but uses a binary operator(,) for element access.
Definition: Matrix.h:77
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:291
SizeType cols_
Number of columns (width of a row)
Definition: Matrix.h:378
Base::allocator_type allocator_type
Definition: Matrix.h:100
Base::iterator iterator
Definition: Matrix.h:92
const_reverse_iterator ConstReverseIterator
Definition: Matrix.h:110
Base::reverse_iterator reverse_iterator
Definition: Matrix.h:93
difference_type DifferenceType
Definition: Matrix.h:106
const Base & asVector()
Definition: Matrix.h:366
void resize(size_type i, size_type j, value_type value=value_type())
Definition: Matrix.h:243
std::ostream & operator<<(std::ostream &os, const Matrix< Value > &matrix)
Print the contents to a stream.
Definition: Matrix.h:389
~Matrix()
Definition: Matrix.h:150
container_type row(size_type const i) const
Return the i-th row of the matrix as a vector.
Definition: Matrix.h:181
Matrix(const SizeType rows, const SizeType cols, ValueType value=ValueType())
Definition: Matrix.h:130
Matrix()
Definition: Matrix.h:124
reverse_iterator ReverseIterator
Definition: Matrix.h:112
iterator Iterator
Definition: Matrix.h:111
reference Reference
Definition: Matrix.h:116
Base ContainerType
Definition: Matrix.h:105
container_type col(size_type const i) const
Return the i-th column of the matrix as a vector.
Definition: Matrix.h:195
reference operator()(size_type const i, size_type const j)
Definition: Matrix.h:160
Base::const_reverse_iterator const_reverse_iterator
Definition: Matrix.h:91
SizeType rows() const
Number of rows.
Definition: Matrix.h:258
const_iterator ConstIterator
Definition: Matrix.h:109
bool operator<(Matrix const &rhs) const
Less-than comparator. Comparison is done lexicographically: first by row, then by column.
Definition: Matrix.h:343
const_reference operator()(size_type const i, size_type const j) const
Definition: Matrix.h:155
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:278
Base::value_type value_type
Definition: Matrix.h:98
allocator_type AllocatorType
Definition: Matrix.h:119
value_type ValueType
Definition: Matrix.h:117
void resize(std::pair< Size, Size > const &size_pair, value_type value=value_type())
Definition: Matrix.h:250
bool operator==(Matrix const &rhs) const
Equality comparator.
Definition: Matrix.h:329
Base container_type
Definition: Matrix.h:85
Base::pointer pointer
Definition: Matrix.h:96
Base::difference_type difference_type
Definition: Matrix.h:87
std::pair< Size, Size > sizePair() const
Definition: Matrix.h:269
Matrix(const Matrix &source)
Definition: Matrix.h:136
size_type SizeType
Definition: Matrix.h:107
const_reference getValue(size_type const i, size_type const j) const
Definition: Matrix.h:165
Base::const_reference const_reference
Definition: Matrix.h:95
const_reference ConstReference
Definition: Matrix.h:114
std::vector< Value > Base
Definition: Matrix.h:79
SizeType cols() const
Number of columns.
Definition: Matrix.h:264
Base::reference reference
Definition: Matrix.h:97
SizeType rows_
Number of rows (height of a column)
Definition: Matrix.h:376
void clear()
Definition: Matrix.h:236
pointer Pointer
Definition: Matrix.h:115
void setValue(size_type const i, size_type const j, value_type value)
Definition: Matrix.h:175
Base::size_type size_type
Definition: Matrix.h:88
SizeType colIndex(SizeType index) const
Calculate the column from an index into the underlying vector. Note that Matrix uses the (row,...
Definition: Matrix.h:303
Matrix & operator=(const Matrix &rhs)
Definition: Matrix.h:142
Base::const_iterator const_iterator
Definition: Matrix.h:90
SizeType rowIndex(SizeType index) const
Calculate the row from an index into the underlying vector. Note that Matrix uses the (row,...
Definition: Matrix.h:315
void setMatrix(const ValueType matrix[ROWS][COLS])
set matrix to 2D arrays values
Definition: Matrix.h:354
reference getValue(size_type const i, size_type const j)
Definition: Matrix.h:170
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:120
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47