5 #ifndef __pinocchio_math_gram_schmidt_orthonormalisation_hpp__
6 #define __pinocchio_math_gram_schmidt_orthonormalisation_hpp__
8 #include "pinocchio/math/fwd.hpp"
19 template<
typename MatrixType,
typename VectorType>
21 const Eigen::MatrixBase<MatrixType> & basis,
const Eigen::MatrixBase<VectorType> & vec_)
23 typedef typename VectorType::Scalar Scalar;
24 VectorType & vec = vec_.const_cast_derived();
26 PINOCCHIO_CHECK_ARGUMENT_SIZE(basis.rows(), vec.size());
27 assert((basis.transpose() * basis).isIdentity() &&
"The input basis is not orthonormal.");
29 for (Eigen::DenseIndex col_id = 0; col_id < basis.cols(); ++col_id)
31 const auto col = basis.col(col_id);
32 const Scalar alpha = col.dot(vec);
36 assert((basis.transpose() * vec).isZero());
Main pinocchio namespace.
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.