1 |
|
|
// |
2 |
|
|
// Copyright (c) 2020 INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#ifndef __pinocchio_python_utils_eigen_hpp__ |
6 |
|
|
#define __pinocchio_python_utils_eigen_hpp__ |
7 |
|
|
|
8 |
|
|
#include "pinocchio/bindings/python/fwd.hpp" |
9 |
|
|
#include <eigenpy/eigen-to-python.hpp> |
10 |
|
|
|
11 |
|
|
namespace pinocchio |
12 |
|
|
{ |
13 |
|
|
namespace python |
14 |
|
|
{ |
15 |
|
|
|
16 |
|
|
template<typename Matrix> |
17 |
|
12 |
Eigen::Ref<Matrix> make_ref(Eigen::PlainObjectBase<Matrix> & mat) |
18 |
|
|
{ |
19 |
|
|
typedef Eigen::Ref<Matrix> ReturnType; |
20 |
|
12 |
return ReturnType(mat); |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
template<typename Matrix> |
24 |
|
2 |
void make_symmetric(Eigen::MatrixBase<Matrix> & mat) |
25 |
|
|
{ |
26 |
✓✗✓✗ ✓✗ |
2 |
mat.template triangularView<Eigen::StrictlyLower>() = |
27 |
|
2 |
mat.transpose().template triangularView<Eigen::StrictlyLower>(); |
28 |
|
2 |
} |
29 |
|
|
|
30 |
|
|
template<typename Matrix> |
31 |
|
|
typename PINOCCHIO_EIGEN_PLAIN_TYPE(Matrix) make_copy(const Eigen::MatrixBase<Matrix> & mat) |
32 |
|
|
{ |
33 |
|
|
typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Matrix) ReturnType; |
34 |
|
|
return ReturnType(mat); |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
} // namespace python |
38 |
|
|
} // namespace pinocchio |
39 |
|
|
|
40 |
|
|
#endif // ifndef __pinocchio_python_utils_eigen_hpp__ |