5#ifndef __pinocchio_python_algorithm_delssus_operator_hpp__ 6#define __pinocchio_python_algorithm_delssus_operator_hpp__ 8#include <eigenpy/memory.hpp> 9#include "pinocchio/algorithm/delassus-operator-base.hpp" 15 namespace bp = boost::python;
17 template<
typename DelassusOperator>
18 struct DelassusOperatorBasePythonVisitor
19 :
public boost::python::def_visitor<DelassusOperatorBasePythonVisitor<DelassusOperator>>
21 typedef DelassusOperator Self;
22 typedef typename DelassusOperator::Scalar Scalar;
23 typedef context::MatrixXs Matrix;
24 typedef typename DelassusOperator::Vector Vector;
26 template<
class PyClass>
27 void visit(PyClass & cl)
const 29 cl.def(bp::self * bp::other<Matrix>())
32 +[](
const DelassusOperator & self,
const Matrix & other) -> Matrix {
35 bp::args(
"self",
"other"),
36 "Matrix multiplication between self and another matrix. Returns the result of Delassus " 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.")
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.")
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.")
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 " 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.")
72 "matrix", &DelassusOperator::matrix, bp::arg(
"self"),
73 "Returns the Delassus expression as a dense matrix.")
75 "inverse", &DelassusOperator::inverse, bp::arg(
"self"),
76 "Returns the inverse of the Delassus expression as a dense matrix.")
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.");
Main pinocchio namespace.