mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add arg() to tensor
This commit is contained in:
committed by
Antonio Sánchez
parent
028ab12586
commit
a9868bd5be
@@ -47,6 +47,20 @@ static void test_abs()
|
||||
}
|
||||
}
|
||||
|
||||
static void test_arg()
|
||||
{
|
||||
Tensor<std::complex<float>, 1> data1(3);
|
||||
Tensor<std::complex<double>, 1> data2(3);
|
||||
data1.setRandom();
|
||||
data2.setRandom();
|
||||
|
||||
Tensor<float, 1> arg1 = data1.arg();
|
||||
Tensor<double, 1> arg2 = data2.arg();
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
VERIFY_IS_APPROX(arg1(i), std::arg(data1(i)));
|
||||
VERIFY_IS_APPROX(arg2(i), std::arg(data2(i)));
|
||||
}
|
||||
}
|
||||
|
||||
static void test_conjugate()
|
||||
{
|
||||
@@ -98,6 +112,7 @@ EIGEN_DECLARE_TEST(cxx11_tensor_of_complex)
|
||||
{
|
||||
CALL_SUBTEST(test_additions());
|
||||
CALL_SUBTEST(test_abs());
|
||||
CALL_SUBTEST(test_arg());
|
||||
CALL_SUBTEST(test_conjugate());
|
||||
CALL_SUBTEST(test_contractions());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user