5#include <initializer_list>
9#include <iolink/IOLinkAPI.h>
19template <
typename ValueType,
size_t N>
56 explicit Matrix(
const ValueType* values);
75 Matrix(
const ValueType* values,
bool isRowMajor);
94 explicit Matrix(std::initializer_list<ValueType> init);
96 bool operator==(
const Matrix& other)
const;
97 bool operator!=(
const Matrix& other)
const;
105 ValueType
at(
size_t row,
size_t column)
const;
122 void setAt(
size_t row,
size_t column, ValueType value);
176 Matrix& operator*=(ValueType value);
177 Matrix& operator/=(ValueType value);
179 inline Matrix operator*(ValueType v)
const {
return Matrix(*
this) *= v; }
180 inline Matrix operator/(ValueType v)
const {
return Matrix(*
this) /= v; }
183 std::array<ValueType, N * N> m_data;
189template <
typename T,
size_t N>
201extern template class IOLINK_API_IMPORT Matrix<float, 3>;
202extern template class IOLINK_API_IMPORT Matrix<double, 3>;
204extern template class IOLINK_API_IMPORT Matrix<float, 4>;
205extern template class IOLINK_API_IMPORT Matrix<double, 4>;
An arithmetic square matrix.
Definition: Matrix.h:21
Matrix(std::initializer_list< ValueType > init)
Create a matrix giving initialization values.
ValueType operator()(size_t row, size_t column) const
Access an element of the matrix.
void transposeInPlace()
Transpose the matrix in place.
const ValueType * data() const
Exposes the internal data of the matrix, use it only if you know what you do.
static Matrix uniform(ValueType value)
Initialize an uniform matrix with an unique value.
Matrix()
Default constructor.
void setAt(size_t row, size_t column, ValueType value)
Set an element of the matrix.
ValueType at(size_t row, size_t column) const
Access an element of the matrix.
std::string toString() const
Return a string representation of the matrix.
ValueType * data()
Exposes the internal data of the matrix, use it only if you know what you do.
Matrix(const ValueType *values)
Constructor with C-array parameter.
Matrix(const ValueType *values, bool isRowMajor)
Constructor with C-array parameter.
static Matrix identity()
Return an identity matrix.
Matrix transpose() const
Return the transposed matrix.
All IOLink symbols are enclosed in this namespace.
Definition: ArrayX.h:8