bindings/python/utils/eigen.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020-2021 INRIA
3 //
4 
5 #ifndef __pinocchio_python_utils_eigen_hpp__
6 #define __pinocchio_python_utils_eigen_hpp__
7 
10 
11 namespace pinocchio
12 {
13  namespace python
14  {
15 
16  template<typename Matrix>
17  Eigen::Ref<Matrix> make_ref(const Eigen::PlainObjectBase<Matrix> & mat)
18  {
19  typedef Eigen::Ref<Matrix> ReturnType;
20  return ReturnType(mat.const_cast_derived());
21  }
22 
23  template<typename Matrix>
24  void make_symmetric(const Eigen::MatrixBase<Matrix> & mat, const int mode = Eigen::Upper)
25  {
26  if (mode == Eigen::Upper)
27  {
28  mat.const_cast_derived().template triangularView<Eigen::StrictlyLower>() =
29  mat.transpose().template triangularView<Eigen::StrictlyLower>();
30  }
31  else if (mode == Eigen::Lower)
32  {
33  mat.const_cast_derived().template triangularView<Eigen::StrictlyUpper>() =
34  mat.transpose().template triangularView<Eigen::StrictlyUpper>();
35  }
36  }
37 
38  template<typename Matrix>
39  typename PINOCCHIO_EIGEN_PLAIN_TYPE(Matrix) make_copy(const Eigen::MatrixBase<Matrix> & mat)
40  {
41  typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Matrix) ReturnType;
42  return ReturnType(mat);
43  }
44 
45  } // namespace python
46 } // namespace pinocchio
47 
48 #endif // ifndef __pinocchio_python_utils_eigen_hpp__
eigen-to-python.hpp
pinocchio::python::PINOCCHIO_EIGEN_PLAIN_TYPE
PINOCCHIO_EIGEN_PLAIN_TYPE(MatrixType) inv(const Eigen
Definition: expose-linalg.cpp:18
pinocchio::python::make_symmetric
void make_symmetric(const Eigen::MatrixBase< Matrix > &mat, const int mode=Eigen::Upper)
Definition: bindings/python/utils/eigen.hpp:24
python
mat
mat
fwd.hpp
pinocchio::python::make_ref
Eigen::Ref< Matrix > make_ref(const Eigen::PlainObjectBase< Matrix > &mat)
Definition: bindings/python/utils/eigen.hpp:17
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:34