From 8ac2fb077dfcdf9a6fa78a871c494594dfa795b0 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Wed, 2 Jul 2025 15:51:28 -0700 Subject: [PATCH] Use numext::fma for sparse x dense dot product. --- Eigen/src/SparseCore/SparseDot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eigen/src/SparseCore/SparseDot.h b/Eigen/src/SparseCore/SparseDot.h index f040915b2..76a4f6cb7 100644 --- a/Eigen/src/SparseCore/SparseDot.h +++ b/Eigen/src/SparseCore/SparseDot.h @@ -36,10 +36,10 @@ inline typename internal::traits::Scalar SparseMatrixBase::dot Scalar res1(0); Scalar res2(0); for (; i; ++i) { - res1 += numext::conj(i.value()) * other.coeff(i.index()); + res1 = numext::fma(numext::conj(i.value()), other.coeff(i.index()), res1); ++i; if (i) { - res2 += numext::conj(i.value()) * other.coeff(i.index()); + res2 = numext::fma(numext::conj(i.value()), other.coeff(i.index()), res2); } } return res1 + res2;