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) \
16 template <bool ConjLhs, bool ConjRhs> \
17 struct conj_helper<PACKET_REAL, PACKET_CPLX, ConjLhs, ConjRhs> { \
18 EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const { \
19 return PACKET_CPLX(Eigen::internal::pmadd<PACKET_REAL>(x, conj_if<ConjRhs>().pconj(y).v, c.v)); \
21 EIGEN_STRONG_INLINE PACKET_CPLX pmsub(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const { \
22 return PACKET_CPLX(Eigen::internal::pmsub<PACKET_REAL>(x, conj_if<ConjRhs>().pconj(y).v, c.v)); \
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, conj_if<ConjRhs>().pconj(y).v)); \
30 struct conj_helper<PACKET_REAL, PACKET_CPLX, true, true> : conj_helper<PACKET_REAL, PACKET_CPLX, false, true> {}; \
32 template <bool ConjLhs, bool ConjRhs> \
33 struct conj_helper<PACKET_CPLX, PACKET_REAL, ConjLhs, ConjRhs> { \
34 EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const { \
35 return PACKET_CPLX(Eigen::internal::pmadd<PACKET_REAL>(conj_if<ConjLhs>().pconj(x).v, y, c.v)); \
37 EIGEN_STRONG_INLINE PACKET_CPLX pmsub(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const { \
38 return PACKET_CPLX(Eigen::internal::pmsub<PACKET_REAL>(conj_if<ConjLhs>().pconj(x).v, y, c.v)); \
40 EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const { \
41 return PACKET_CPLX(Eigen::internal::pmul<PACKET_REAL>(conj_if<ConjLhs>().pconj(x).v, y)); \
45 struct conj_helper<PACKET_CPLX, PACKET_REAL, true, true> : conj_helper<PACKET_CPLX, PACKET_REAL, true, false> {};
48#include "../../InternalHeaderCheck.h"
53template <
bool Conjugate>
59 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(
const T& x)
const {
60 return numext::conj(x);
63 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T pconj(
const T& x)
const {
64 return internal::pconj(x);
69struct conj_if<false> {
71 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const T& operator()(
const T& x)
const {
75 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const T& pconj(
const T& x)
const {
82template <
typename LhsType,
typename RhsType,
bool ConjLhs,
bool ConjRhs>
84 using ResultType =
typename ScalarBinaryOpTraits<LhsType, RhsType>::ReturnType;
86 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmadd(
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 pmsub(
const LhsType& x,
const RhsType& y,
92 const ResultType& c)
const {
93 return this->pmul(x, y) - c;
96 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(
const LhsType& x,
const RhsType& y)
const {
97 return internal::mul(conj_if<ConjLhs>()(x), conj_if<ConjRhs>()(y));
101template <
typename LhsScalar,
typename RhsScalar>
102struct conj_helper<LhsScalar, RhsScalar, true, true> {
103 using ResultType =
typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType;
105 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmadd(
const LhsScalar& x,
const RhsScalar& y,
106 const ResultType& c)
const {
107 return this->pmul(x, y) + c;
111 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(
const LhsScalar& x,
const RhsScalar& y)
const {
112 EIGEN_IF_CONSTEXPR ((functor_is_commutative<scalar_product_op<LhsScalar, RhsScalar>>::value)) {
113 return numext::conj(internal::mul(x, y));
115 return internal::mul(numext::conj(x), numext::conj(y));
121template <
typename Packet,
bool ConjLhs,
bool ConjRhs>
122struct conj_helper<Packet, Packet, ConjLhs, ConjRhs> {
123 using ResultType = Packet;
124 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmadd(
const Packet& x,
const Packet& y,
const Packet& c)
const {
125 return Eigen::internal::pmadd(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y), c);
128 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmsub(
const Packet& x,
const Packet& y,
const Packet& c)
const {
129 return Eigen::internal::pmsub(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y), c);
132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmul(
const Packet& x,
const Packet& y)
const {
133 return Eigen::internal::pmul(conj_if<ConjLhs>().pconj(x), conj_if<ConjRhs>().pconj(y));
137template <
typename Packet>
138struct conj_helper<Packet, Packet, true, true> {
139 using ResultType = Packet;
141 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmadd(
const Packet& x,
const Packet& y,
const Packet& c)
const {
142 return Eigen::internal::pmadd(pconj(x), pconj(y), c);
144 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmsub(
const Packet& x,
const Packet& y,
const Packet& c)
const {
145 return Eigen::internal::pmsub(pconj(x), pconj(y), c);
147 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pmul(
const Packet& x,
const Packet& y)
const {
148 EIGEN_IF_CONSTEXPR ((functor_is_commutative<scalar_product_op<
typename unpacket_traits<Packet>::type>>::value)) {
149 return pconj(Eigen::internal::pmul(x, y));
151 return Eigen::internal::pmul(pconj(x), pconj(y));