BFGSPreconditioners.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017, Justin Carpentier, LAAS-CNRS
3  *
4  * This file is part of eigenpy.
5  * eigenpy is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * eigenpy is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with eigenpy. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __eigenpy_bfgs_preconditioners_hpp__
18 #define __eigenpy_bfgs_preconditioners_hpp__
19 
20 #include "eigenpy/fwd.hpp"
21 #include <Eigen/IterativeLinearSolvers>
22 
24 
25 namespace eigenpy
26 {
27 
28  namespace bp = boost::python;
29 
30  template<typename Preconditioner>
32  : public bp::def_visitor< BFGSPreconditionerBaseVisitor<Preconditioner> >
33  {
34 
35  typedef Eigen::VectorXd VectorType;
36  template<class PyClass>
37  void visit(PyClass& cl) const
38  {
39  cl
41  .def("rows",&Preconditioner::rows,"Returns the number of rows in the preconditioner.")
42  .def("cols",&Preconditioner::cols,"Returns the number of cols in the preconditioner.")
43  .def("dim",&Preconditioner::dim,"Returns the dimension of the BFGS preconditioner")
44  .def("update",(const Preconditioner& (Preconditioner::*)(const VectorType &, const VectorType &) const)&Preconditioner::update,bp::args("s","y"),"Update the BFGS estimate of the matrix A.",bp::return_value_policy<bp::reference_existing_object>())
45  .def("reset",&Preconditioner::reset,"Reset the BFGS estimate.")
46  ;
47 
48  }
49 
50  static void expose(const std::string & name)
51  {
52  bp::class_<Preconditioner>(name,
53  bp::no_init)
55  ;
56 
57  }
58 
59  };
60 
61  template<typename Preconditioner>
63  : public bp::def_visitor< LimitedBFGSPreconditionerBaseVisitor<Preconditioner> >
64  {
65  template<class PyClass>
66  void visit(PyClass& cl) const
67  {
68  cl
71  .def("resize",&Preconditioner::resize,bp::arg("dim"),"Resizes the preconditionner with size dim.",bp::return_value_policy<bp::reference_existing_object>())
72  ;
73 
74  }
75 
76  static void expose(const std::string & name)
77  {
78  bp::class_<Preconditioner>(name.c_str(),
79  bp::no_init)
81  ;
82 
83  }
84 
85  };
86 
87 } // namespace eigenpy
88 
89 #endif // ifndef __eigenpy_bfgs_preconditioners_hpp__
static void expose(const std::string &name)
static void expose(const std::string &name)


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59