0.5.0
Loading...
Searching...
No Matches
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > Class Template Reference

Static sized KeyedMatrix. More...

Public Member Functions

KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > getSubMatrix (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys) const
 Returns a submatrix specified by the row and col keys.
KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > inverse () const
 Calculates the inverse matrix.
template<typename Derived>
 KeyedMatrix (const Eigen::MatrixBase< Derived > &matrix, std::span< const RowKeyType > keys)
 Symmetric matrix constructor.
template<typename Derived>
 KeyedMatrix (const Eigen::MatrixBase< Derived > &matrix, std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys)
 Non-symmetric matrix constructor.
 KeyedMatrix (const KeyedMatrix &other)
 Copy constructor.
 KeyedMatrix (const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > &other)
 Copy constructor.
 KeyedMatrix (KeyedMatrix &&other) noexcept
 Move constructor.
 KeyedMatrix (KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > &&other) noexcept
 Move constructor.
KeyedMatrixoperator= (const KeyedMatrix &other)
 Copy assignment operator.
KeyedMatrixoperator= (const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > &other)
 Copy assignment operator.
KeyedMatrixoperator= (KeyedMatrix &&other) noexcept
 Move assignment operator.
KeyedMatrixoperator= (KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > &&other) noexcept
 Move assignment operator.
KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > transposed () const
 Calculates the transposed matrix.
 ~KeyedMatrix ()=default
 Destructor.
Public Member Functions inherited from NAV::internal::KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, Rows, Cols >
Eigen::Matrix< Scalar, Rows, Cols > & block (all_t, all_t)
 Requests the full matrix.
const Eigen::Matrix< Scalar, Rows, Cols > & block (all_t, all_t) const
 Requests the full matrix.
