Line data Source code
1 : #ifndef F7AF931D_0015_4C1A_B736_EB108A3CB8D5
2 : #define F7AF931D_0015_4C1A_B736_EB108A3CB8D5
3 :
4 : #include "conversions.h"
5 : #include "math/linalg/square_matrix.hpp" // IWYU pragma: keep
6 : #include "math/linalg/triangular_matrix.hpp" // IWYU pragma: keep
7 :
8 : namespace tracking
9 : {
10 : namespace math
11 : {
12 : namespace conversions
13 : {
14 :
15 : /// \brief Creates a TriangularMatrix from a SquareMatrix
16 : ///
17 : /// This function extracts the triangular part from a square matrix to create a triangular matrix.
18 : /// The triangular structure (upper or lower) is determined by the IsLower_ template parameter.
19 : ///
20 : /// \tparam ValueType_ The atomic data type of internal elements
21 : /// \tparam Size_ The dimension of the matrixes
22 : /// \tparam IsLower_ Whether to extract lower triangular (true) or upper triangular (false) part
23 : /// \tparam IsRowMajor_ The storage layout
24 : /// \param[in] mat The source square matrix
25 : /// \return TriangularMatrix containing the triangular part of the input matrix
26 : /// \see TriangularFromList() for creating from initializer lists
27 : /// \see DiagonalFromSquare() for extracting diagonal elements
28 : template <typename ValueType_, sint32 Size_, bool IsLower_, bool IsRowMajor_>
29 13 : inline auto TriangularFromSquare(const SquareMatrix<ValueType_, Size_, IsRowMajor_>& mat)
30 : -> TriangularMatrix<ValueType_, Size_, IsLower_, IsRowMajor_>
31 : {
32 13 : return TriangularMatrix<ValueType_, Size_, IsLower_, IsRowMajor_>{mat};
33 : }
34 :
35 : } // namespace conversions
36 : } // namespace math
37 : } // namespace tracking
38 :
39 : #endif // F7AF931D_0015_4C1A_B736_EB108A3CB8D5
|