diff options
author | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2021-11-08 10:47:09 +0100 |
---|---|---|
committer | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2021-11-08 10:47:09 +0100 |
commit | d670769d113c7621d2260ac08c2961dd73ce8cb4 (patch) | |
tree | f4080ecfda544a2c4062d9ca24e4091cf6ea48ea /src/Coxeter_triangulation/test/random_orthogonal_matrix_function_test.cpp | |
parent | 11b8a288946c953472165ffbb5dbfbeb5ca64d26 (diff) | |
parent | cfb60a50a7c3aea08abc41118fbfdf31061a44a4 (diff) |
Merge master and resolve conflicts (mainly src/python/CMakeLists.txt)
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); +} |