Template Class TinyMatrix¶
Defined in File tinymatrix.hpp
Class Documentation¶
-
template<class
ValueType, unsignedM, unsignedN= M, unsignedalign= alignof(ValueType)>
classqhipster::TinyMatrix¶ A small matrix with dimensions fixed at compile time.
The matrix is stored intenally as a two-dimensional C array, and thus in row-major ordering.
Public Types
-
using
size_type= unsigned¶ an integral type large enought to store the size of the matrix
Public Functions
-
TinyMatrix()¶ default-initizlize all matrix elements
-
template<class
U>TinyMatrix(std::initializer_list<std::initializer_list<U>> const &init)¶ initialize from an initializer list, i.e. a compile time given matrix
-
template<class
U, unsignedalignrhs>TinyMatrix(TinyMatrix<U, M, N, alignrhs> const &rhs)¶ copy from a matrix with a potentially different type and alignment
-
TinyMatrix(TinyMatrix const&) = default¶ the defaiult copy constructor
-
TinyMatrix &
operator=(TinyMatrix const&) = default¶ the default assignment
-
template<class
U, unsignedalignrhs>
TinyMatrix &operator=(TinyMatrix<U, M, N, alignrhs> const &rhs)¶ assign from a matrix with a potentially different type and alignment
-
template<class
U>
TinyMatrix &operator=(U const (&rhs)[M][N])¶ assign from a C-style array
-
constexpr size_type
size() const¶ the size of the matrix, i.e. the number of matrix elements. This is the same as number of rows times number of columns
-
value_type
operator()(unsigned i, unsigned j) const¶ access a matrix element of a const matrix
-
template<class
U, unsignedalignrhs>
booloperator==(TinyMatrix<U, M, N, alignrhs> const &rhs) const¶ compare two matrices element-wise for equality
-
template<class
U, unsignedalignrhs>
booloperator!=(TinyMatrix<U, M, N, alignrhs> const &rhs) const¶ compare two matrices element-wise for inequality
-
template<class
U>
booloperator==(U const (&rhs)[M][N])¶ compare two matrices element-wise for equality
-
template<class
U>
booloperator!=(U const (&rhs)[M][N])¶ compare two matrices element-wise for inequality
-
const_pointer
getPtr() const¶ obtain a pointer to the first element of the matrix
-
RowType &
operator[](unsigned i)¶ C-style array subscript
the TinyMatrix can be indexed both using the mat(i,j) syntax or the C-style mat[i][j] syntax
-
RowType const &
operator[](unsigned i) const¶ C-style array subscript for a const matrix
the TinyMatrix can be indexed both using the mat(i,j) syntax or the C-style mat[i][j] syntax
-
template<unsigned
MSub, unsignedNSub= MSub>
TinyMatrix<ValueType, MSub, NSub, align>getSubMatrix(unsigned i_start = 0, unsigned j_start = 0, unsigned i_stride = 1, unsigned j_stride = 1) const¶ Get submatrices
Returns the submatrix starting at i_start, j_start of size MSub, NSub using stride i_stride, j_stride
- Pre
Strides are strictly positive
- Pre
Parameters actually represent a submatrix (no index out of bounds)
- Parameters
i_start: The starting row index \þaram j_start The starting column indexi_stride: The row stride to use for accessing elementsj_stride: The column stride to use for accessing elements
- Template Parameters
MSub: The number of rows of the submatrixNSub: The number of columns of the submatrix
-
void
print(std::string name)¶
-
std::string
tostr() const¶
Public Members
-
std::string
name¶
-
using