aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_fft.cpp
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-01-16 14:03:12 -0800
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-01-16 14:03:12 -0800
commitee550a2ac3fa2f127cc8ab16ee2773aa390b0142 (patch)
tree187fcd7f4cfb4781591565ff8e473c9f5af2c144 /unsupported/test/cxx11_tensor_fft.cpp
parent0f028f61cb4d7731512fff861d8228945c5d965c (diff)
Fix flaky test for tensor fft.
Diffstat (limited to 'unsupported/test/cxx11_tensor_fft.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_fft.cpp8
1 files changed, 4 insertions, 4 deletions
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 <typename RealScalar>
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<std::int64_t, 1> dimensions;
dimensions[0] = n;
const DSizes<std::int64_t, 1> arr = dimensions;
@@ -249,7 +246,9 @@ static void test_fft_non_power_of_2_round_trip(int exponent) {
forward.template fft<RealPart, FFT_REVERSE>(fft);
for (int i = 0; i < n; ++i) {
- VERIFY_IS_APPROX(input[i], output[i]);
+ RealScalar tol = test_precision<RealScalar>() *
+ (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<RowMajor, double, false, Eigen::BothParts, FFT_FORWARD, 4>();
test_fft_non_power_of_2_round_trip<float>(7);
+ test_fft_non_power_of_2_round_trip<double>(7);
}