eigenpy
3.13.0
Bindings between Numpy and Eigen using Boost.Python
Toggle main menu visibility
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
14
namespace
eigenpy
{
15
16
template
<
typename
Preconditioner>
17
struct
BFGSPreconditionerBaseVisitor
18
:
public
bp::def_visitor<BFGSPreconditionerBaseVisitor<Preconditioner>> {
19
typedef
Eigen::VectorXd VectorType;
20
template
<
class
PyClass>
21
void
visit(PyClass& cl)
const
{
22
cl.def(
PreconditionerBaseVisitor<Preconditioner>
())
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)
41
.def(
IdVisitor<Preconditioner>
())
42
.def(
BFGSPreconditionerBaseVisitor<Preconditioner>
());
43
}
44
};
45
46
template
<
typename
Preconditioner>
47
struct
LimitedBFGSPreconditionerBaseVisitor
48
:
public
bp::def_visitor<
49
LimitedBFGSPreconditionerBaseVisitor<Preconditioner>> {
50
template
<
class
PyClass>
51
void
visit(PyClass& cl)
const
{
52
cl.def(
PreconditionerBaseVisitor<Preconditioner>
())
53
.def(
BFGSPreconditionerBaseVisitor<Preconditioner>
())
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)
61
.def(
IdVisitor<Preconditioner>
())
62
.def(
LimitedBFGSPreconditionerBaseVisitor<Preconditioner>
());
63
}
64
};
65
66
}
// namespace eigenpy
67
68
#endif
// ifndef __eigenpy_solvers_bfgs_preconditioners_hpp__
eigenpy
Definition
alignment.hpp:14
eigenpy::expose
void expose()
Call the expose function of a given type T.
Definition
expose.hpp:23
eigenpy::BFGSPreconditionerBaseVisitor
Definition
BFGSPreconditioners.hpp:18
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:49
eigenpy::PreconditionerBaseVisitor
Definition
BasicPreconditioners.hpp:17
include
eigenpy
solvers
BFGSPreconditioners.hpp
Generated by
1.17.0