12 #ifndef MLPACK_TESTS_TEST_TOOLS_HPP 13 #define MLPACK_TESTS_TEST_TOOLS_HPP 16 #include <boost/version.hpp> 19 #if BOOST_VERSION < 103600 21 #include <boost/test/floating_point_comparison.hpp> 22 #include <boost/test/auto_unit_test.hpp> 26 #define BOOST_REQUIRE_GE( L, R ) \ 27 BOOST_REQUIRE_EQUAL( (L >= R), true ) 29 #define BOOST_REQUIRE_NE( L, R ) \ 30 BOOST_REQUIRE_EQUAL( (L != R), true ) 32 #define BOOST_REQUIRE_LE( L, R ) \ 33 BOOST_REQUIRE_EQUAL( (L <= R), true ) 35 #define BOOST_REQUIRE_LT( L, R ) \ 36 BOOST_REQUIRE_EQUAL( (L < R), true ) 38 #define BOOST_REQUIRE_GT( L, R ) \ 39 BOOST_REQUIRE_EQUAL( (L > R), true ) 45 #define REQUIRE_RELATIVE_ERR( L, R, E ) \ 46 BOOST_REQUIRE_LE( std::abs((R) - (L)), (E) * std::abs(R)) 51 BOOST_REQUIRE_EQUAL(a.n_rows, b.n_rows);
52 BOOST_REQUIRE_EQUAL(a.n_cols, b.n_cols);
54 for (
size_t i = 0; i < a.n_elem; ++i)
56 if (std::abs(a[i]) < 1e-5)
57 BOOST_REQUIRE_SMALL(b[i], 1e-5);
59 BOOST_REQUIRE_CLOSE(a[i], b[i], 1e-5);
66 BOOST_REQUIRE_EQUAL(a.n_rows, b.n_rows);
67 BOOST_REQUIRE_EQUAL(a.n_cols, b.n_cols);
69 for (
size_t i = 0; i < a.n_elem; ++i)
70 BOOST_REQUIRE_EQUAL(a[i], b[i]);
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...