From de345eff2e7e41505224e04c47e2a91b020b5a5a Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 11 Feb 2016 16:34:07 -0800 Subject: Added a method to conjugate the content of a tensor or the result of a tensor expression. --- unsupported/test/cxx11_tensor_of_complex.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'unsupported/test/cxx11_tensor_of_complex.cpp') diff --git a/unsupported/test/cxx11_tensor_of_complex.cpp b/unsupported/test/cxx11_tensor_of_complex.cpp index 8ad04f699..25e51143e 100644 --- a/unsupported/test/cxx11_tensor_of_complex.cpp +++ b/unsupported/test/cxx11_tensor_of_complex.cpp @@ -48,6 +48,25 @@ static void test_abs() } +static void test_conjugate() +{ + Tensor, 1> data1(3); + Tensor, 1> data2(3); + Tensor data3(3); + data1.setRandom(); + data2.setRandom(); + data3.setRandom(); + + Tensor, 1> conj1 = data1.conjugate(); + Tensor, 1> conj2 = data2.conjugate(); + Tensor conj3 = data3.conjugate(); + for (int i = 0; i < 3; ++i) { + VERIFY_IS_APPROX(conj1(i), std::conj(data1(i))); + VERIFY_IS_APPROX(conj2(i), std::conj(data2(i))); + VERIFY_IS_APPROX(conj3(i), data3(i)); + } +} + static void test_contractions() { Tensor, 4> t_left(30, 50, 8, 31); @@ -77,5 +96,6 @@ void test_cxx11_tensor_of_complex() { CALL_SUBTEST(test_additions()); CALL_SUBTEST(test_abs()); + CALL_SUBTEST(test_conjugate()); CALL_SUBTEST(test_contractions()); } -- cgit v1.2.3