9template <
class LDLTtype>
11 using Scalar =
typename LDLTtype::Scalar;
16 const context::ConstMatrixRef &mat) {
17 return fac.compute(mat);
21 context::MatrixRef rhsAndX) {
22 return fac.solveInPlace(rhsAndX);
25 template <
typename RhsType>
26 static auto solve(
const LDLTtype &fac, RhsType &rhs) {
27 return fac.solve(rhs);
30 template <
typename... Args>
void visit(bp::class_<Args...> &cl)
const {
31 cl.def(
"compute",
compute_proxy, bp::return_internal_reference<>(),
34 .def(
"solve",
solve<Eigen::Ref<const VectorXs>>, (
"self"_a,
"rhs"))
35 .def(
"solve",
solve<Eigen::Ref<const MatrixXs>>, (
"self"_a,
"rhs"))
36 .def(
"matrixLDLT", &LDLTtype::matrixLDLT,
37 bp::return_value_policy<bp::return_by_value>(),
"self"_a,
38 "Get the current value of the decomposition matrix. This makes a "
45 using context::VectorXs;
51 bp::class_<BunchKaufman_t>(
"BunchKaufman", bp::no_init)
52 .def(bp::init<>(
"self"_a))
54 .def(
"pivots", &BunchKaufman_t::pivots, bp::return_internal_reference<>())
57 +[](
const BunchKaufman_t &bk) -> VectorXs {
return bk.subdiag(); });
60 bp::class_<BlockLDLT>(
"BlockLDLT", bp::no_init)
62 .def(
"print_sparsity", &BlockLDLT::print_sparsity,
"self"_a,
63 "Print the sparsity pattern of the matrix to factorize.");
64#ifdef PROXSUITE_NLP_USE_PROXSUITE_LDLT
66 bp::class_<ProxSuiteLDLT>(
67 "ProxSuiteLDLT",
"Wrapper around ProxSuite's custom LDLT.", bp::no_init)
Utility function to allocate an LDLT solver for the Newton iterations.
void exposeLdltRoutines()
Block sparsity-aware LDLT factorization algorithm.
A fast, recursive divide-and-conquer LDLT algorithm.
Use the LDLT from proxsuite.
static bool solveInPlace_proxy(const LDLTtype &fac, context::MatrixRef rhsAndX)
Eigen::Matrix< Scalar, -1, 1, Eigen::ColMajor > VectorXs
typename LDLTtype::Scalar Scalar
static auto solve(const LDLTtype &fac, RhsType &rhs)
Eigen::Matrix< Scalar, -1, -1, Eigen::ColMajor > MatrixXs
static LDLTtype & compute_proxy(LDLTtype &fac, const context::ConstMatrixRef &mat)
void visit(bp::class_< Args... > &cl) const