11 #ifndef EIGEN_COMPLEX32_ZVECTOR_H
12 #define EIGEN_COMPLEX32_ZVECTOR_H
14 #include "../../InternalHeaderCheck.h"
20 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
29 EIGEN_STRONG_INLINE Packet1cd() {}
30 EIGEN_STRONG_INLINE
explicit Packet1cd(
const Packet2d&
a) :
v(
a) {}
36 EIGEN_STRONG_INLINE Packet2cf() {}
37 EIGEN_STRONG_INLINE
explicit Packet2cf(
const Packet4f&
a) :
v(
a) {}
38 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)
48 template<>
struct packet_traits<
std::complex<float> > : default_packet_traits
50 typedef Packet2cf type;
51 typedef Packet2cf half;
72 template<>
struct packet_traits<
std::complex<double> > : default_packet_traits
74 typedef Packet1cd type;
75 typedef Packet1cd half;
94 template<>
struct unpacket_traits<Packet2cf> {
95 typedef std::complex<float> type;
96 enum {
size=2, alignment=
Aligned16, vectorizable=
true, masked_load_available=
false, masked_store_available=
false};
97 typedef Packet2cf half;
100 template<>
struct unpacket_traits<Packet1cd> {
101 typedef std::complex<double> type;
102 enum {
size=1, alignment=
Aligned16, vectorizable=
true, masked_load_available=
false, masked_store_available=
false};
103 typedef Packet1cd half;
108 EIGEN_STRONG_INLINE
void ptranspose(PacketBlock<Packet2cf,2>& kernel);
113 template<> EIGEN_STRONG_INLINE
void pstore <std::complex<double> >(std::complex<double> * to,
const Packet1cd& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore((
double*)to, from.v); }
114 template<> EIGEN_STRONG_INLINE
void pstoreu<std::complex<double> >(std::complex<double> * to,
const Packet1cd& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu((
double*)to, from.v); }
116 template<> EIGEN_STRONG_INLINE Packet1cd
pset1<Packet1cd>(
const std::complex<double>& from)
125 pstore<std::complex<double> >(to, from);
127 template<> EIGEN_STRONG_INLINE Packet1cd
padd<Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(
a.v +
b.v); }
128 template<> EIGEN_STRONG_INLINE Packet1cd
psub<Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(
a.v -
b.v); }
131 template<> EIGEN_STRONG_INLINE Packet1cd
pmul<Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b)
140 v1 = vec_madd(a_re,
b.v, p2d_ZERO);
142 v2 = vec_madd(a_im,
b.v, p2d_ZERO);
146 return Packet1cd(
v1 +
v2);
148 template<> EIGEN_STRONG_INLINE Packet1cd
pand <Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(vec_and(
a.v,
b.v)); }
149 template<> EIGEN_STRONG_INLINE Packet1cd
por <Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(vec_or(
a.v,
b.v)); }
150 template<> EIGEN_STRONG_INLINE Packet1cd
pxor <Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(vec_xor(
a.v,
b.v)); }
151 template<> EIGEN_STRONG_INLINE Packet1cd
pandnot <Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b) {
return Packet1cd(vec_and(
a.v, vec_nor(
b.v,
b.v))); }
153 template<> EIGEN_STRONG_INLINE Packet1cd
pcmp_eq(
const Packet1cd&
a,
const Packet1cd&
b) {
159 template<> EIGEN_STRONG_INLINE
void prefetch<std::complex<double> >(
const std::complex<double> * addr) {
EIGEN_ZVECTOR_PREFETCH(addr); }
161 template<> EIGEN_STRONG_INLINE std::complex<double>
pfirst<Packet1cd>(
const Packet1cd&
a)
164 pstore<std::complex<double> >(&
res,
a);
169 template<> EIGEN_STRONG_INLINE Packet1cd
preverse(
const Packet1cd&
a) {
return a; }
170 template<> EIGEN_STRONG_INLINE std::complex<double>
predux<Packet1cd>(
const Packet1cd&
a)
180 template<> EIGEN_STRONG_INLINE Packet1cd
pdiv<Packet1cd>(
const Packet1cd&
a,
const Packet1cd&
b)
185 EIGEN_STRONG_INLINE Packet1cd
pcplxflip(
const Packet1cd&
x)
190 EIGEN_STRONG_INLINE
void ptranspose(PacketBlock<Packet1cd,2>& kernel)
194 kernel.packet[0].v = tmp;
200 template<> EIGEN_STRONG_INLINE
void pstore <std::complex<float> >(std::complex<float> * to,
const Packet2cf& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore((
float*)to, from.v); }
201 template<> EIGEN_STRONG_INLINE
void pstoreu<std::complex<float> >(std::complex<float> * to,
const Packet2cf& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu((
float*)to, from.v); }
203 template<> EIGEN_STRONG_INLINE std::complex<float>
pfirst<Packet2cf>(
const Packet2cf&
a)
206 pstore<std::complex<float> >(
res,
a);
212 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)
213 template<> EIGEN_STRONG_INLINE Packet2cf
pset1<Packet2cf>(
const std::complex<float>& from)
216 res.cd[0] = Packet1cd(vec_ld2f((
const float *)&from));
221 template<> EIGEN_STRONG_INLINE Packet2cf
pset1<Packet2cf>(
const std::complex<float>& from)
224 if((std::ptrdiff_t(&from) % 16) == 0)
233 template<>
EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(
const std::complex<float>* from,
Index stride)
236 af[0] = from[0*stride];
237 af[1] = from[1*stride];
240 template<>
EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to,
const Packet2cf& from,
Index stride)
243 pstore<std::complex<float> >((std::complex<float> *) af, from);
244 to[0*stride] = af[0];
245 to[1*stride] = af[1];
259 template<> EIGEN_STRONG_INLINE
void prefetch<std::complex<float> >(
const std::complex<float> * addr) {
EIGEN_ZVECTOR_PREFETCH(addr); }
262 #if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)
264 template<> EIGEN_STRONG_INLINE Packet2cf
pcmp_eq(
const Packet2cf&
a,
const Packet2cf&
b) {
267 Packet2d tmp1 = { eq.v4f[0][1], eq.v4f[0][0] };
268 Packet2d tmp2 = { eq.v4f[1][1], eq.v4f[1][0] };
274 template<> EIGEN_STRONG_INLINE Packet2cf
pconj(
const Packet2cf&
a)
282 template<> EIGEN_STRONG_INLINE Packet2cf
pmul<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b)
285 res.v.v4f[0] =
pmul(Packet1cd(
reinterpret_cast<Packet2d>(
a.v.v4f[0])), Packet1cd(
reinterpret_cast<Packet2d>(
b.v.v4f[0]))).v;
286 res.v.v4f[1] =
pmul(Packet1cd(
reinterpret_cast<Packet2d>(
a.v.v4f[1])), Packet1cd(
reinterpret_cast<Packet2d>(
b.v.v4f[1]))).v;
290 template<> EIGEN_STRONG_INLINE Packet2cf
preverse(
const Packet2cf&
a)
298 template<> EIGEN_STRONG_INLINE std::complex<float>
predux<Packet2cf>(
const Packet2cf&
a)
300 std::complex<float>
res;
302 vec_st2f(
b.v, (
float*)&
res);
308 std::complex<float>
res;
310 vec_st2f(
b.v, (
float*)&
res);
316 template<> EIGEN_STRONG_INLINE Packet2cf
pdiv<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b)
321 EIGEN_STRONG_INLINE Packet2cf
pcplxflip(
const Packet2cf&
x)
329 EIGEN_STRONG_INLINE
void ptranspose(PacketBlock<Packet2cf,2>& kernel)
331 Packet1cd tmp = kernel.packet[0].cd[1];
332 kernel.packet[0].cd[1] = kernel.packet[1].cd[0];
333 kernel.packet[1].cd[0] = tmp;
336 template<> EIGEN_STRONG_INLINE Packet2cf
pblend(
const Selector<2>& ifPacket,
const Packet2cf& thenPacket,
const Packet2cf& elsePacket) {
338 const Selector<4> ifPacket4 = { ifPacket.select[0], ifPacket.select[0], ifPacket.select[1], ifPacket.select[1] };
339 result.v = pblend<Packet4f>(ifPacket4, thenPacket.v, elsePacket.v);
343 template<> EIGEN_STRONG_INLINE Packet2cf
pcmp_eq(
const Packet2cf&
a,
const Packet2cf&
b) {
345 Packet4f tmp = { eq[1], eq[0], eq[3], eq[2] };
349 template<> EIGEN_STRONG_INLINE Packet2cf
pmul<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b)
360 prod_im = a_im *
b.v;
366 prod = pmadd<Packet4f>(a_re,
b.v, prod_im);
368 return Packet2cf(prod);
371 template<> EIGEN_STRONG_INLINE Packet2cf
preverse(
const Packet2cf&
a)
375 return Packet2cf(rev_a);
378 template<> EIGEN_STRONG_INLINE std::complex<float>
predux<Packet2cf>(
const Packet2cf&
a)
381 b = vec_sld(
a.v,
a.v, 8);
390 b = vec_sld(
a.v,
a.v, 8);
398 template<> EIGEN_STRONG_INLINE Packet2cf
pdiv<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b)
408 EIGEN_STRONG_INLINE
void ptranspose(PacketBlock<Packet2cf,2>& kernel)
412 kernel.packet[0].v = tmp;
415 template<> EIGEN_STRONG_INLINE Packet2cf
pblend(
const Selector<2>& ifPacket,
const Packet2cf& thenPacket,
const Packet2cf& elsePacket) {
417 result.v =
reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket,
reinterpret_cast<Packet2d>(thenPacket.v),
reinterpret_cast<Packet2d>(elsePacket.v)));
Array< int, Dynamic, 1 > v
#define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL)
#define EIGEN_DEBUG_ALIGNED_STORE
#define EIGEN_DEBUG_ALIGNED_LOAD
#define EIGEN_DEBUG_UNALIGNED_STORE
#define EIGEN_DEBUG_UNALIGNED_LOAD
#define EIGEN_DEVICE_FUNC
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Map< RowVectorXf > v2(M2.data(), M2.size())
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
#define EIGEN_ZVECTOR_PREFETCH(ADDR)
static Packet2ul p2ul_CONJ_XOR2
Packet1cd pxor< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2cf pandnot< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
void pstore(Scalar *to, const Packet &from)
std::complex< float > predux< Packet2cf >(const Packet2cf &a)
Packet1cd pload< Packet1cd >(const std::complex< double > *from)
Packet2cf padd< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet2cf ploaddup< Packet2cf >(const std::complex< float > *from)
std::complex< float > pfirst< Packet2cf >(const Packet2cf &a)
Packet2cf pset1< Packet2cf >(const std::complex< float > &from)
Packet4f pxor< Packet4f >(const Packet4f &a, const Packet4f &b)
Packet1cd pmul< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet1cd pdiv< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet1cd pandnot< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2cf ploadu< Packet2cf >(const std::complex< float > *from)
Packet4f por< Packet4f >(const Packet4f &a, const Packet4f &b)
static Packet16uc p16uc_TRANSPOSE64_LO
Packet4f pandnot< Packet4f >(const Packet4f &a, const Packet4f &b)
Packet1cd padd< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2cf pnegate(const Packet2cf &a)
Packet1cd ploadu< Packet1cd >(const std::complex< double > *from)
Packet4f pand< Packet4f >(const Packet4f &a, const Packet4f &b)
Packet2cf por< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet1cd pcplxflip(const Packet1cd &x)
Packet4f pcmp_eq< Packet4f >(const Packet4f &a, const Packet4f &b)
Packet2d pand< Packet2d >(const Packet2d &a, const Packet2d &b)
static Packet16uc p16uc_PSET32_WEVEN
std::complex< double > pfirst< Packet1cd >(const Packet1cd &a)
void pstoreu(Scalar *to, const Packet &from)
Packet2cf pcmp_eq(const Packet2cf &a, const Packet2cf &b)
bfloat16 pfirst(const Packet8bf &a)
Packet2cf pmul< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
__vector unsigned int Packet4ui
Packet pmul(const Packet &a, const Packet &b)
void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
static Packet4ui p4ui_CONJ_XOR
static Packet2ul p2ul_CONJ_XOR1
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pdiv_complex(const Packet &x, const Packet &y)
Packet2cf pcplxflip< Packet2cf >(const Packet2cf &x)
Packet1cd pand< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2cf pxor< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet4f padd< Packet4f >(const Packet4f &a, const Packet4f &b)
Packet4f ploadu< Packet4f >(const float *from)
std::complex< double > predux_mul< Packet1cd >(const Packet1cd &a)
std::complex< double > predux< Packet1cd >(const Packet1cd &a)
static Packet2d p2d_ZERO_
Packet1cd por< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2d ploadu< Packet2d >(const double *from)
Packet2cf pload< Packet2cf >(const std::complex< float > *from)
static Packet16uc p16uc_PSET64_HI
Packet2cf pand< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet1cd ploaddup< Packet1cd >(const std::complex< double > *from)
Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
Packet1cd pset1< Packet1cd >(const std::complex< double > &from)
Packet2cf pconj(const Packet2cf &a)
Packet2cf pdiv< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet2d pload< Packet2d >(const double *from)
Packet4f psub< Packet4f >(const Packet4f &a, const Packet4f &b)
static Packet16uc p16uc_PSET32_WODD
Packet2cf preverse(const Packet2cf &a)
static Packet16uc p16uc_PSET64_LO
Packet4f pload< Packet4f >(const float *from)
static Packet16uc p16uc_COMPLEX32_REV
static Packet16uc p16uc_COMPLEX32_REV2
Packet2cf psub< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet1cd psub< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
std::complex< float > predux_mul< Packet2cf >(const Packet2cf &a)
static Packet16uc p16uc_TRANSPOSE64_HI
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.