Template Struct MatImpl¶
Defined in File mat.hpp
Struct Documentation¶
-
template<typename
T
, typenameRows
, typenameCols
, typenameLayout
>
structripple
::
MatImpl
¶ The MatImpl class implements a matrix class with polymorphic data layout.
The data for the elements is allocated according to the layout, and can be contiguous, owned, or strided.
- Note
This class should not be used directly, use the Mat aliases.
- Template Parameters
T
: The type of the elements in the matrixRows
: The number of rows for the matrix.Cols
: The number of colums for the matrix.Layout
: The type of the storage layout for the matrix.
Public Functions
-
constexpr
MatImpl
() noexcept¶ Default constructor for the matrix.
-
constexpr
MatImpl
(T val) noexcept¶ Sets all elements of the matrix to the given value.
- Parameters
val
: The value to set all elements to.
-
template<typename ...
Values
, variadic_size_enable_t<elements, Values...> = 0>
constexprMatImpl
(Values&&... values) noexcept¶ Constructor to create the matrix from a list of values.
- Note
This overload is only enabled when the number of elements in the variadic parameter pack matches the number of elements in the matrix.
- Note
The types of the values must be convertible to T.
- Parameters
values
: The values to set the elements to.
- Template Parameters
Values
: The types of the values for setting.
-
constexpr
MatImpl
(Storage storage) noexcept¶ Constructor to set the matrix from other
storage
.- Parameters
other
: The other storage to use to set the matrix.
-
constexpr
MatImpl
(const MatImpl &other) noexcept¶ Copy constructor to set the matrix from another matrix.
- Parameters
other
: The other matrix to use to initialize this one.
-
constexpr
MatImpl
(MatImpl &&other) noexcept¶ Move constructor to set the matrix from another matrix.
- Parameters
other
: The other matrix to use to initialize this one.
-
template<typename
OtherLayout
>
constexprMatImpl
(const MatImpl<T, Rows, Cols, OtherLayout> &other) noexcept¶ Copy constructor to set the matrix from another matrix with a different storage layout.
- Parameters
other
: The other matrix to use to initialize this one.
- Template Parameters
OtherLayout
: The layout of the other storage.
-
template<typename
OtherLayout
>
constexprMatImpl
(MatImpl<T, Rows, Cols, OtherLayout> &&other)¶ Move constructor to set the matrix from another matrix with a different storage layout.
- Parameters
other
: The other matrix to use to initialize this one.
- Template Parameters
OtherLayout
: The layout of the other storage.
-
auto
operator=
(const MatImpl &other) noexcept -> MatImpl&¶ Overload of copy assignment overload to copy the elements from another matrix to this matrix.
- Return
A references to the modified matrix.
- Parameters
other
: The other matrix to copy from.
-
auto
operator=
(MatImpl &&other) noexcept -> MatImpl&¶ Overload of move assignment overload to move the elements from another matrix to this matrix.
- Return
A reference to the modified vector.
- Parameters
other
: The other matrix to move.
-
template<typename
OtherLayout
>
autooperator=
(const MatImpl<T, Rows, Cols, OtherLayout> &other) noexcept -> MatImpl&¶ Overload of copy assignment overload to copy the elements from another matrix with a different storage layout to this matrix.
- Return
A reference to the modified matrix.
- Parameters
other
: The other matrix to copy from.
- Template Parameters
OtherLayout
: The layout of the other matrix.
-
template<typename
OtherLayout
>
autooperator=
(MatImpl<T, Rows, Cols, OtherLayout> &&other) noexcept -> MatImpl&¶ Overload of move assignment overload to copy the elements from another matrix to this matrix.
- Return
A reference to the modified matrix.
- Parameters
other
: The other matrix to move.
- Template Parameters
OtherLayout
: The layout of the other matrix.
-
auto
operator()
(size_t row, size_t col) noexcept -> Value&¶ Overload of call operator to get the element at the given indices.
- Return
A reference to the element.
- Parameters
row
: The row of the element.col
: The column of the element.
-
auto
operator()
(size_t row, size_t col) const noexcept -> const Value&¶ Overload of call operator to get the element at the given indices.
- Return
A const reference to the element.
- Parameters
row
: The row of the element.col
: The column of the element.
-
constexpr auto
columns
() const noexcept -> size_t¶ Gets the number of columns for the matrix.
- Return
The number of columns for the matrix.
-
constexpr auto
rows
() const noexcept -> size_t¶ Gets the number of rows for the matrix.
- Return
The number of rows for the matrix.
-
template<size_t
Row
, size_tCol
>
constexpr autoat
() const noexcept -> const Value&¶ Gets the element at the row and column indices, where the offset to the element is computed at compile time.
- Return
A const reference to the element at position I.
- Template Parameters
Row
: The index of row for the element.
- Parameters
Col
: The index of the column for the element.
-
template<size_t
Row
, size_tCol
>
constexpr autoat
() const noexcept -> Value&¶ Gets the element in the Ith row and Jth column, where the offset to the element is computed at compile time.
- Return
A reference to the element at position I.
- Template Parameters
Row
: The index of row for the element.
- Parameters
Col
: The index of the column for the element.
-
constexpr auto
size
() const noexcept -> size_t¶ Gets the number of elements in the matrix.
- Return
The number of elements in the matrix.
Public Members
-
Storage
storage_
¶ The storage for the vector.