5 #define BOOST_TEST_DYN_LINK
7 #include <boost/test/unit_test.hpp>
8 #include <Vector/vector_dist.hpp>
9 #include <DCPSE/MonomialBasis.hpp>
10 #include <DCPSE/VandermondeRowBuilder.hpp>
11 #include <DCPSE/Vandermonde.hpp>
12 #include "DMatrix/EMatrix.hpp"
14 BOOST_AUTO_TEST_SUITE(Vandermonde_tests)
19 BOOST_AUTO_TEST_CASE(VandermondeRowBuilder_AllOnes_test)
22 EMatrix<double, Eigen::Dynamic, Eigen::Dynamic> row(1, mb.size());
26 vrb.buildRow(row, 0, x / eps);
28 bool isRowAllOnes =
true;
29 for (
int i = 0; i < mb.size(); ++i)
31 isRowAllOnes = isRowAllOnes && (row(0, i) == 1);
33 BOOST_REQUIRE(isRowAllOnes);
36 BOOST_AUTO_TEST_CASE(VandermondeRowBuilder_OneZero_test)
39 EMatrix<double, Eigen::Dynamic, Eigen::Dynamic> row(1, mb.size());
43 vrb.buildRow(row, 0, x / eps);
45 bool areValuesOk =
true;
46 for (
int i = 0; i < mb.size(); ++i)
48 bool isThereY = mb.getElement(i).getExponent(1) > 0;
49 bool curCheck = (row(0, i) == !isThereY);
50 areValuesOk = areValuesOk && curCheck;
52 BOOST_REQUIRE(areValuesOk);
55 BOOST_AUTO_TEST_CASE(VandermondeRowBuilder_ZeroOne_test)
58 EMatrix<double, Eigen::Dynamic, Eigen::Dynamic> row(1, mb.size());
62 vrb.buildRow(row, 0, x / eps);
64 bool areValuesOk =
true;
65 for (
int i = 0; i < mb.size(); ++i)
67 bool isThereX = mb.getElement(i).getExponent(0) > 0;
68 bool curCheck = (row(0, i) == !isThereX);
69 areValuesOk = areValuesOk && curCheck;
71 BOOST_REQUIRE(areValuesOk);
76 BOOST_AUTO_TEST_SUITE_END()