diff --git a/test/packetmath.cpp b/test/packetmath.cpp index d8a785519..a804e8e73 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -173,10 +173,13 @@ template void packetmath() CHECK_CWISE1(internal::negate, internal::pnegate); CHECK_CWISE1(internal::conj, internal::pconj); - for (int i=0; i(data1[0])); - VERIFY(areApprox(ref, data2, PacketSize) && "internal::pset1"); + for(int offset=0;offset<3) + { + for (int i=0; i(data1[offset])); + VERIFY(areApprox(ref, data2, PacketSize) && "internal::pset1"); + } VERIFY(internal::isApprox(data1[0], internal::pfirst(internal::pload(data1))) && "internal::pfirst"); @@ -271,6 +274,34 @@ template void packetmath_real() VERIFY(internal::isApprox(ref[0], internal::predux_max(internal::pload(data1))) && "internal::predux_max"); } +template void test_conj_helper(Scalar* data1, Scalar* data2, Scalar* ref, Scalar* pval) +{ + typedef typename internal::packet_traits::type Packet; + const int PacketSize = internal::packet_traits::size; + + internal::conj_if cj0; + internal::conj_if cj1; + internal::conj_helper cj; + internal::conj_helper pcj; + + for(int i=0;i(data1),internal::pload(data2))); + VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper pmul"); + + for(int i=0;i(data1),internal::pload(data2),internal::pload(pval))); + VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper pmadd"); +} + template void packetmath_complex() { typedef typename internal::packet_traits::type Packet; @@ -287,51 +318,11 @@ template void packetmath_complex() data1[i] = internal::random() * Scalar(1e2); data2[i] = internal::random() * Scalar(1e2); } - - { - internal::conj_helper cj; - internal::conj_helper pcj; - for(int i=0;i(data1),internal::pload(data2))); - VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper"); - } - { - internal::conj_helper cj; - internal::conj_helper pcj; - for(int i=0;i(data1),internal::pload(data2))); - VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper"); - } - { - internal::conj_helper cj; - internal::conj_helper pcj; - for(int i=0;i(data1),internal::pload(data2))); - VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper"); - } - { - internal::conj_helper cj; - internal::conj_helper pcj; - for(int i=0;i(data1),internal::pload(data2))); - VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper"); - } + + test_conj_helper (data1,data2,ref,pval); + test_conj_helper (data1,data2,ref,pval); + test_conj_helper (data1,data2,ref,pval); + test_conj_helper (data1,data2,ref,pval); { for(int i=0;i