template<size_t Q>
decltype(auto) block (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
decltype(auto) block (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
template<size_t Q>
decltype(auto) block (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
decltype(auto) block (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
template<size_t P>
decltype(auto) block (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey)
 Gets the values for the row and col keys.
decltype(auto) block (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey)
 Gets the values for the row and col keys.
template<size_t P>
decltype(auto) block (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey) const
 Gets the values for the row and col keys.
decltype(auto) block (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey) const
 Gets the values for the row and col keys.
template<size_t P, size_t Q = P>
decltype(auto) block (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
decltype(auto) block (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
template<size_t P, size_t Q = P>
decltype(auto) block (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
decltype(auto) block (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
decltype(auto) col (const ColKeyType &colKey)
 Gets the values for the col key.
decltype(auto) col (const ColKeyType &colKey) const
 Gets the values for the col key.
KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, Rows, Cols > inverse () const
 Calculates the inverse matrix.
template<typename Derived>
 KeyedMatrixBase (const Eigen::MatrixBase< Derived > &matrix)
 Constructor.
template<typename Derived>
 KeyedMatrixBase (const Eigen::MatrixBase< Derived > &matrix, std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys)
 Non-symmetric matrix constructor.
 KeyedMatrixBase (const KeyedMatrixBase &other)
 Copy constructor.
template<int oRows, int oCols>
 KeyedMatrixBase (const KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, oRows, oCols > &other)
 Copy constructor.
 KeyedMatrixBase (KeyedMatrixBase &&other) noexcept
 Move constructor.
template<int oRows, int oCols>
 KeyedMatrixBase (KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, oRows, oCols > &&other) noexcept
 Move constructor.
template<size_t Q>
decltype(auto) middleCols (std::span< const ColKeyType > colKeys)
 Gets the values for the col keys.
decltype(auto) middleCols (std::span< const ColKeyType > colKeys)
 Gets the values for the col keys.
template<size_t Q>
decltype(auto) middleCols (std::span< const ColKeyType > colKeys) const
 Gets the values for the col keys.
decltype(auto) middleCols (std::span< const ColKeyType > colKeys) const
 Gets the values for the col keys.
template<size_t P>
decltype(auto) middleRows (std::span< const RowKeyType > rowKeys)
 Gets the values for the row keys.
decltype(auto) middleRows (std::span< const RowKeyType > rowKeys)
 Gets the values for the row keys.
template<size_t P>
decltype(auto) middleRows (std::span< const RowKeyType > rowKeys) const
 Gets the values for the row keys.
decltype(auto) middleRows (std::span< const RowKeyType > rowKeys) const
 Gets the values for the row keys.
 operator Eigen::Matrix< Scalar, Rows, Cols > ()
 Conversion into Eigen::Matrix.
Eigen::Matrix< Scalar, Rows, Cols > & operator() (all_t, all_t)
 Requests the full matrix.
const Eigen::Matrix< Scalar, Rows, Cols > & operator() (all_t, all_t) const
 Requests the full matrix.
decltype(auto) operator() (all_t, const ColKeyType &colKey)
 Gets the values for the col keys.
decltype(auto) operator() (all_t, const ColKeyType &colKey) const
 Gets the values for the col key.
decltype(auto) operator() (all_t, std::span< const ColKeyType > colKeys)
 Gets the values for the col keys.
decltype(auto) operator() (all_t, std::span< const ColKeyType > colKeys) const
 Gets the values for the col keys.
decltype(auto) operator() (const RowKeyType &rowKey, all_t)
 Gets the values for the row key.
decltype(auto) operator() (const RowKeyType &rowKey, all_t) const
 Gets the values for the row key.
Scalar & operator() (const RowKeyType &rowKey, const ColKeyType &colKey)
 Gets the value for the row and col key.
const Scalar & operator() (const RowKeyType &rowKey, const ColKeyType &colKey) const
 Gets the value for the row and col key.
decltype(auto) operator() (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
decltype(auto) operator() (const RowKeyType &rowKey, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, all_t)
 Gets the values for the row keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, all_t) const
 Gets the values for the row keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey)
 Gets the values for the row and col keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, const ColKeyType &colKey) const
 Gets the values for the row and col keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys)
 Gets the values for the row and col keys.
decltype(auto) operator() (std::span< const RowKeyType > rowKeys, std::span< const ColKeyType > colKeys) const
 Gets the values for the row and col keys.
KeyedMatrixBaseoperator= (const KeyedMatrixBase &other)
 Copy assignment operator.
template<int oRows, int oCols>
KeyedMatrixBaseoperator= (const KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, oRows, oCols > &other)
 Copy assignment operator.
KeyedMatrixBaseoperator= (KeyedMatrixBase &&other) noexcept
 Move assignment operator.
template<int oRows, int oCols>
KeyedMatrixBaseoperator= (KeyedMatrixBase< Scalar, RowKeyType, ColKeyType, oRows, oCols > &&other) noexcept
 Move assignment operator.
decltype(auto) row (const RowKeyType &rowKey)
 Gets the values for the row key.
decltype(auto) row (const RowKeyType &rowKey) const
 Gets the values for the row key.
KeyedMatrixBase< Scalar, ColKeyType, RowKeyType, Cols, Rows > transposed () const
 Calculates the transposed matrix.
 ~KeyedMatrixBase ()=default
 Destructor.
Public Member Functions inherited from NAV::internal::KeyedMatrixRowsBase< Scalar, RowKeyType, Rows, Cols >
bool hasAnyRows (std::span< const RowKeyType > keys) const
 Checks if the matrix has any key.
bool hasRow (const RowKeyType &key) const
 Checks if the matrix has the key.
bool hasRows (std::span< const RowKeyType > keys) const
 Checks if the matrix has multiple keys.
void replaceRowKey (const RowKeyType &oldKey, const RowKeyType &newKey)
 Replace the old with the new key.
const std::vector< RowKeyType > & rowKeys () const
 Returns the row keys.
decltype(auto) rows () const
 Return the rows of the underlying Eigen matrix.
Public Member Functions inherited from NAV::internal::KeyedMatrixColsBase< Scalar, ColKeyType, Rows, Cols >
const std::vector< ColKeyType > & colKeys () const
 Returns the col keys.
decltype(auto) cols () const
 Return the cols of the underlying Eigen matrix.
bool hasAnyCols (std::span< const ColKeyType > keys) const
 Checks if the matrix has any keys.
bool hasCol (const ColKeyType &key) const
 Checks if the matrix has the key.
bool hasCols (std::span< const ColKeyType > keys) const
 Checks if the matrix has multiple keys.
void replaceColKey (const ColKeyType &oldKey, const ColKeyType &newKey)
 Replace the old with the new key.

Additional Inherited Members

Protected Attributes inherited from NAV::internal::KeyedMatrixRowsBase< Scalar, RowKeyType, Rows, Cols >
unordered_map< RowKeyType, Eigen::Index > rowIndices
 RowKey to Row Index mapping.
std::vector< RowKeyType > rowKeysVector
 Row Keys.
std::vector< Eigen::Index > rowSlice
 Row Slice used for accessing.
Protected Attributes inherited from NAV::internal::KeyedMatrixStorage< Scalar, Rows, Cols >
std::mutex _sliceMutex
 Mutex for accessing the slices.
Eigen::Matrix< Scalar, Rows, Cols > matrix
 Data storage of the type.
Protected Attributes inherited from NAV::internal::KeyedMatrixColsBase< Scalar, ColKeyType, Rows, Cols >
unordered_map< ColKeyType, Eigen::Index > colIndices
 ColKey to Col Index mapping.
std::vector< ColKeyType > colKeysVector
 Col Keys.
std::vector< Eigen::Index > colSlice
 Col Slice used for accessing.

Detailed Description

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
class NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >

Static sized KeyedMatrix.

Template Parameters
ScalarNumeric type, e.g. float, double, int or std::complex<float>.
RowKeyTypeType of the key used for row lookup
ColKeyTypeType of the key used for col lookup
RowsNumber of rows, or Dynamic
ColsNumber of columns, or Dynamic

Definition at line 1920 of file KeyedMatrix.hpp.

Constructor & Destructor Documentation

◆ KeyedMatrix() [1/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
template<typename Derived>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( const Eigen::MatrixBase< Derived > & matrix,
std::span< const RowKeyType > rowKeys,
std::span< const ColKeyType > colKeys )
inline

Non-symmetric matrix constructor.

Template Parameters
DerivedDerived Eigen Type
Parameters
matrixEigen matrix to initialize from
rowKeysRow keys describing the matrix
colKeysCol keys describing the matrix

Definition at line 1929 of file KeyedMatrix.hpp.

◆ KeyedMatrix() [2/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
template<typename Derived>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( const Eigen::MatrixBase< Derived > & matrix,
std::span< const RowKeyType > keys )
inline

Symmetric matrix constructor.

Template Parameters
DerivedDerived Eigen Type
Parameters
matrixEigen matrix to initialize from
keysRow and col keys describing the matrix

Definition at line 1938 of file KeyedMatrix.hpp.

◆ ~KeyedMatrix()

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::~KeyedMatrix ( )
default

Destructor.

◆ KeyedMatrix() [3/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > & other)
inline

Copy constructor.

Parameters
otherThe other object

Definition at line 1950 of file KeyedMatrix.hpp.

◆ KeyedMatrix() [4/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > && other)
inlinenoexcept

Move constructor.

Parameters
otherThe other object

Definition at line 1966 of file KeyedMatrix.hpp.

◆ KeyedMatrix() [5/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > & other)
inline

Copy constructor.

Parameters
otherThe other object

Definition at line 1987 of file KeyedMatrix.hpp.

◆ KeyedMatrix() [6/6]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::KeyedMatrix ( KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > && other)
inlinenoexcept

Move constructor.

Parameters
otherThe other object

Definition at line 2007 of file KeyedMatrix.hpp.

Member Function Documentation

◆ getSubMatrix()

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::getSubMatrix ( std::span< const RowKeyType > rowKeys,
std::span< const ColKeyType > colKeys ) const
inlinenodiscard

Returns a submatrix specified by the row and col keys.

Parameters
rowKeysRow keys
colKeysCol keys

Definition at line 2034 of file KeyedMatrix.hpp.

◆ inverse()

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::inverse ( ) const
inlinenodiscard

Calculates the inverse matrix.

Definition at line 2052 of file KeyedMatrix.hpp.

◆ operator=() [1/4]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix & NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::operator= ( const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > & other)
inline

Copy assignment operator.

Parameters
otherThe other object

Definition at line 1955 of file KeyedMatrix.hpp.

◆ operator=() [2/4]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix & NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::operator= ( const KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > & other)
inline

Copy assignment operator.

Parameters
otherThe other object

Definition at line 1994 of file KeyedMatrix.hpp.

◆ operator=() [3/4]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix & NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::operator= ( KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > && other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe other object

Definition at line 1971 of file KeyedMatrix.hpp.

◆ operator=() [4/4]

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix & NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::operator= ( KeyedMatrix< Scalar, RowKeyType, ColKeyType, Eigen::Dynamic, Eigen::Dynamic > && other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe other object

Definition at line 2014 of file KeyedMatrix.hpp.

◆ transposed()

template<typename Scalar, typename RowKeyType, typename ColKeyType, int Rows, int Cols>
KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols > NAV::KeyedMatrix< Scalar, RowKeyType, ColKeyType, Rows, Cols >::transposed ( ) const
inlinenodiscard

Calculates the transposed matrix.

Definition at line 2045 of file KeyedMatrix.hpp.


The documentation for this class was generated from the following file: