Class slamcore::Matrix
-
template<typename ScalarT = double, int RowsT = Dynamic, int ColsT = Dynamic>
class Matrix : public Dimensions<Dynamic, Dynamic> A column Major data representation of a matrix.
- Template Parameters
ScalarT –
RowsT –
ColsT –
Public Types
-
using IndexT = size_t
Public Functions
-
Matrix() = default
-
template<bool _IsDynamic = IsDynamic, typename std::enable_if<_IsDynamic, int>::type = 0>
inline Matrix(int rows, int cols)
-
template<int _RowsT, int _ColsT>
inline explicit Matrix(const Matrix<Scalar, _RowsT, _ColsT> &other) Construct a new Matrix object from another.
Note
This is only valid for dynamic matrices as they need to be resized
- Template Parameters
_RowsT – Compile-time rows of other matrix
_ColsT – Compile-time columns of other matrix
- Parameters
other – matrix to construct from
-
inline Matrix(std::initializer_list<std::initializer_list<ScalarT>> initList)
Construct a new Matrix object and initialise it with the values in the given initializer_list.
The inner list generally represents a row, so a 2x3 matrix can be constructed as follows: Matrix<double, Dynamic, Dynamic> matrix{{1, 2, 3}, {4, 5, 6}};
Column vectors are special cased so that they can be constructed with the transpose: Matrix<double, Dynamic, 1> vector{{1, 2, 3}}; // a 3 element column vector
- Parameters
initList – The elements to use to construct the matrix.
-
inline Scalar *begin()
Iterator to beginning of the sequence.
Note
Only valid for matrices with a dimension of 1 at compile time
-
inline Scalar *end()
Iterator to one-past-the-end of the sequence.
Note
Only valid for matrices with a dimension of 1 at compile time
-
inline const Scalar *begin() const
Const iterator to beginning of the sequence.
Note
Only valid for matrices with a dimension of 1 at compile time
Public Static Attributes
-
static constexpr bool IsVector = (IsCompileTimeColumnVector || IsCompileTimeRowVector)
- static constexpr auto CompileTimeSize = IsDynamic ? Dynamic : RowsT * ColsT