diff --git a/test/array.cpp b/test/array.cpp index 6964075ea..fad835cb4 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -208,6 +208,25 @@ template void array_real(const ArrayType& m) VERIFY_IS_APPROX(std::pow(m3,RealScalar(0.5)), m3.sqrt()); } +template void array_complex(const ArrayType& m) +{ + typedef typename ArrayType::Index Index; + + Index rows = m.rows(); + Index cols = m.cols(); + + ArrayType m1 = ArrayType::Random(rows, cols), + m2(rows, cols); + + for (Index i = 0; i < m.rows(); ++i) + for (Index j = 0; j < m.cols(); ++j) + m2(i,j) = std::sqrt(m1(i,j)); + + VERIFY_IS_APPROX(m1.sqrt(), m2); + VERIFY_IS_APPROX(m1.sqrt(), std::sqrt(m1)); + VERIFY_IS_APPROX(m1.sqrt(), internal::sqrt(m1)); +} + void test_array() { for(int i = 0; i < g_repeat; i++) { @@ -231,6 +250,9 @@ void test_array() CALL_SUBTEST_3( array_real(Array44d()) ); CALL_SUBTEST_5( array_real(ArrayXXf(8, 12)) ); } + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_4( array_complex(ArrayXXcf(3, 3)) ); + } VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, int >::value)); VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, float >::value));