gram-schmidt-orthonormalisation.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #ifndef __pinocchio_math_gram_schmidt_orthonormalisation_hpp__
6 #define __pinocchio_math_gram_schmidt_orthonormalisation_hpp__
7 
8 #include "pinocchio/math/fwd.hpp"
9 #include <Eigen/Core>
10 
11 namespace pinocchio
12 {
19  template<typename MatrixType, typename VectorType>
21  const Eigen::MatrixBase<MatrixType> & basis, const Eigen::MatrixBase<VectorType> & vec_)
22  {
23  typedef typename VectorType::Scalar Scalar;
24  VectorType & vec = vec_.const_cast_derived();
25 
26  PINOCCHIO_CHECK_ARGUMENT_SIZE(basis.rows(), vec.size());
27  assert((basis.transpose() * basis).isIdentity() && "The input basis is not orthonormal.");
28 
29  for (Eigen::DenseIndex col_id = 0; col_id < basis.cols(); ++col_id)
30  {
31  const auto col = basis.col(col_id);
32  const Scalar alpha = col.dot(vec);
33  vec -= alpha * col;
34  }
35 
36  assert((basis.transpose() * vec).isZero());
37  }
38 } // namespace pinocchio
39 
40 #endif // ifndef __pinocchio_math_gram_schmidt_orthonormalisation_hpp__
PINOCCHIO_CHECK_ARGUMENT_SIZE
#define PINOCCHIO_CHECK_ARGUMENT_SIZE(...)
Macro to check if the size of an element is equal to the expected size.
Definition: include/pinocchio/macros.hpp:216
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
vec
vec
reachable-workspace-with-collisions.alpha
float alpha
Definition: reachable-workspace-with-collisions.py:162
fwd.hpp
pinocchio::orthonormalisation
void orthonormalisation(const Eigen::MatrixBase< MatrixType > &basis, const Eigen::MatrixBase< VectorType > &vec_)
Perform the Gram-Schmidt orthonormalisation on the input/output vector for a given input basis.
Definition: gram-schmidt-orthonormalisation.hpp:20
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:44