LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
Provides "fast" matrix operations. More...
#include "FastMatrixMathHelper.h"
Public Types | |
using | Base_t = FastMatrixOperationsBase< T, DIM > |
using | Data_t = typename Base_t::Data_t |
using | Matrix_t = typename Base_t::Matrix_t |
using | Vector_t = std::array< Data_t, Dim > |
Static Public Member Functions | |
static Data_t | Determinant (Matrix_t const &mat) |
Computes the determinant of a matrix. More... | |
static Matrix_t | InvertMatrix (Matrix_t const &mat, Data_t det) |
Computes the determinant of a matrix, using the provided determinant. More... | |
static Matrix_t | InvertSymmetricMatrix (Matrix_t const &mat, Data_t det) |
static Matrix_t | InvertMatrix (Matrix_t const &mat) |
Computes the determinant of a matrix. More... | |
static Matrix_t | InvertSymmetricMatrix (Matrix_t const &mat) |
Computes the determinant of a matrix. More... | |
static Vector_t | MatrixVectorProduct (Matrix_t const &mat, Vector_t const &vec) |
Returns the product of a square matrix times a column vector. More... | |
static constexpr Data_t | sqr (Data_t v) |
Static Public Attributes | |
static constexpr unsigned int | Dim = DIM |
matrix dimensions More... | |
Provides "fast" matrix operations.
T | data type for the elements of the matrix |
DIM | the dimension of the (square) matrix |
Actually this class does nothing: specialize it!
Once the specialization is in place, this class offers:
constexpr unsigned int Dim = 2; std::array<float, Dim*Dim> matrix; float det = FastMatrixOperations<float, Dim>::Determinant(); std::array<float, Dim*Dim> inverse; // generic inversion inverse = FastMatrixOperations<float, Dim>::InvertMatrix(matrix); // faster inversion if we already have the determinant inverse = FastMatrixOperations<float, Dim>::InvertMatrix (matrix, det); // faster inversion if we know the matrix is symmetric inverse = FastMatrixOperations<float, Dim>::InvertSymmetricMatrix (matrix); // even faster inversion if we also know the determinant already inverse = FastMatrixOperations<float, Dim>::InvertSymmetricMatrix (matrix, det);
Note that the inversion functions do not have a defined policy for non-invertible matrices. If you need to check (and you usually do), compute the determinant first, and invert only if std::isnormal(det)
.
Definition at line 87 of file FastMatrixMathHelper.h.
using lar::util::details::FastMatrixOperations< T, DIM >::Base_t = FastMatrixOperationsBase<T, DIM> |
Definition at line 88 of file FastMatrixMathHelper.h.
using lar::util::details::FastMatrixOperations< T, DIM >::Data_t = typename Base_t::Data_t |
Definition at line 89 of file FastMatrixMathHelper.h.
using lar::util::details::FastMatrixOperations< T, DIM >::Matrix_t = typename Base_t::Matrix_t |
Definition at line 90 of file FastMatrixMathHelper.h.
|
inherited |
Definition at line 40 of file FastMatrixMathHelper.h.
|
static |
Computes the determinant of a matrix.
|
static |
Computes the determinant of a matrix, using the provided determinant.
Referenced by lar::util::details::FastMatrixOperations< T, 2 >::InvertSymmetricMatrix(), lar::util::details::FastMatrixOperations< T, 3 >::InvertSymmetricMatrix(), and lar::util::details::FastMatrixOperationsBase< T, DIM >::MatrixVectorProduct().
|
inlinestatic |
Computes the determinant of a matrix.
Definition at line 103 of file FastMatrixMathHelper.h.
|
static |
Computes the determinant of a symmatric matrix, using the provided determinant
Referenced by lar::util::details::FastMatrixOperations< T, 2 >::InvertMatrix(), lar::util::details::FastMatrixOperations< T, 3 >::InvertMatrix(), and lar::util::details::FastMatrixOperations< T, 4 >::InvertMatrix().
|
inlinestatic |
Computes the determinant of a matrix.
Definition at line 107 of file FastMatrixMathHelper.h.
|
staticinherited |
Returns the product of a square matrix times a column vector.
Definition at line 362 of file FastMatrixMathHelper.h.
References lar::util::details::FastMatrixOperationsBase< T, DIM >::Dim, and lar::util::details::FastMatrixOperations< T, DIM >::InvertMatrix().
Referenced by lar::util::details::FastMatrixOperations< T, 4 >::InvertSymmetricMatrix().
|
inlinestaticinherited |
Definition at line 47 of file FastMatrixMathHelper.h.
|
staticinherited |
matrix dimensions
Definition at line 37 of file FastMatrixMathHelper.h.
Referenced by lar::util::details::FastMatrixOperations< T, 2 >::InvertMatrix(), lar::util::details::FastMatrixOperations< T, 3 >::InvertMatrix(), lar::util::details::FastMatrixOperations< T, 4 >::InvertMatrix(), lar::util::details::FastMatrixOperations< T, 2 >::InvertSymmetricMatrix(), lar::util::details::FastMatrixOperations< T, 3 >::InvertSymmetricMatrix(), lar::util::details::FastMatrixOperations< T, 4 >::InvertSymmetricMatrix(), and lar::util::details::FastMatrixOperationsBase< T, DIM >::MatrixVectorProduct().