13#ifndef ML_FLOATING_POINT_MATRIX_H
14#define ML_FLOATING_POINT_MATRIX_H
51 ColumnCount = VectorT::Size
57 ComponentCount =
static_cast<int>(RowCount) * ColumnCount
103template <
class VectorT,
size_t size>
126template <
class VectorT,
size_t size>
129 if (
idx < ComponentCount) {
130 return v[
idx / VectorT::Size][
idx % VectorT::Size];
140template <
class VectorT,
size_t size>
143 typename VectorT::ComponentType
retVal = v[0][0];
144 if (
idx < ComponentCount) {
149 "Using index 0 instead");
156template <
class VectorT,
size_t size>
159 typename VectorT::ComponentType
retVal = 0;
160 for (
size_t i = 0;
i < RowCount;
i++) {
161 for (
size_t j = 0;
j < ColumnCount;
j++) {
170template <
class VectorT,
size_t size>
174 for (
size_t i = 0;
i < RowCount;
i++) {
175 for (
size_t j = 0;
j < ColumnCount;
j++) {
176 v[
i][
j] = values[
n++];
183template <
class VectorT,
size_t size>
187 for (
size_t i = 0;
i < RowCount;
i++) {
188 for (
size_t j = 0;
j < ColumnCount;
j++) {
189 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.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)