diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-10-16 10:41:07 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-10-16 10:41:07 -0700 |
commit | 94e47798f4e462b857a00b4ca60c954c71d16605 (patch) | |
tree | 42925d366b9b618ea193548fdcb5a59a76535f79 /unsupported/test/cxx11_tensor_of_complex.cpp | |
parent | d853adffdba52da6e1dd6b137724e4f4e783dcca (diff) |
Fixed the return types of unary and binary expressions to properly handle the case where it is different from the input type (e.g. abs(complex<float>))
Diffstat (limited to 'unsupported/test/cxx11_tensor_of_complex.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_of_complex.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_tensor_of_complex.cpp b/unsupported/test/cxx11_tensor_of_complex.cpp index b5044b962..24b2bcb58 100644 --- a/unsupported/test/cxx11_tensor_of_complex.cpp +++ b/unsupported/test/cxx11_tensor_of_complex.cpp @@ -32,6 +32,22 @@ static void test_additions() } +static void test_abs() +{ + Tensor<std::complex<float>, 1> data1(3); + Tensor<std::complex<double>, 1> data2(3); + data1.setRandom(); + data2.setRandom(); + + Tensor<float, 1> abs1 = data1.abs(); + Tensor<double, 1> abs2 = data2.abs(); + for (int i = 0; i < 3; ++i) { + VERIFY_IS_APPROX(abs1(i), std::abs(data1(i))); + VERIFY_IS_APPROX(abs2(i), std::abs(data2(i))); + } +} + + static void test_contractions() { Tensor<std::complex<float>, 4> t_left(30, 50, 8, 31); @@ -60,5 +76,6 @@ static void test_contractions() void test_cxx11_tensor_of_complex() { CALL_SUBTEST(test_additions()); + CALL_SUBTEST(test_abs()); CALL_SUBTEST(test_contractions()); } |