Directory: | ./ |
---|---|
File: | bindings/python/algorithm/expose-cholesky.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 10 | 13 | 76.9% |
Branches: | 9 | 18 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2019-2020 CNRS INRIA | ||
3 | // | ||
4 | |||
5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
6 | #include "pinocchio/bindings/python/utils/namespace.hpp" | ||
7 | #include "pinocchio/algorithm/cholesky.hpp" | ||
8 | |||
9 | namespace pinocchio | ||
10 | { | ||
11 | namespace python | ||
12 | { | ||
13 | |||
14 | 20 | void exposeCholesky() | |
15 | { | ||
16 | using namespace Eigen; | ||
17 | using namespace pinocchio::cholesky; | ||
18 | |||
19 | { | ||
20 | typedef context::Scalar Scalar; | ||
21 | typedef context::VectorXs VectorXs; | ||
22 | enum | ||
23 | { | ||
24 | Options = context::Options | ||
25 | }; | ||
26 | |||
27 | // using the cholesky scope | ||
28 |
3/6✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
|
40 | bp::scope current_scope = getOrCreatePythonNamespace("cholesky"); |
29 | |||
30 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
31 | "decompose", &decompose<Scalar, Options, JointCollectionDefaultTpl>, | ||
32 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
40 | bp::args("Model", "Data"), |
33 | "Computes the Cholesky decomposition of the joint space inertia matrix M contained " | ||
34 | "in data.\n" | ||
35 | "The upper triangular part of data.M should have been filled first by calling " | ||
36 | "crba, or any related algorithms.", | ||
37 | ✗ | bp::return_value_policy<bp::return_by_value>()); | |
38 | |||
39 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
40 | "solve", &solve<Scalar, Options, JointCollectionDefaultTpl, VectorXs>, | ||
41 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
40 | bp::args("Model", "Data", "v"), |
42 | "Returns the solution \f$x\f$ of \f$ M x = y \f$ using the Cholesky decomposition " | ||
43 | "stored in data given the entry \f$ y \f$.", | ||
44 | ✗ | bp::return_value_policy<bp::return_by_value>()); | |
45 | |||
46 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
47 | "computeMinv", &computeMinv<Scalar, Options, JointCollectionDefaultTpl>, | ||
48 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
40 | bp::args("Model", "Data"), |
49 | "Returns the inverse of the joint space inertia matrix using the results of the " | ||
50 | "Cholesky decomposition\n" | ||
51 | "performed by cholesky.decompose. The result is stored in data.Minv.", | ||
52 | ✗ | bp::return_value_policy<bp::return_by_value>()); | |
53 | 20 | } | |
54 | 20 | } | |
55 | |||
56 | } // namespace python | ||
57 | } // namespace pinocchio | ||
58 |