13 #ifndef ML_FLOATING_POINT_MATRIX_H
14 #define ML_FLOATING_POINT_MATRIX_H
33 template <
class VectorT,
size_t size>
45 enum { RowCount = size };
49 enum { ColumnCount = VectorT::Size };
53 enum { ComponentCount =
static_cast<int>(RowCount)*ColumnCount };
98 template <
class VectorT,
size_t size>
110 template <
class VectorT,
size_t size>
122 template <
class VectorT,
size_t size>
125 if (idx < ComponentCount) {
126 return v[idx/VectorT::Size][idx%VectorT::Size];
135 template <
class VectorT,
size_t size>
138 typename VectorT::ComponentType retVal = v[0][0];
139 if (idx < ComponentCount) {
140 retVal = v[idx/VectorT::Size][idx%VectorT::Size];
149 template <
class VectorT,
size_t size>
152 typename VectorT::ComponentType retVal = 0;
153 for (
size_t i=0;i<RowCount;i++) {
154 for (
size_t j=0;j<ColumnCount;j++) {
155 retVal +=
MLAbs(v[i][j]);
163 template <
class VectorT,
size_t size>
167 for (
size_t i=0;i<RowCount;i++) {
168 for (
size_t j=0;j<ColumnCount;j++) {
169 v[i][j] = values[n++];
176 template <
class VectorT,
size_t size>
180 for (
size_t i=0;i<RowCount;i++) {
181 for (
size_t j=0;j<ColumnCount;j++) {
182 values[n++] = v[i][j];
Base class of all matrix classes that holds the data buffer and provides some general access methods.
ComponentType linearIndexedConst(const size_t idx) const
VectorT::ComponentType ComponentType
A typedef to 'export' the type of subcomponents.
const VectorT & operator[](const size_t i) const
VectorT & operator[](const size_t i)
VectorT VectorType
A typedef to 'export' the type of component vector.
void getValuesToPtr(ComponentType *values) const
Copies contents of *this into an array matrix, row by row; type and size must match.
void setValuesFromPtr(const ComponentType *const values)
Copies the contents from an array matrix into *this, row by row; type and size must match.
ComponentType compAbsSum() const
ComponentType & linearIndexed(const size_t idx)
DT MLAbs(const DT val)
Defines a templated MLAbs version to circumvent fabs ambiguities on different platforms.
#define ML_BAD_INDEX
The index given to the algorithm is out of range.
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)