From ee550a2ac3fa2f127cc8ab16ee2773aa390b0142 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Wed, 16 Jan 2019 14:03:12 -0800 Subject: Fix flaky test for tensor fft. --- unsupported/test/cxx11_tensor_fft.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'unsupported/test/cxx11_tensor_fft.cpp') diff --git a/unsupported/test/cxx11_tensor_fft.cpp b/unsupported/test/cxx11_tensor_fft.cpp index 4e4c9c4ec..641486a4a 100644 --- a/unsupported/test/cxx11_tensor_fft.cpp +++ b/unsupported/test/cxx11_tensor_fft.cpp @@ -228,9 +228,6 @@ template static void test_fft_non_power_of_2_round_trip(int exponent) { int n = (1 << exponent) + 1; - // The dimension type needs to be at least 8 bytes long for the - // Tensor constructor to work. On Windows, long is only 4 bytes long, - // so use long long here to force the usage of a 8 bytes integer type. Eigen::DSizes dimensions; dimensions[0] = n; const DSizes arr = dimensions; @@ -249,7 +246,9 @@ static void test_fft_non_power_of_2_round_trip(int exponent) { forward.template fft(fft); for (int i = 0; i < n; ++i) { - VERIFY_IS_APPROX(input[i], output[i]); + RealScalar tol = test_precision() * + (std::abs(input[i]) + std::abs(output[i]) + 1); + VERIFY_IS_APPROX_OR_LESS_THAN(std::abs(input[i] - output[i]), tol); } } @@ -301,4 +300,5 @@ EIGEN_DECLARE_TEST(cxx11_tensor_fft) { test_fft_real_input_energy(); test_fft_non_power_of_2_round_trip(7); + test_fft_non_power_of_2_round_trip(7); } -- cgit v1.2.3