Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2019 INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#include "pinocchio/multibody/model.hpp" |
6 |
|
|
|
7 |
|
|
#include <Eigen/Core> |
8 |
|
|
#include "pinocchio/math/matrix.hpp" |
9 |
|
|
|
10 |
|
|
#include <boost/test/unit_test.hpp> |
11 |
|
|
#include <boost/utility/binary.hpp> |
12 |
|
|
|
13 |
|
|
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE) |
14 |
|
|
|
15 |
|
✗ |
BOOST_AUTO_TEST_CASE(test_matrix_matrix_product) |
16 |
|
|
{ |
17 |
|
|
using namespace pinocchio; |
18 |
|
|
using namespace Eigen; |
19 |
|
✗ |
const Eigen::DenseIndex m = 20, n = 100; |
20 |
|
✗ |
MatrixXd M1(MatrixXd::Ones(m, n)), M2(MatrixXd::Ones(n, m)); |
21 |
|
✗ |
MatrixMatrixProduct<MatrixXd, MatrixXd>::type res = M1 * M2; |
22 |
|
✗ |
BOOST_CHECK(!res.eval().isZero()); |
23 |
|
|
} |
24 |
|
|
|
25 |
|
✗ |
BOOST_AUTO_TEST_CASE(test_scalar_matrix_product) |
26 |
|
|
{ |
27 |
|
|
using namespace pinocchio; |
28 |
|
|
using namespace Eigen; |
29 |
|
✗ |
const Eigen::DenseIndex m = 20, n = 100; |
30 |
|
✗ |
MatrixXd M(MatrixXd::Ones(m, n)); |
31 |
|
✗ |
const double alpha = 0.; |
32 |
|
✗ |
ScalarMatrixProduct<double, MatrixXd>::type res = alpha * M; |
33 |
|
✗ |
BOOST_CHECK(res.eval().isZero()); |
34 |
|
|
} |
35 |
|
|
|
36 |
|
✗ |
BOOST_AUTO_TEST_CASE(test_matrix_scalar_product) |
37 |
|
|
{ |
38 |
|
|
using namespace pinocchio; |
39 |
|
|
using namespace Eigen; |
40 |
|
✗ |
const Eigen::DenseIndex m = 20, n = 100; |
41 |
|
✗ |
MatrixXd M(MatrixXd::Ones(m, n)); |
42 |
|
✗ |
const double alpha = 1.; |
43 |
|
✗ |
MatrixScalarProduct<MatrixXd, double>::type res = M * alpha; |
44 |
|
✗ |
BOOST_CHECK(res.eval() == M); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
BOOST_AUTO_TEST_SUITE_END() |
48 |
|
|
|