12 #ifndef MLPACK_TESTS_TEST_TOOLS_HPP 13 #define MLPACK_TESTS_TEST_TOOLS_HPP 16 #include <boost/version.hpp> 20 #define REQUIRE_RELATIVE_ERR(L, R, E) \ 21 BOOST_REQUIRE_LE(std::abs((R) - (L)), (E) * std::abs(R)) 26 double tolerance = 1e-5)
28 BOOST_REQUIRE_EQUAL(a.n_rows, b.n_rows);
29 BOOST_REQUIRE_EQUAL(a.n_cols, b.n_cols);
31 for (
size_t i = 0; i < a.n_elem; ++i)
33 if (std::abs(a[i]) < tolerance / 2)
34 BOOST_REQUIRE_SMALL(b[i], tolerance / 2);
36 BOOST_REQUIRE_CLOSE(a[i], b[i], tolerance);
42 const arma::Mat<size_t>& b)
44 BOOST_REQUIRE_EQUAL(a.n_rows, b.n_rows);
45 BOOST_REQUIRE_EQUAL(a.n_cols, b.n_cols);
47 for (
size_t i = 0; i < a.n_elem; ++i)
48 BOOST_REQUIRE_EQUAL(a[i], b[i]);
54 double tolerance = 1e-5)
56 BOOST_REQUIRE_EQUAL(a.n_rows, b.n_rows);
57 BOOST_REQUIRE_EQUAL(a.n_cols, b.n_cols);
58 BOOST_REQUIRE_EQUAL(a.n_slices, b.n_slices);
60 for (
size_t i = 0; i < a.n_elem; ++i)
62 if (std::abs(a[i]) < tolerance / 2)
63 BOOST_REQUIRE_SMALL(b[i], tolerance / 2);
65 BOOST_REQUIRE_CLOSE(a[i], b[i], tolerance);
74 for (
auto it = inputString.rbegin(); it != inputString.rend() &&
75 fileName.size() != 32; ++it)
77 if (std::isalnum(*it))
78 fileName.push_back(*it);
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...