From 8e759ade831b75dbdb674cef01af605c589b87b1 Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sun, 1 Sep 2019 18:26:25 +0200 Subject: [PATCH] Fix multiplication between matrices of dimension 0. Fix #644 --- src/base/blas.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/base/blas.rs b/src/base/blas.rs index beb83c4b..1875e734 100644 --- a/src/base/blas.rs +++ b/src/base/blas.rs @@ -565,6 +565,7 @@ where ); if ncols2 == 0 { + self.fill(N::zero()); return; } @@ -1006,6 +1007,12 @@ where N: Scalar + Zero + ClosedAdd + ClosedMul "gemm: dimensions mismatch for addition." ); + + if a.ncols() == 0 { + self.fill(N::zero()); + return; + } + // We assume large matrices will be Dynamic but small matrices static. // We could use matrixmultiply for large statically-sized matrices but the performance // threshold to activate it would be different from SMALL_DIM because our code optimizes