13#ifndef ML_FLOATING_POINT_MATRIX_H
14#define ML_FLOATING_POINT_MATRIX_H
33template <
class VectorT,
size_t size>
45 enum { RowCount = size };
49 enum { ColumnCount = VectorT::Size };
53 enum { ComponentCount =
static_cast<int>(RowCount)*ColumnCount };
98template <
class VectorT,
size_t size>
110template <
class VectorT,
size_t size>
122template <
class VectorT,
size_t size>
125 if (
idx < ComponentCount) {
126 return v[
idx/VectorT::Size][
idx%VectorT::Size];
135template <
class VectorT,
size_t size>
138 typename VectorT::ComponentType
retVal = v[0][0];
139 if (
idx < ComponentCount) {
149template <
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++) {
163template <
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++];
176template <
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 which 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 sub-components.
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 array mat, row by row; type and size must match.
void setValuesFromPtr(const ComponentType *const values)
Copies contents from array mat 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 templated MLAbs version to circumvent fabs ambiguities on different platforms.
#define ML_BAD_INDEX
The index given to the algorithm is out of range; sometimes this is a programming error or a sloppy i...
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)