38#include <boost/test/tools/floating_point_comparison.hpp>
39#include <boost/test/unit_test.hpp>
45 using dataType = double;
46 constexpr size_t n = 31;
49 dataType epsilon = std::numeric_limits<dataType>::epsilon();
52 for (
size_t i = 0; i < n; ++i)
60 for (
size_t i = 0; i < n; ++i)
62 BOOST_CHECK_CLOSE(
z[i], 2.0, epsilon);
68 for (
size_t i = 0; i < n; ++i)
76 for (
size_t i = 0; i < n; ++i)
78 BOOST_CHECK_CLOSE(
z[i], 2.0, epsilon);
84 for (
size_t i = 0; i < n; ++i)
92 for (
size_t i = 0; i < n; ++i)
94 BOOST_CHECK_CLOSE(
z[i], -2.0, epsilon);
100 using dataType = double;
101 constexpr size_t n = 31;
104 dataType epsilon = std::numeric_limits<dataType>::epsilon();
107 for (
size_t i = 0; i < n; ++i)
115 for (
size_t i = 0; i < n; ++i)
117 BOOST_CHECK_CLOSE(
z[i], i, epsilon);
123 for (
size_t i = 0; i < n; ++i)
131 for (
size_t i = 0; i < n; ++i)
133 BOOST_CHECK_CLOSE(
z[i], 0.0, epsilon);
139 for (
size_t i = 0; i < n; ++i)
147 for (
size_t i = 0; i < n; ++i)
149 BOOST_CHECK_CLOSE(
z[i], -2.0, epsilon);
155 using dataType = double;
156 constexpr size_t n = 11;
159 dataType epsilon = std::numeric_limits<dataType>::epsilon();
162 for (
size_t i = 0; i < n; ++i)
171 for (
size_t i = 0; i < n; ++i)
173 BOOST_CHECK_CLOSE(
z[i], 2.0, epsilon);
179 for (
size_t i = 0; i < n; ++i)
188 for (
size_t i = 0; i < n; ++i)
190 BOOST_CHECK_CLOSE(
z[i], 0.5, epsilon);
196 for (
size_t i = 0; i < n; ++i)
205 for (
size_t i = 0; i < n; ++i)
207 BOOST_CHECK_CLOSE(
z[i], 0.5, epsilon);
213 using dataType = double;
214 constexpr size_t n = 11;
217 dataType epsilon = std::numeric_limits<dataType>::epsilon();
220 for (
size_t i = 0; i < n; ++i)
230 for (
size_t i = 0; i < n; ++i)
232 BOOST_CHECK_CLOSE(
z[i], 2.0, epsilon);
238 for (
size_t i = 0; i < n; ++i)
248 for (
size_t i = 0; i < n; ++i)
250 BOOST_CHECK_CLOSE(
z[i], 0.5, epsilon);
256 for (
size_t i = 0; i < n; ++i)
266 for (
size_t i = 0; i < n; ++i)
268 BOOST_CHECK_CLOSE(
z[i], 0.5, epsilon);
274 using dataType = double;
275 constexpr size_t n = 11;
276 std::array<dataType, n> x;
277 constexpr size_t ni = 5;
278 std::array<size_t, ni> y;
279 std::array<dataType, ni>
z;
281 dataType epsilon = std::numeric_limits<dataType>::epsilon();
284 for (
size_t i = 0; i < n; ++i)
298 for (
size_t i = 0; i < ni; ++i)
300 BOOST_CHECK_CLOSE(
z[i], x[y[i]], epsilon);
306 using dataType = double;
307 constexpr size_t n = 30;
308 std::array<dataType, n> x;
309 constexpr int ni = 13;
310 std::array<int, ni> y;
311 std::array<dataType, ni>
z;
313 dataType epsilon = std::numeric_limits<dataType>::epsilon();
316 for (
size_t i = 0; i < n; ++i)
338 for (
size_t i = 0; i < ni; ++i)
340 BOOST_CHECK_CLOSE(
z[i], x[y[i]], epsilon);
std::vector< double > w(NPUPPER)
std::vector< double > z(NPUPPER)
BOOST_AUTO_TEST_CASE(TestVadd)
void Vvtvp(const size_t n, const T *w, const T *x, const T *y, T *z)
vvtvp (vector times vector plus vector): z = w*x + y
void Vadd(const size_t n, const T *x, const T *y, T *z)
Add vector z = x + y.
void Gathr(const I n, const T *x, const I *y, T *z)
Gather vector z[i] = x[y[i]].
void Vvtvvtp(const size_t n, const T *v, const T *w, const T *x, const T *y, T *z)
vvtvvtp (vector times vector plus vector times vector):
void Vmul(const size_t n, const T *x, const T *y, T *z)
Multiply vector z = x * y.
typename abi< ScalarType, width >::type simd