gram-schmidt-orthonormalisation.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #include <iostream>
6 
8 #include <Eigen/QR>
9 
10 #include <boost/variant.hpp> // to avoid C99 warnings
11 
12 #include <boost/test/unit_test.hpp>
13 #include <boost/utility/binary.hpp>
14 
15 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
16 
17 using namespace pinocchio;
18 
19 BOOST_AUTO_TEST_CASE(test_random_matrix)
20 {
21  for (size_t i = 0; i < 100; ++i)
22  {
23  const Eigen::DenseIndex size = 20;
24  const Eigen::MatrixXd random_mat = Eigen::MatrixXd::Random(size, size);
25  const auto qr = random_mat.householderQr();
26  const Eigen::MatrixXd basis = qr.householderQ();
27 
28  for (size_t k = 0; k < 1000; ++k)
29  {
30  const Eigen::VectorXd random_vec = Eigen::VectorXd::Random(size);
31  orthonormalisation(basis.leftCols(10), random_vec);
32  BOOST_CHECK((basis.leftCols(10).transpose() * random_vec).isZero());
33  }
34  }
35 }
36 
37 BOOST_AUTO_TEST_SUITE_END()
inverse-kinematics.i
int i
Definition: inverse-kinematics.py:17
size
FCL_REAL size() const
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(test_random_matrix)
Definition: gram-schmidt-orthonormalisation.cpp:19
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
gram-schmidt-orthonormalisation.hpp
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:09