sparse/LDLT.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024 INRIA
3  */
4 
5 #ifndef __eigenpy_decompositions_sparse_ldlt_hpp__
6 #define __eigenpy_decompositions_sparse_ldlt_hpp__
7 
8 #include "eigenpy/eigenpy.hpp"
11 
12 namespace eigenpy {
13 
14 template <typename _MatrixType, int _UpLo = Eigen::Lower,
15  typename _Ordering =
16  Eigen::AMDOrdering<typename _MatrixType::StorageIndex> >
18  : public boost::python::def_visitor<
19  SimplicialLDLTVisitor<_MatrixType, _UpLo, _Ordering> > {
21  typedef _MatrixType MatrixType;
22 
23  typedef Eigen::SimplicialLDLT<MatrixType> Solver;
24  typedef typename MatrixType::Scalar Scalar;
25  typedef typename MatrixType::RealScalar RealScalar;
26  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, MatrixType::Options>
28  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic,
29  MatrixType::Options>
31 
32  template <class PyClass>
33  void visit(PyClass &cl) const {
34  cl.def(bp::init<>(bp::arg("self"), "Default constructor"))
35  .def(bp::init<MatrixType>(bp::args("self", "matrix"),
36  "Constructs and performs the LDLT "
37  "factorization from a given matrix."))
38 
39  .def("vectorD", &vectorD, bp::arg("self"),
40  "Returns the diagonal vector D.")
42  }
43 
44  static void expose() {
45  static const std::string classname =
46  "SimplicialLDLT_" + scalar_name<Scalar>::shortname();
47  expose(classname);
48  }
49 
50  static void expose(const std::string &name) {
51  bp::class_<Solver, boost::noncopyable>(
52  name.c_str(),
53  "A direct sparse LDLT Cholesky factorizations.\n\n"
54  "This class provides a LDL^T Cholesky factorizations of sparse "
55  "matrices that are selfadjoint and positive definite."
56  "The factorization allows for solving A.X = B where X and B can be "
57  "either dense or sparse.\n\n"
58  "In order to reduce the fill-in, a symmetric permutation P is applied "
59  "prior to the factorization such that the factorized matrix is P A "
60  "P^-1.",
61  bp::no_init)
62  .def(SimplicialLDLTVisitor())
63  .def(IdVisitor<Solver>());
64  }
65 
66  private:
67  static DenseVectorXs vectorD(const Solver &self) { return self.vectorD(); }
68 };
69 
70 } // namespace eigenpy
71 
72 #endif // ifndef __eigenpy_decompositions_sparse_ldlt_hpp__
scalar-name.hpp
eigenpy::SimplicialLDLTVisitor::vectorD
static DenseVectorXs vectorD(const Solver &self)
Definition: sparse/LDLT.hpp:67
eigenpy
Definition: alignment.hpp:14
eigenpy::SimplicialLDLTVisitor::DenseVectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, MatrixType::Options > DenseVectorXs
Definition: sparse/LDLT.hpp:27
eigenpy::scalar_name::shortname
static std::string shortname()
eigenpy::SimplicialLDLTVisitor::DenseMatrixXs
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, MatrixType::Options > DenseMatrixXs
Definition: sparse/LDLT.hpp:30
eigenpy::SimplicialLDLTVisitor::visit
void visit(PyClass &cl) const
Definition: sparse/LDLT.hpp:33
eigenpy::SimplicialLDLTVisitor::Visitor
SimplicialLDLTVisitor< _MatrixType, _UpLo, _Ordering > Visitor
Definition: sparse/LDLT.hpp:20
SimplicialCholesky.hpp
eigenpy::SimplicialLDLTVisitor::Solver
Eigen::SimplicialLDLT< MatrixType > Solver
Definition: sparse/LDLT.hpp:23
eigenpy::SimplicialLDLTVisitor::expose
static void expose()
Definition: sparse/LDLT.hpp:44
eigenpy::IdVisitor
Add the Python method id to retrieving a unique id for a given object exposed with Boost....
Definition: id.hpp:18
eigenpy::SimplicialLDLTVisitor
Definition: sparse/LDLT.hpp:17
eigenpy::SimplicialLDLTVisitor::expose
static void expose(const std::string &name)
Definition: sparse/LDLT.hpp:50
setup.name
name
Definition: setup.in.py:179
eigenpy.hpp
eigenpy::SimplicialLDLTVisitor::Scalar
MatrixType::Scalar Scalar
Definition: sparse/LDLT.hpp:24
eigenpy::SimplicialLDLTVisitor::MatrixType
_MatrixType MatrixType
Definition: sparse/LDLT.hpp:21
eigenpy::SimplicialCholeskyVisitor
Definition: SimplicialCholesky.hpp:17
eigenpy::SimplicialLDLTVisitor::RealScalar
MatrixType::RealScalar RealScalar
Definition: sparse/LDLT.hpp:25


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Nov 2 2024 02:14:45