5 #ifndef __eigenpy_decompositions_llt_hpp__
6 #define __eigenpy_decompositions_llt_hpp__
8 #include <Eigen/Cholesky>
17 template <
typename _MatrixType>
19 :
public boost::python::def_visitor<LLTSolverVisitor<_MatrixType> > {
21 typedef typename MatrixType::Scalar
Scalar;
23 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, MatrixType::Options>
25 typedef Eigen::Matrix<
Scalar, Eigen::Dynamic, Eigen::Dynamic,
28 typedef Eigen::LLT<MatrixType>
Solver;
30 template <
class PyClass>
32 cl.def(bp::init<>(bp::arg(
"self"),
"Default constructor"))
33 .def(bp::init<Eigen::DenseIndex>(
34 bp::args(
"self",
"size"),
35 "Default constructor with memory preallocation"))
36 .def(bp::init<MatrixType>(
37 bp::args(
"self",
"matrix"),
38 "Constructs a LLT factorization from a given matrix."))
42 .def(
"matrixL", &
matrixL, bp::arg(
"self"),
43 "Returns the lower triangular matrix L.")
44 .def(
"matrixU", &
matrixU, bp::arg(
"self"),
45 "Returns the upper triangular matrix U.")
46 .def(
"matrixLLT", &Solver::matrixLLT, bp::arg(
"self"),
47 "Returns the LLT decomposition matrix.",
48 bp::return_internal_reference<>())
50 #if EIGEN_VERSION_AT_LEAST(3, 3, 90)
53 Solver::template rankUpdate<VectorXs>,
54 bp::args(
"self",
"vector",
"sigma"), bp::return_self<>())
58 Solver::template rankUpdate<VectorXs>,
59 bp::args(
"self",
"vector",
"sigma"))
62 #if EIGEN_VERSION_AT_LEAST(3, 3, 0)
63 .def(
"adjoint", &Solver::adjoint, bp::arg(
"self"),
64 "Returns the adjoint, that is, a reference to the decomposition "
65 "itself as if the underlying matrix is self-adjoint.",
71 (
Solver & (
Solver::*)(
const Eigen::EigenBase<MatrixType> &matrix)) &
73 bp::args(
"self",
"matrix"),
"Computes the LLT of given matrix.",
76 .def(
"info", &Solver::info, bp::arg(
"self"),
77 "NumericalIssue if the input contains INF or NaN values or "
78 "overflow occured. Returns Success otherwise.")
79 #if EIGEN_VERSION_AT_LEAST(3, 3, 0)
80 .def(
"rcond", &Solver::rcond, bp::arg(
"self"),
81 "Returns an estimate of the reciprocal condition number of the "
84 .def(
"reconstructedMatrix", &Solver::reconstructedMatrix,
86 "Returns the matrix represented by the decomposition, i.e., it "
87 "returns the product: L L^*. This function is provided for debug "
89 .def(
"solve", &solve<VectorXs>, bp::args(
"self",
"b"),
90 "Returns the solution x of A x = b using the current "
91 "decomposition of A.")
92 .def(
"solve", &solve<MatrixXs>, bp::args(
"self",
"B"),
93 "Returns the solution X of A X = B using the current "
94 "decomposition of A where B is a right hand side matrix.");
98 static const std::string classname =
106 "Standard Cholesky decomposition (LL^T) of a matrix and associated "
108 "This class performs a LL^T Cholesky decomposition of a symmetric, "
109 "positive definite matrix A such that A = LL^* = U^*U, where L is "
110 "lower triangular.\n\n"
111 "While the Cholesky decomposition is particularly useful to solve "
112 "selfadjoint problems like D^*D x = b, for that purpose, we recommend "
113 "the Cholesky decomposition without square root which is more stable "
114 "and even faster. Nevertheless, this standard Cholesky decomposition "
115 "remains useful in many other situations like generalised eigen "
116 "problems with hermitian matrices.",
126 template <
typename MatrixOrVector>
128 return self.solve(
vec);
134 #endif // ifndef __eigenpy_decompositions_llt_hpp__