.. _program_listing_file__tmp_ws_src_eigenpy_include_eigenpy_decompositions_sparse_LDLT.hpp: Program Listing for File LDLT.hpp ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/eigenpy/include/eigenpy/decompositions/sparse/LDLT.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2024 INRIA */ #ifndef __eigenpy_decomposition_sparse_ldlt_hpp__ #define __eigenpy_decomposition_sparse_ldlt_hpp__ #include "eigenpy/eigenpy.hpp" #include "eigenpy/decompositions/sparse/SimplicialCholesky.hpp" #include "eigenpy/utils/scalar-name.hpp" namespace eigenpy { template > struct SimplicialLDLTVisitor : public boost::python::def_visitor< SimplicialLDLTVisitor<_MatrixType, _UpLo, _Ordering> > { typedef SimplicialLDLTVisitor<_MatrixType, _UpLo, _Ordering> Visitor; typedef _MatrixType MatrixType; typedef Eigen::SimplicialLDLT Solver; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Eigen::Matrix DenseVectorXs; typedef Eigen::Matrix DenseMatrixXs; template void visit(PyClass &cl) const { cl.def(bp::init<>(bp::arg("self"), "Default constructor")) .def(bp::init(bp::args("self", "matrix"), "Constructs and performs the LDLT " "factorization from a given matrix.")) .def("vectorD", &vectorD, bp::arg("self"), "Returns the diagonal vector D.") .def(SimplicialCholeskyVisitor()); } static void expose() { static const std::string classname = "SimplicialLDLT_" + scalar_name::shortname(); expose(classname); } static void expose(const std::string &name) { bp::class_( name.c_str(), "A direct sparse LDLT Cholesky factorizations.\n\n" "This class provides a LDL^T Cholesky factorizations of sparse " "matrices that are selfadjoint and positive definite." "The factorization allows for solving A.X = B where X and B can be " "either dense or sparse.\n\n" "In order to reduce the fill-in, a symmetric permutation P is applied " "prior to the factorization such that the factorized matrix is P A " "P^-1.", bp::no_init) .def(SimplicialLDLTVisitor()); } private: static DenseVectorXs vectorD(const Solver &self) { return self.vectorD(); } }; } // namespace eigenpy #endif // ifndef __eigenpy_decomposition_sparse_ldlt_hpp__