eigenpy 3.12.0
Bindings between Numpy and Eigen using Boost.Python
Loading...
Searching...
No Matches
BFGSPreconditioners.hpp
1/*
2 * Copyright 2017 CNRS
3 * Copyright 2024-2025 INRIA
4 */
5
6#ifndef __eigenpy_solvers_bfgs_preconditioners_hpp__
7#define __eigenpy_solvers_bfgs_preconditioners_hpp__
8
9#include <Eigen/IterativeLinearSolvers>
10
11#include "eigenpy/fwd.hpp"
12#include "eigenpy/solvers/BasicPreconditioners.hpp"
13
14namespace eigenpy {
15
16template <typename Preconditioner>
18 : public bp::def_visitor<BFGSPreconditionerBaseVisitor<Preconditioner>> {
19 typedef Eigen::VectorXd VectorType;
20 template <class PyClass>
21 void visit(PyClass& cl) const {
23 .def("rows", &Preconditioner::rows,
24 "Returns the number of rows in the preconditioner.")
25 .def("cols", &Preconditioner::cols,
26 "Returns the number of cols in the preconditioner.")
27 .def("dim", &Preconditioner::dim,
28 "Returns the dimension of the BFGS preconditioner")
29 .def("update",
30 (const Preconditioner& (Preconditioner::*)(const VectorType&,
31 const VectorType&)
32 const) &
33 Preconditioner::update,
34 bp::args("s", "y"), "Update the BFGS estimate of the matrix A.",
35 bp::return_value_policy<bp::reference_existing_object>())
36 .def("reset", &Preconditioner::reset, "Reset the BFGS estimate.");
37 }
38
39 static void expose(const std::string& name) {
40 bp::class_<Preconditioner>(name, bp::no_init)
43 }
44};
45
46template <typename Preconditioner>
48 : public bp::def_visitor<
49 LimitedBFGSPreconditionerBaseVisitor<Preconditioner>> {
50 template <class PyClass>
51 void visit(PyClass& cl) const {
54 .def("resize", &Preconditioner::resize, bp::arg("dim"),
55 "Resizes the preconditionner with size dim.",
56 bp::return_value_policy<bp::reference_existing_object>());
57 }
58
59 static void expose(const std::string& name) {
60 bp::class_<Preconditioner>(name.c_str(), bp::no_init)
63 }
64};
65
66} // namespace eigenpy
67
68#endif // ifndef __eigenpy_solvers_bfgs_preconditioners_hpp__
void expose()
Call the expose function of a given type T.
Definition expose.hpp:23
Add the Python method id to retrieving a unique id for a given object exposed with Boost....
Definition id.hpp:18