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>
383 template <
typename Value>
384 std::ostream& operator<<(std::ostream& os, const Matrix<Value>& matrix)
387 for (size_type i = 0; i < matrix.rows(); ++i)
389 for (size_type j = 0; j < matrix.cols(); ++j)
391 os << std::setprecision(6) << std::setw(6) << matrix(i, j) <<
' ';
Base::value_type value_type
Definition: Matrix.h:98
Base ContainerType
Definition: Matrix.h:105
const_iterator ConstIterator
Definition: Matrix.h:109
allocator_type AllocatorType
Definition: Matrix.h:119
value_type ValueType
Definition: Matrix.h:117
bool operator==(Matrix const &rhs) const
Equality comparator.
Definition: Matrix.h:329
Base::const_reference const_reference
Definition: Matrix.h:95
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
const_reference ConstReference
Definition: Matrix.h:114
Int overflow exception.
Definition: Exception.h:254
iterator Iterator
Definition: Matrix.h:111
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:106
Base::pointer pointer
Definition: Matrix.h:96
pointer Pointer
Definition: Matrix.h:115
reverse_iterator ReverseIterator
Definition: Matrix.h:112
Base::difference_type difference_type
Definition: Matrix.h:87
size_type SizeType
Definition: Matrix.h:107
const_reference operator()(size_type const i, size_type const j) const
Definition: Matrix.h:155
void resize(size_type i, size_type j, value_type value=value_type())
Definition: Matrix.h:243
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
~Matrix()
Definition: Matrix.h:150
bool operator<(Matrix const &rhs) const
Less-than comparator. Comparison is done lexicographically: first by row, then by column...
Definition: Matrix.h:343
Base::const_iterator const_iterator
Definition: Matrix.h:90
Matrix(const SizeType rows, const SizeType cols, ValueType value=ValueType())
Definition: Matrix.h:130
Base::iterator iterator
Definition: Matrix.h:92
std::vector< Value > Base
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:195
void resize(std::pair< Size, Size > const &size_pair, value_type value=value_type())
Definition: Matrix.h:250
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
std::pair< Size, Size > sizePair() const
Definition: Matrix.h:269
Matrix & operator=(const Matrix &rhs)
Definition: Matrix.h:142
reference Reference
Definition: Matrix.h:116
container_type row(size_type const i) const
Return the i-th row of the matrix as a vector.
Definition: Matrix.h:181
SizeType cols_
Number of columns (width of a row)
Definition: Matrix.h:373
Base::reverse_iterator reverse_iterator
Definition: Matrix.h:93
difference_type DifferenceType
Definition: Matrix.h:106
Base::reference reference
Definition: Matrix.h:97
Base::allocator_type allocator_type
Definition: Matrix.h:100
const_reverse_iterator ConstReverseIterator
Definition: Matrix.h:110
void assign(char &c_target, AAcid const &source)
Definition: AhoCorasickAmbiguous.h:179
reference operator()(size_type const i, size_type const j)
Definition: Matrix.h:160
SizeType cols() const
Number of columns.
Definition: Matrix.h:264
Base::size_type size_type
Definition: Matrix.h:88
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Base container_type
Definition: Matrix.h:85
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
void setValue(size_type const i, size_type const j, value_type value)
Definition: Matrix.h:175
Base::const_reverse_iterator const_reverse_iterator
Definition: Matrix.h:91
SizeType rows() const
Number of rows.
Definition: Matrix.h:258
const_reference getValue(size_type const i, size_type const j) const
Definition: Matrix.h:165
reference getValue(size_type const i, size_type const j)
Definition: Matrix.h:170
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
Matrix(const Matrix &source)
Definition: Matrix.h:136
Matrix()
Definition: Matrix.h:124
void clear()
Definition: Matrix.h:236
A two-dimensional matrix. Similar to std::vector, but uses a binary operator(,) for element access...
Definition: IsobaricQuantitationMethod.h:49
SizeType rows_
Number of rows (height of a column)
Definition: Matrix.h:371