13 #ifndef EIGEN_COMPLEX_MSA_H
14 #define EIGEN_COMPLEX_MSA_H
18 #include "../../InternalHeaderCheck.h"
26 EIGEN_STRONG_INLINE Packet2cf() {
28 EIGEN_STRONG_INLINE
explicit Packet2cf(
const std::complex<float>&
a,
29 const std::complex<float>&
b) {
33 EIGEN_STRONG_INLINE
explicit Packet2cf(
const Packet4f&
a) :
v(
a) {
35 EIGEN_STRONG_INLINE Packet2cf(
const Packet2cf&
a) :
v(
a.
v) {
37 EIGEN_STRONG_INLINE Packet2cf& operator=(
const Packet2cf&
b) {
41 EIGEN_STRONG_INLINE Packet2cf
conjugate(
void)
const {
42 return Packet2cf((
Packet4f)__builtin_msa_bnegi_d((v2u64)
v, 63));
44 EIGEN_STRONG_INLINE Packet2cf&
operator*=(
const Packet2cf&
b) {
48 v1 = (
Packet4f)__builtin_msa_ilvev_w((v4i32)
v, (v4i32)
v);
50 v2 = (
Packet4f)__builtin_msa_ilvod_w((v4i32)
v, (v4i32)
v);
56 v2 = Packet2cf(
v2).conjugate().v;
63 EIGEN_STRONG_INLINE Packet2cf
operator*(
const Packet2cf&
b)
const {
64 return Packet2cf(*
this) *=
b;
66 EIGEN_STRONG_INLINE Packet2cf&
operator+=(
const Packet2cf&
b) {
70 EIGEN_STRONG_INLINE Packet2cf
operator+(
const Packet2cf&
b)
const {
71 return Packet2cf(*
this) +=
b;
73 EIGEN_STRONG_INLINE Packet2cf&
operator-=(
const Packet2cf&
b) {
77 EIGEN_STRONG_INLINE Packet2cf
operator-(
const Packet2cf&
b)
const {
78 return Packet2cf(*
this) -=
b;
80 EIGEN_STRONG_INLINE Packet2cf
operator/(
const Packet2cf&
b)
const {
83 EIGEN_STRONG_INLINE Packet2cf&
operator/=(
const Packet2cf&
b) {
84 *
this = Packet2cf(*
this) /
b;
87 EIGEN_STRONG_INLINE Packet2cf
operator-(
void)
const {
94 inline std::ostream&
operator<<(std::ostream& os,
const Packet2cf& value) {
95 os <<
"[ (" << value.v[0] <<
", " << value.v[1]
98 << value.v[2] <<
", " << value.v[3] <<
"i) ]";
103 struct packet_traits<
std::complex<float> > : default_packet_traits {
104 typedef Packet2cf type;
105 typedef Packet2cf
half;
126 struct unpacket_traits<Packet2cf> {
127 typedef std::complex<float> type;
128 enum {
size = 2, alignment =
Aligned16, vectorizable=
true, masked_load_available=
false, masked_store_available=
false };
129 typedef Packet2cf half;
133 EIGEN_STRONG_INLINE Packet2cf
pset1<Packet2cf>(
const std::complex<float>& from) {
136 float f0 = from.real(), f1 = from.imag();
143 EIGEN_STRONG_INLINE Packet2cf
padd<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
150 EIGEN_STRONG_INLINE Packet2cf
psub<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
157 EIGEN_STRONG_INLINE Packet2cf
pnegate(
const Packet2cf&
a) {
164 EIGEN_STRONG_INLINE Packet2cf
pconj(
const Packet2cf&
a) {
167 return a.conjugate();
178 EIGEN_STRONG_INLINE Packet2cf
pand<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
181 return Packet2cf(
pand(
a.v,
b.v));
185 EIGEN_STRONG_INLINE Packet2cf
por<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
188 return Packet2cf(
por(
a.v,
b.v));
192 EIGEN_STRONG_INLINE Packet2cf
pxor<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
195 return Packet2cf(
pxor(
a.v,
b.v));
206 EIGEN_STRONG_INLINE Packet2cf
pload<Packet2cf>(
const std::complex<float>* from) {
213 EIGEN_STRONG_INLINE Packet2cf
ploadu<Packet2cf>(
const std::complex<float>* from) {
227 EIGEN_STRONG_INLINE
void pstore<std::complex<float> >(std::complex<float>* to,
228 const Packet2cf& from) {
235 EIGEN_STRONG_INLINE
void pstoreu<std::complex<float> >(std::complex<float>* to,
236 const Packet2cf& from) {
244 const std::complex<float>* from,
Index stride) {
247 return Packet2cf(from[0 * stride], from[1 * stride]);
251 EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to,
252 const Packet2cf& from,
256 *to = std::complex<float>(from.v[0], from.v[1]);
258 *to = std::complex<float>(from.v[2], from.v[3]);
262 EIGEN_STRONG_INLINE
void prefetch<std::complex<float> >(
const std::complex<float>* addr) {
265 prefetch(
reinterpret_cast<const float*
>(addr));
272 return std::complex<float>(
a.v[0],
a.v[1]);
276 EIGEN_STRONG_INLINE Packet2cf
preverse(
const Packet2cf&
a) {
295 return std::complex<float>(value[0], value[1]);
302 return std::complex<float>((
a.v[0] *
a.v[2]) - (
a.v[1] *
a.v[3]),
303 (
a.v[0] *
a.v[3]) + (
a.v[1] *
a.v[2]));
309 EIGEN_STRONG_INLINE Packet2cf
pdiv<Packet2cf>(
const Packet2cf&
a,
const Packet2cf&
b) {
315 inline std::ostream&
operator<<(std::ostream& os,
const PacketBlock<Packet2cf, 2>& value) {
316 os <<
"[ " << value.packet[0] <<
", " << std::endl <<
" " << value.packet[1] <<
" ]";
324 (
Packet4f)__builtin_msa_ilvl_d((v2i64)kernel.packet[1].v, (v2i64)kernel.packet[0].v);
326 (
Packet4f)__builtin_msa_ilvr_d((v2i64)kernel.packet[1].v, (v2i64)kernel.packet[0].v);
327 kernel.packet[1].v = tmp;
331 EIGEN_STRONG_INLINE Packet2cf
pblend(
const Selector<2>& ifPacket,
const Packet2cf& thenPacket,
332 const Packet2cf& elsePacket) {
333 return (Packet2cf)(
Packet4f)pblend<Packet2d>(ifPacket, (
Packet2d)thenPacket.v,
340 EIGEN_STRONG_INLINE Packet1cd() {
342 EIGEN_STRONG_INLINE
explicit Packet1cd(
const std::complex<double>&
a) {
346 EIGEN_STRONG_INLINE
explicit Packet1cd(
const Packet2d&
a) :
v(
a) {
348 EIGEN_STRONG_INLINE Packet1cd(
const Packet1cd&
a) :
v(
a.
v) {
350 EIGEN_STRONG_INLINE Packet1cd& operator=(
const Packet1cd&
b) {
354 EIGEN_STRONG_INLINE Packet1cd
conjugate(
void)
const {
355 static const v2u64 p2ul_CONJ_XOR = { 0x0, 0x8000000000000000 };
358 EIGEN_STRONG_INLINE Packet1cd&
operator*=(
const Packet1cd&
b) {
362 v1 = (
Packet2d)__builtin_msa_ilvev_d((v2i64)
v, (v2i64)
v);
364 v2 = (
Packet2d)__builtin_msa_ilvod_d((v2i64)
v, (v2i64)
v);
370 v2 = Packet1cd(
v2).conjugate().v;
377 EIGEN_STRONG_INLINE Packet1cd
operator*(
const Packet1cd&
b)
const {
378 return Packet1cd(*
this) *=
b;
380 EIGEN_STRONG_INLINE Packet1cd&
operator+=(
const Packet1cd&
b) {
384 EIGEN_STRONG_INLINE Packet1cd
operator+(
const Packet1cd&
b)
const {
385 return Packet1cd(*
this) +=
b;
387 EIGEN_STRONG_INLINE Packet1cd&
operator-=(
const Packet1cd&
b) {
391 EIGEN_STRONG_INLINE Packet1cd
operator-(
const Packet1cd&
b)
const {
392 return Packet1cd(*
this) -=
b;
394 EIGEN_STRONG_INLINE Packet1cd&
operator/=(
const Packet1cd&
b) {
395 *
this *=
b.conjugate();
397 s =
padd(s, preverse<Packet2d>(s));
401 EIGEN_STRONG_INLINE Packet1cd
operator/(
const Packet1cd&
b)
const {
402 return Packet1cd(*
this) /=
b;
404 EIGEN_STRONG_INLINE Packet1cd
operator-(
void)
const {
411 inline std::ostream&
operator<<(std::ostream& os,
const Packet1cd& value) {
412 os <<
"[ (" << value.v[0] <<
", " << value.v[1] <<
"i) ]";
417 struct packet_traits<
std::complex<double> > : default_packet_traits {
418 typedef Packet1cd type;
419 typedef Packet1cd
half;
439 struct unpacket_traits<Packet1cd> {
440 typedef std::complex<double> type;
441 enum {
size = 1, alignment =
Aligned16, vectorizable=
true, masked_load_available=
false, masked_store_available=
false };
442 typedef Packet1cd half;
463 return Packet1cd(from);
481 EIGEN_STRONG_INLINE Packet1cd
pnegate(
const Packet1cd&
a) {
488 EIGEN_STRONG_INLINE Packet1cd
pconj(
const Packet1cd&
a) {
491 return a.conjugate();
505 return Packet1cd(
pand(
a.v,
b.v));
512 return Packet1cd(
por(
a.v,
b.v));
519 return Packet1cd(
pxor(
a.v,
b.v));
537 EIGEN_STRONG_INLINE
void pstore<std::complex<double> >(std::complex<double>* to,
538 const Packet1cd& from) {
545 EIGEN_STRONG_INLINE
void pstoreu<std::complex<double> >(std::complex<double>* to,
546 const Packet1cd& from) {
553 EIGEN_STRONG_INLINE
void prefetch<std::complex<double> >(
const std::complex<double>* addr) {
556 prefetch(
reinterpret_cast<const double*
>(addr));
571 EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::complex<double>* to,
572 const Packet1cd& from,
584 return std::complex<double>(
a.v[0],
a.v[1]);
588 EIGEN_STRONG_INLINE Packet1cd
preverse(
const Packet1cd&
a) {
617 EIGEN_STRONG_INLINE Packet1cd
pcplxflip (
const Packet1cd&
x) {
623 inline std::ostream&
operator<<(std::ostream& os,
const PacketBlock<Packet1cd, 2>& value) {
624 os <<
"[ " << value.packet[0] <<
", " << std::endl <<
" " << value.packet[1] <<
" ]";
628 EIGEN_STRONG_INLINE
void ptranspose(PacketBlock<Packet1cd, 2>& kernel) {
633 v1 = (
Packet2d)__builtin_msa_ilvev_d((v2i64)kernel.packet[0].v, (v2i64)kernel.packet[1].v);
635 v2 = (
Packet2d)__builtin_msa_ilvod_d((v2i64)kernel.packet[0].v, (v2i64)kernel.packet[1].v);
637 kernel.packet[0].v =
v1;
638 kernel.packet[1].v =
v2;
Array< int, Dynamic, 1 > v
const ImagReturnType imag() const
RealReturnType real() const
ConjugateReturnType conjugate() const
#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_MSA_SHF_I8(a, b, c, d)
#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())
bfloat16 & operator/=(bfloat16 &a, const bfloat16 &b)
bfloat16 & operator*=(bfloat16 &a, const bfloat16 &b)
bfloat16 & operator+=(bfloat16 &a, const bfloat16 &b)
bfloat16 & operator-=(bfloat16 &a, const bfloat16 &b)
bfloat16 operator/(const bfloat16 &a, const bfloat16 &b)
std::ostream & operator<<(std::ostream &s, const Packet16c &v)
Packet padd(const Packet &a, const Packet &b)
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)
void pstore< float >(float *to, const Packet4f &from)
std::complex< float > predux< Packet2cf >(const Packet2cf &a)
Packet1cd pload< Packet1cd >(const std::complex< double > *from)
Packet2d pmul< Packet2d >(const Packet2d &a, const Packet2d &b)
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)
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)
Packet8h pandnot(const Packet8h &a, const Packet8h &b)
Packet1cd padd< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet2cf pnegate(const Packet2cf &a)
Packet1cd ploadu< Packet1cd >(const std::complex< double > *from)
Packet2cf por< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet1cd pcplxflip(const Packet1cd &x)
std::complex< double > pfirst< Packet1cd >(const Packet1cd &a)
bfloat16 pfirst(const Packet8bf &a)
void pstoreu< double >(double *to, const Packet4d &from)
Packet2cf pmul< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet pmul(const Packet &a, const Packet &b)
void ptranspose(PacketBlock< Packet2cf, 2 > &kernel)
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 ploadu< Packet4f >(const float *from)
std::complex< double > predux_mul< Packet1cd >(const Packet1cd &a)
Packet psub(const Packet &a, const Packet &b)
void prefetch(const Scalar *addr)
std::complex< double > predux< Packet1cd >(const Packet1cd &a)
Packet1cd por< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
Packet8h pand(const Packet8h &a, const Packet8h &b)
Packet2d ploadu< Packet2d >(const double *from)
void pstoreu< float >(float *to, const Packet4f &from)
Packet2cf pload< Packet2cf >(const std::complex< float > *from)
Packet2cf pand< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet8h pxor(const Packet8h &a, const Packet8h &b)
Packet1cd ploaddup< Packet1cd >(const std::complex< double > *from)
Packet pdiv(const Packet &a, const Packet &b)
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)
Packet2cf preverse(const Packet2cf &a)
Packet4f pload< Packet4f >(const float *from)
Packet8h por(const Packet8h &a, const Packet8h &b)
svint32_t PacketXi __attribute__((arm_sve_vector_bits(EIGEN_ARM64_SVE_VL)))
Packet2cf psub< Packet2cf >(const Packet2cf &a, const Packet2cf &b)
Packet1cd psub< Packet1cd >(const Packet1cd &a, const Packet1cd &b)
void pstore< double >(double *to, const Packet4d &from)
std::complex< float > predux_mul< Packet2cf >(const Packet2cf &a)
const CwiseBinaryOp< internal::scalar_difference_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator-(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
const CwiseBinaryOp< internal::scalar_sum_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator+(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)