#include <Rodin/Math/SpatialMatrix.h>
template<class ScalarType>
SpatialMatrix class
Spatial matrix with bounded maximum dimensions.
| Template parameters | |
|---|---|
| ScalarType | The element type |
A dynamic-size matrix with maximum dimensions bounded by RODIN_MAXIMAL_SPACE_DIMENSION. Used for geometric transformations, Jacobians, and other spatial operators to optimize memory allocation.
Typical uses:
- Jacobian matrices:
- Metric tensors
- Local coordinate transformations
Public functions
- auto solve(const SpatialVector<ScalarType>& b) const -> SpatialVector<ScalarType> noexcept
- Solves the linear system .
- auto row(std::uint8_t i) const -> SpatialVector<Scalar> constexpr noexcept
- Extracts the -th row as a SpatialVector.
- auto col(std::uint8_t j) const -> SpatialVector<Scalar> constexpr noexcept
- Extracts the -th column as a SpatialVector.
- auto pseudoInverse() const -> SpatialMatrix constexpr noexcept
- Computes the Moore-Penrose pseudo-inverse.
- auto operator*=(const Scalar& s) -> SpatialMatrix& constexpr noexcept
- Scales all elements by a scalar.
- auto operator*=(const SpatialMatrix& rhs) -> SpatialMatrix& constexpr noexcept
- In-place matrix multiplication.
Function documentation
template<class ScalarType>
SpatialVector<ScalarType> Rodin:: Math:: SpatialMatrix<ScalarType>:: solve(const SpatialVector<ScalarType>& b) const noexcept
Solves the linear system .
| Parameters | |
|---|---|
| b in | Right-hand side vector |
| Returns | Solution vector |
Uses Cramer's rule for small systems (1×1, 2×2, 3×3). The matrix must be square and non-singular.
template<class ScalarType>
SpatialVector<Scalar> Rodin:: Math:: SpatialMatrix<ScalarType>:: row(std::uint8_t i) const constexpr noexcept
Extracts the -th row as a SpatialVector.
| Parameters | |
|---|---|
| i in | Row index (0-based) |
| Returns | Row vector of length cols() |
template<class ScalarType>
SpatialVector<Scalar> Rodin:: Math:: SpatialMatrix<ScalarType>:: col(std::uint8_t j) const constexpr noexcept
Extracts the -th column as a SpatialVector.
| Parameters | |
|---|---|
| j in | Column index (0-based) |
| Returns | Column vector of length rows() |
template<class ScalarType>
SpatialMatrix Rodin:: Math:: SpatialMatrix<ScalarType>:: pseudoInverse() const constexpr noexcept
Computes the Moore-Penrose pseudo-inverse.
| Returns | The pseudo-inverse |
|---|
For full column rank matrices ( ), computes . For full row rank matrices ( ), computes .
template<class ScalarType>
SpatialMatrix& Rodin:: Math:: SpatialMatrix<ScalarType>:: operator*=(const Scalar& s) constexpr noexcept
Scales all elements by a scalar.
| Parameters | |
|---|---|
| s in | Scalar multiplier |
| Returns | Reference to after scaling |
template<class ScalarType>
SpatialMatrix& Rodin:: Math:: SpatialMatrix<ScalarType>:: operator*=(const SpatialMatrix& rhs) constexpr noexcept
In-place matrix multiplication.
| Parameters | |
|---|---|
| rhs in | Right-hand side matrix |
| Returns | Reference to after multiplication |
Replaces with . Requires cols() == rhs.rows(). Handles self-multiplication safely.