From fab4e3a753fa514a23c0c6ab78e0afab59918370 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Wed, 2 Oct 2019 12:48:17 -0700 Subject: [PATCH] Address comments on Chebyshev evaluation code: 1. Use pmadd when possible. 2. Add casts to avoid c++03 warnings. --- Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index a354fb5fe..d3a2f4ed5 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -626,17 +626,18 @@ template struct pchebevl { EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Packet run(Packet x, const typename unpacket_traits::type coef[]) { + typedef typename unpacket_traits::type Scalar; Packet b0 = pset1(coef[0]); - Packet b1 = pset1(0.f); + Packet b1 = pset1(static_cast(0.f)); Packet b2; for (int i = 1; i < N; i++) { b2 = b1; b1 = b0; - b0 = padd(psub(pmul(x, b1), b2), pset1(coef[i])); + b0 = psub(pmadd(x, b1, pset1(coef[i])), b2); } - return pmul(pset1(0.5f), psub(b0, b2)); + return pmul(pset1(static_cast(0.5f)), psub(b0, b2)); } };