.. _program_listing_file__tmp_ws_src_eigenpy_include_eigenpy_solvers_BFGSPreconditioners.hpp: Program Listing for File BFGSPreconditioners.hpp ================================================ |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/eigenpy/include/eigenpy/solvers/BFGSPreconditioners.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2017, Justin Carpentier, LAAS-CNRS * * This file is part of eigenpy. * eigenpy is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * eigenpy is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. You should * have received a copy of the GNU Lesser General Public License along * with eigenpy. If not, see . */ #ifndef __eigenpy_bfgs_preconditioners_hpp__ #define __eigenpy_bfgs_preconditioners_hpp__ #include #include "eigenpy/fwd.hpp" #include "eigenpy/solvers/BasicPreconditioners.hpp" namespace eigenpy { template struct BFGSPreconditionerBaseVisitor : public bp::def_visitor > { typedef Eigen::VectorXd VectorType; template void visit(PyClass& cl) const { cl.def(PreconditionerBaseVisitor()) .def("rows", &Preconditioner::rows, "Returns the number of rows in the preconditioner.") .def("cols", &Preconditioner::cols, "Returns the number of cols in the preconditioner.") .def("dim", &Preconditioner::dim, "Returns the dimension of the BFGS preconditioner") .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()) .def("reset", &Preconditioner::reset, "Reset the BFGS estimate."); } static void expose(const std::string& name) { bp::class_(name, bp::no_init) .def(BFGSPreconditionerBaseVisitor()); } }; template struct LimitedBFGSPreconditionerBaseVisitor : public bp::def_visitor< LimitedBFGSPreconditionerBaseVisitor > { template void visit(PyClass& cl) const { cl.def(PreconditionerBaseVisitor()) .def(BFGSPreconditionerBaseVisitor()) .def("resize", &Preconditioner::resize, bp::arg("dim"), "Resizes the preconditionner with size dim.", bp::return_value_policy()); } static void expose(const std::string& name) { bp::class_(name.c_str(), bp::no_init) .def(LimitedBFGSPreconditionerBaseVisitor()); } }; } // namespace eigenpy #endif // ifndef __eigenpy_bfgs_preconditioners_hpp__