BFGSPreconditioners.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 CNRS
3  * Copyright 2024 Inria
4  */
5 
6 #ifndef __eigenpy_bfgs_preconditioners_hpp__
7 #define __eigenpy_bfgs_preconditioners_hpp__
8 
9 #include <Eigen/IterativeLinearSolvers>
10 
11 #include "eigenpy/fwd.hpp"
13 
14 namespace eigenpy {
15 
16 template <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 
46 template <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_bfgs_preconditioners_hpp__
eigenpy::BFGSPreconditionerBaseVisitor::VectorType
Eigen::VectorXd VectorType
Definition: BFGSPreconditioners.hpp:19
eigenpy::BFGSPreconditionerBaseVisitor::expose
static void expose(const std::string &name)
Definition: BFGSPreconditioners.hpp:39
fwd.hpp
test_complex.rows
int rows
Definition: test_complex.py:4
eigenpy::LimitedBFGSPreconditionerBaseVisitor::visit
void visit(PyClass &cl) const
Definition: BFGSPreconditioners.hpp:51
BasicPreconditioners.hpp
eigenpy::BFGSPreconditionerBaseVisitor
Definition: BFGSPreconditioners.hpp:17
eigenpy
Definition: alignment.hpp:14
eigenpy::LimitedBFGSPreconditionerBaseVisitor::expose
static void expose(const std::string &name)
Definition: BFGSPreconditioners.hpp:59
eigenpy::IdVisitor
Add the Python method id to retrieving a unique id for a given object exposed with Boost....
Definition: id.hpp:18
eigenpy::LimitedBFGSPreconditionerBaseVisitor
Definition: BFGSPreconditioners.hpp:47
setup.name
name
Definition: setup.in.py:179
eigenpy::BFGSPreconditionerBaseVisitor::visit
void visit(PyClass &cl) const
Definition: BFGSPreconditioners.hpp:21
eigenpy::PreconditionerBaseVisitor
Definition: BasicPreconditioners.hpp:16
test_complex.cols
int cols
Definition: test_complex.py:5
test_CholmodSimplicialLDLT.dim
int dim
Definition: test_CholmodSimplicialLDLT.py:6


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Jun 14 2024 02:15:58