From efc7c2121a88657a62ab967e52222d0f60eaefb9 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 16 Dec 2015 09:42:56 +0100 Subject: [PATCH] Backport early cut return for empty matrix product --- Eigen/src/Core/products/GeneralMatrixMatrix.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h index 2ac805ec8..649bd3f96 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrix.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h @@ -401,6 +401,8 @@ class GeneralProduct template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); + if(a_lhs.cols()==0 || a_lhs.rows()==0 || a_rhs.cols()==0) + return; typename internal::add_const_on_value_type::type lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type::type rhs = RhsBlasTraits::extract(m_rhs);