Fix product for custom complex type. (conjugation was ignored)

This commit is contained in:
Gael Guennebaud 2016-09-14 18:28:49 +02:00
parent c10620b2b0
commit 1c8347e554

View File

@ -434,15 +434,16 @@ public:
template<typename LhsPacketType, typename RhsPacketType, typename AccPacketType> template<typename LhsPacketType, typename RhsPacketType, typename AccPacketType>
EIGEN_STRONG_INLINE void madd(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, AccPacketType& tmp) const EIGEN_STRONG_INLINE void madd(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, AccPacketType& tmp) const
{ {
conj_helper<LhsPacketType,RhsPacketType,ConjLhs,ConjRhs> cj;
// It would be a lot cleaner to call pmadd all the time. Unfortunately if we // It would be a lot cleaner to call pmadd all the time. Unfortunately if we
// let gcc allocate the register in which to store the result of the pmul // let gcc allocate the register in which to store the result of the pmul
// (in the case where there is no FMA) gcc fails to figure out how to avoid // (in the case where there is no FMA) gcc fails to figure out how to avoid
// spilling register. // spilling register.
#ifdef EIGEN_HAS_SINGLE_INSTRUCTION_MADD #ifdef EIGEN_HAS_SINGLE_INSTRUCTION_MADD
EIGEN_UNUSED_VARIABLE(tmp); EIGEN_UNUSED_VARIABLE(tmp);
c = pmadd(a,b,c); c = cj.pmadd(a,b,c);
#else #else
tmp = b; tmp = pmul(a,tmp); c = padd(c,tmp); tmp = b; tmp = cj.pmul(a,tmp); c = padd(c,tmp);
#endif #endif
} }
@ -457,9 +458,6 @@ public:
r = pmadd(c,alpha,r); r = pmadd(c,alpha,r);
} }
protected:
// conj_helper<LhsScalar,RhsScalar,ConjLhs,ConjRhs> cj;
// conj_helper<LhsPacket,RhsPacket,ConjLhs,ConjRhs> pcj;
}; };
template<typename RealScalar, bool _ConjLhs> template<typename RealScalar, bool _ConjLhs>