mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add intitial support for the vectorization of complex<float>
This commit is contained in:
@@ -108,16 +108,6 @@ struct packet_helper<false,Packet>
|
||||
#define REF_MUL(a,b) ((a)*(b))
|
||||
#define REF_DIV(a,b) ((a)/(b))
|
||||
|
||||
namespace std {
|
||||
|
||||
template<> const complex<float>& min(const complex<float>& a, const complex<float>& b)
|
||||
{ return a.real() < b.real() ? a : b; }
|
||||
|
||||
template<> const complex<float>& max(const complex<float>& a, const complex<float>& b)
|
||||
{ return a.real() < b.real() ? b : a; }
|
||||
|
||||
}
|
||||
|
||||
template<typename Scalar> void packetmath()
|
||||
{
|
||||
typedef typename ei_packet_traits<Scalar>::type Packet;
|
||||
@@ -176,9 +166,6 @@ template<typename Scalar> void packetmath()
|
||||
if (!ei_is_same_type<Scalar,int>::ret)
|
||||
CHECK_CWISE2(REF_DIV, ei_pdiv);
|
||||
#endif
|
||||
CHECK_CWISE2(std::min, ei_pmin);
|
||||
CHECK_CWISE2(std::max, ei_pmax);
|
||||
CHECK_CWISE1(ei_abs, ei_pabs);
|
||||
CHECK_CWISE1(ei_negate, ei_pnegate);
|
||||
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
@@ -198,16 +185,6 @@ template<typename Scalar> void packetmath()
|
||||
ref[0] *= data1[i];
|
||||
VERIFY(ei_isApprox(ref[0], ei_predux_mul(ei_pload(data1))) && "ei_predux_mul");
|
||||
|
||||
ref[0] = data1[0];
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[0] = std::min(ref[0],data1[i]);
|
||||
VERIFY(ei_isApprox(ref[0], ei_predux_min(ei_pload(data1))) && "ei_predux_min");
|
||||
|
||||
ref[0] = data1[0];
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[0] = std::max(ref[0],data1[i]);
|
||||
VERIFY(ei_isApprox(ref[0], ei_predux_max(ei_pload(data1))) && "ei_predux_max");
|
||||
|
||||
for (int j=0; j<PacketSize; ++j)
|
||||
{
|
||||
ref[j] = 0;
|
||||
@@ -256,17 +233,31 @@ template<typename Scalar> void packetmath_real()
|
||||
}
|
||||
CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasLog, ei_log, ei_plog);
|
||||
CHECK_CWISE1_IF(ei_packet_traits<Scalar>::HasSqrt, ei_sqrt, ei_psqrt);
|
||||
|
||||
ref[0] = data1[0];
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[0] = std::min(ref[0],data1[i]);
|
||||
VERIFY(ei_isApprox(ref[0], ei_predux_min(ei_pload(data1))) && "ei_predux_min");
|
||||
|
||||
CHECK_CWISE2(std::min, ei_pmin);
|
||||
CHECK_CWISE2(std::max, ei_pmax);
|
||||
CHECK_CWISE1(ei_abs, ei_pabs);
|
||||
|
||||
ref[0] = data1[0];
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[0] = std::max(ref[0],data1[i]);
|
||||
VERIFY(ei_isApprox(ref[0], ei_predux_max(ei_pload(data1))) && "ei_predux_max");
|
||||
}
|
||||
|
||||
void test_packetmath()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1( packetmath<float>() );
|
||||
// CALL_SUBTEST_1( packetmath<float>() );
|
||||
CALL_SUBTEST_2( packetmath<double>() );
|
||||
CALL_SUBTEST_3( packetmath<int>() );
|
||||
CALL_SUBTEST_1( packetmath<std::complex<float> >() );
|
||||
|
||||
CALL_SUBTEST_1( packetmath_real<float>() );
|
||||
// CALL_SUBTEST_1( packetmath_real<float>() );
|
||||
CALL_SUBTEST_2( packetmath_real<double>() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user