diff options
author | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-03-08 10:40:01 +0100 |
---|---|---|
committer | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-03-08 10:40:01 +0100 |
commit | 6cb016c0ceff231c001928f641d344fc92c44b73 (patch) | |
tree | 5521dc1396347616a3644f96e6a9f96845c593e1 /src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp | |
parent | 69168e8ed24165ab89ea1c57bc21dd994c93dd8e (diff) | |
parent | bbff86f1218fc7bc9976353901aa94cfa54792f6 (diff) |
Merge master and resolve commits
Diffstat (limited to 'src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp')
-rw-r--r-- | src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp b/src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp new file mode 100644 index 00000000..84178741 --- /dev/null +++ b/src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp @@ -0,0 +1,36 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2019 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "random_orthogonal_matrix_function" +#include <boost/test/unit_test.hpp> +#include <gudhi/Unitary_tests_utils.h> + +#include <gudhi/Functions/random_orthogonal_matrix.h> + +#include <string> + +#include <random> +#include <cstdlib> + +using namespace Gudhi::coxeter_triangulation; + +// this test is separated as it requires CGAL +BOOST_AUTO_TEST_CASE(random_orthogonal_matrix_function) { + // random orthogonal matrix + Eigen::MatrixXd matrix = random_orthogonal_matrix(5); + Eigen::MatrixXd id_matrix = matrix.transpose() * matrix; + for (std::size_t i = 0; i < 5; ++i) + for (std::size_t j = 0; j < 5; ++j) + if (i == j) + GUDHI_TEST_FLOAT_EQUALITY_CHECK(id_matrix(i, j), 1.0, 1e-10); + else + GUDHI_TEST_FLOAT_EQUALITY_CHECK(id_matrix(i, j), 0.0, 1e-10); +} |