eigenpy 3.12.0
Bindings between Numpy and Eigen using Boost.Python
Loading...
Searching...
No Matches
CholmodBase.hpp
1/*
2 * Copyright 2024 INRIA
3 */
4
5#ifndef __eigenpy_decomposition_sparse_cholmod_cholmod_base_hpp__
6#define __eigenpy_decomposition_sparse_cholmod_cholmod_base_hpp__
7
8#include "eigenpy/eigenpy.hpp"
9#include "eigenpy/eigen/EigenBase.hpp"
10#include "eigenpy/decompositions/sparse/SparseSolverBase.hpp"
11
12#include <Eigen/CholmodSupport>
13
14namespace eigenpy {
15
16template <typename CholdmodDerived>
18 : public boost::python::def_visitor<CholmodBaseVisitor<CholdmodDerived>> {
19 typedef CholdmodDerived Solver;
20
21 typedef typename CholdmodDerived::MatrixType MatrixType;
22 typedef typename MatrixType::Scalar Scalar;
23 typedef typename MatrixType::RealScalar RealScalar;
24 typedef MatrixType CholMatrixType;
25 typedef typename MatrixType::StorageIndex StorageIndex;
26
27 template <class PyClass>
28 void visit(PyClass &cl) const {
29 cl.def("analyzePattern", &Solver::analyzePattern,
30 bp::args("self", "matrix"),
31 "Performs a symbolic decomposition on the sparcity of matrix.\n"
32 "This function is particularly useful when solving for several "
33 "problems having the same structure.")
34
37
38 .def("compute",
39 (Solver & (Solver::*)(const MatrixType &matrix)) & Solver::compute,
40 bp::args("self", "matrix"),
41 "Computes the sparse Cholesky decomposition of a given matrix.",
42 bp::return_self<>())
43
44 .def("determinant", &Solver::determinant, bp::arg("self"),
45 "Returns the determinant of the underlying matrix from the "
46 "current factorization.")
47
48 .def("factorize", &Solver::factorize, bp::args("self", "matrix"),
49 "Performs a numeric decomposition of a given matrix.\n"
50 "The given matrix must has the same sparcity than the matrix on "
51 "which the symbolic decomposition has been performed.\n"
52 "See also analyzePattern().")
53
54 .def("info", &Solver::info, bp::arg("self"),
55 "NumericalIssue if the input contains INF or NaN values or "
56 "overflow occured. Returns Success otherwise.")
57
58 .def("logDeterminant", &Solver::logDeterminant, bp::arg("self"),
59 "Returns the log determinant of the underlying matrix from the "
60 "current factorization.")
61
62 .def("setShift", &Solver::setShift, (bp::args("self", "offset")),
63 "Sets the shift parameters that will be used to adjust the "
64 "diagonal coefficients during the numerical factorization.\n"
65 "During the numerical factorization, the diagonal coefficients "
66 "are transformed by the following linear model: d_ii = offset + "
67 "d_ii.\n"
68 "The default is the identity transformation with offset=0.",
69 bp::return_self<>());
70 }
71};
72
73} // namespace eigenpy
74
75#endif // ifndef __eigenpy_decomposition_sparse_cholmod_cholmod_base_hpp__