12#ifndef EIGEN_ARCH_CONJ_HELPER_H
13#define EIGEN_ARCH_CONJ_HELPER_H
15#define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \
17 struct conj_helper<PACKET_REAL, PACKET_CPLX, false, false> { \
18 EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const { \
19 return padd(c, this->pmul(x, y)); \
21 EIGEN_STRONG_INLINE PACKET_CPLX pmsub(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const { \
22 return psub(this->pmul(x, y), c); \
24 EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const { \
25 return PACKET_CPLX(Eigen::internal::pmul<PACKET_REAL>(x, y.v)); \
30 struct conj_helper<PACKET_CPLX, PACKET_REAL, false, false> { \
31 EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const { \
32 return padd(c, this->pmul(x, y)); \
34 EIGEN_STRONG_INLINE PACKET_CPLX pmsub(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const { \
35 return psub(this->pmul(x, y), c); \
37 EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const { \
38 return PACKET_CPLX(Eigen::internal::pmul<PACKET_REAL>(x.v, y)); \
43#include "../../InternalHeaderCheck.h"
48template <
bool Conjugate>
54 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(
const T& x)
const {
55 return numext::conj(x);
58 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T pconj(
const T& x)
const {
59 return internal::pconj(x);
64struct conj_if<false> {
66 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const T& operator()(
const T& x)
const {
70 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const T& pconj(
const T& x)
const {
77template <
typename LhsType,
typename RhsType,
bool ConjLhs,
bool ConjRhs>
79 using ResultType =
typename ScalarBinaryOpTraits<LhsType, RhsType>::ReturnType;
81 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmadd(
const LhsType& x,
const RhsType& y,
82 const ResultType& c)
const {
83 return this->pmul(x, y) + c;
86 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmsub(
const LhsType& x,
const RhsType& y,
87 const ResultType& c)
const {
88 return this->pmul(x, y) - c;
91 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(
const LhsType& x,
const RhsType& y)
const {
92 return conj_if<ConjLhs>()(x) * conj_if<ConjRhs>()(y);
96template <
typename LhsScalar,
typename RhsScalar>
97struct conj_helper<LhsScalar, RhsScalar, true, true> {
98 using ResultType =
typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType;
100 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmadd(
const LhsScalar& x,
const RhsScalar& y,
101 const ResultType& c)
const {
102 return this->pmul(x, y) + c;
106 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(
const LhsScalar& x,
const RhsScalar& y)
const {
107 return numext::conj(x * y);
112template <
typename Packet,
bool ConjLhs,
bool ConjRhs>
113struct conj_helper<Packet, Packet, ConjLhs, ConjRhs> {
114 using ResultType = Packet;
115 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmadd(
const Packet& x,
const Packet& y,
const Packet& c)
const {
116 return Eigen::internal::pmadd(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y), c);
119 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmsub(
const Packet& x,
const Packet& y,
const Packet& c)
const {
120 return Eigen::internal::pmsub(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y), c);
123 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmul(
const Packet& x,
const Packet& y)
const {
124 return Eigen::internal::pmul(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y));
128template <
typename Packet>
129struct conj_helper<Packet, Packet, true, true> {
130 using ResultType = Packet;
132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmadd(
const Packet& x,
const Packet& y,
const Packet& c)
const {
133 return Eigen::internal::pmadd(pconj(x), pconj(y), c);
135 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmsub(
const Packet& x,
const Packet& y,
const Packet& c)
const {
136 return Eigen::internal::pmsub(pconj(x), pconj(y), c);
139 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmul(
const Packet& x,
const Packet& y)
const {
140 return pconj(Eigen::internal::pmul(x, y));