include
pinocchio
bindings
python
algorithm
delassus-operator.hpp
Go to the documentation of this file.
1
//
2
// Copyright (c) 2024 INRIA
3
//
4
5
#ifndef __pinocchio_python_algorithm_delssus_operator_hpp__
6
#define __pinocchio_python_algorithm_delssus_operator_hpp__
7
8
#include <
eigenpy/memory.hpp
>
9
#include "
pinocchio/algorithm/delassus-operator-base.hpp
"
10
11
namespace
pinocchio
12
{
13
namespace
python
14
{
15
namespace
bp
=
boost::python
;
16
17
template
<
typename
DelassusOperator>
18
struct
DelassusOperatorBasePythonVisitor
19
:
public
boost::python::def_visitor<DelassusOperatorBasePythonVisitor<DelassusOperator>>
20
{
21
typedef
DelassusOperator
Self
;
22
typedef
typename
DelassusOperator::Scalar
Scalar
;
23
typedef
context::MatrixXs
Matrix
;
24
typedef
typename
DelassusOperator::Vector
Vector
;
25
26
template
<
class
PyClass>
27
void
visit
(PyClass & cl)
const
28
{
29
cl
.def(bp::self * bp::other<Matrix>())
30
.def(
31
"__matmul__"
,
32
+[](
const
DelassusOperator &
self
,
const
Matrix
& other) ->
Matrix
{
33
return
self
* other;
34
},
35
bp::args(
"self"
,
"other"
),
36
"Matrix multiplication between self and another matrix. Returns the result of Delassus "
37
"* matrix."
)
38
39
.
def
(
40
"solve"
, &DelassusOperator::template solve<Matrix>, bp::args(
"self"
,
"mat"
),
41
"Returns the solution x of Delassus * x = mat using the current decomposition of "
42
"the Delassus matrix."
)
43
44
.
def
(
45
"computeLargestEigenValue"
,
46
(
Scalar
(DelassusOperator::*)(
const
bool
,
const
int
,
const
Scalar
)
47
const
)&DelassusOperator::computeLargestEigenValue,
48
(bp::arg(
"self"
), bp::arg(
"reset"
) =
true
, bp::arg(
"max_it"
) = 10,
49
bp::arg(
"prec"
) =
Scalar
(1e-8)),
50
"Compute the largest eigenvalue associated to the underlying Delassus matrix."
)
51
.def(
52
"computeLowestEigenValue"
,
53
(
Scalar
(DelassusOperator::*)(
const
bool,
const
bool,
const
int,
const
Scalar
)
54
const
)&DelassusOperator::computeLowestEigenValue,
55
(bp::arg(
"self"
), bp::arg(
"reset"
) =
true
, bp::arg(
"compute_largest"
) =
true
,
56
bp::arg(
"max_it"
) = 10, bp::arg(
"prec"
) =
Scalar
(1e-8)),
57
"Compute the lowest eigenvalue associated to the underlying Delassus matrix."
)
58
59
.def(
60
"updateDamping"
,
61
(
void
(DelassusOperator::*)(
const
Scalar
&)) & DelassusOperator::updateDamping,
62
bp::args(
"self"
,
"mu"
),
63
"Add a damping term to the diagonal of the Delassus matrix. The damping term should "
64
"be positive."
)
65
.
def
(
66
"updateDamping"
, &DelassusOperator::template updateDamping<Vector>,
67
bp::args(
"self"
,
"mus"
),
68
"Add a damping term to the diagonal of the Delassus matrix. The damping terms "
69
"should be all positive."
)
70
71
.
def
(
72
"matrix"
, &DelassusOperator::matrix, bp::arg(
"self"
),
73
"Returns the Delassus expression as a dense matrix."
)
74
.
def
(
75
"inverse"
, &
DelassusOperator::inverse
, bp::arg(
"self"
),
76
"Returns the inverse of the Delassus expression as a dense matrix."
)
77
78
.
def
(
79
"size"
, &
DelassusOperator::size
, bp::arg(
"self"
),
80
"Returns the size of the decomposition."
)
81
.
def
(
"rows"
, &DelassusOperator::rows, bp::arg(
"self"
),
"Returns the number of rows."
)
82
.
def
(
"cols"
, &DelassusOperator::cols, bp::arg(
"self"
),
"Returns the number of columns."
);
83
}
84
};
85
86
}
// namespace python
87
}
// namespace pinocchio
88
89
#endif // ifndef __pinocchio_python_algorithm_delssus_operator_hpp__
pinocchio::python::DelassusOperatorBasePythonVisitor::Vector
DelassusOperator::Vector Vector
Definition:
delassus-operator.hpp:24
boost::python
delassus-operator-base.hpp
pinocchio::python::Scalar
context::Scalar Scalar
Definition:
admm-solver.cpp:29
def
void def(const char *name, Func func)
pinocchio::python::DelassusOperatorBasePythonVisitor
Definition:
delassus-operator.hpp:18
pinocchio::context::MatrixXs
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
Definition:
context/generic.hpp:49
python
size
FCL_REAL size() const
pinocchio::python::DelassusOperatorBasePythonVisitor::Self
DelassusOperator Self
Definition:
delassus-operator.hpp:21
pinocchio::python::DelassusOperatorBasePythonVisitor::Scalar
DelassusOperator::Scalar Scalar
Definition:
delassus-operator.hpp:22
pinocchio::inverse
void inverse(const Eigen::MatrixBase< MatrixIn > &m_in, const Eigen::MatrixBase< MatrixOut > &dest)
Definition:
math/matrix.hpp:273
pinocchio::python::DelassusOperatorBasePythonVisitor::visit
void visit(PyClass &cl) const
Definition:
delassus-operator.hpp:27
cl
cl
memory.hpp
pinocchio::python::DelassusOperatorBasePythonVisitor::Matrix
context::MatrixXs Matrix
Definition:
delassus-operator.hpp:23
pinocchio
Main pinocchio namespace.
Definition:
timings.cpp:27
pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:28