4 #include <valgrind/valgrind.h> 6 #include <boost/test/unit_test.hpp> 14 template <
typename precision_t>
15 void test_plan_real2complex() {
19 typedef std::complex<precision_t> complex;
21 aligned_vector<precision_t> in(nsamples);
22 aligned_vector<complex> tmp(nsamples);
23 aligned_vector<precision_t> out(nsamples);
25 std::size_t h = nsamples / 2;
26 for (std::size_t i = 0; i != h; ++i) {
28 in[i + h] = h / 4.0 - i;
35 inv.execute(tmp, out);
36 for (std::size_t i = 0; i != std::size_t(nsamples); ++i) {
40 BOOST_CHECK_MESSAGE(res,
"collections are not within tolerance=" << tol);
49 test_plan_real2complex<double>();
56 test_plan_real2complex<float>();
63 if (RUNNING_ON_VALGRIND > 0) {
64 BOOST_TEST_MESSAGE(
"long double not supported by valgrind, skip test");
67 test_plan_real2complex<long double>();
std::vector< T, jb::fftw::allocator< T > > aligned_vector
Alias std::vector with properly allocated storage for FFTW3.
plan< in_array_type, out_array_type > create_forward_plan(in_array_type const &in, out_array_type &out, int flags=default_plan_flags)
Create a plan to compute many DFTs given the input and output arrays.
plan< in_array_type, out_array_type > create_backward_plan(in_array_type const &in, out_array_type &out, int flags=default_plan_flags)
Create a plan to compute many inverse DFT given the input and output arrays.
bool check_collection_close_enough(collection_t const &a, collection_t const &b, int tol=1, int max_differences_printed=JB_TESTING_MAX_DIFFERENCES_PRINTED)
Given two collections of numbers of the same value type, find the differences that are out of a given...
std::size_t nsamples(container_type const &a)
Count the elements in the last dimension of a vector-like container.
BOOST_AUTO_TEST_CASE(fftw_allocator_double)