From 1ec8ff74642bd01a3e8ee75686d7801f477e5ec5 Mon Sep 17 00:00:00 2001 From: conrad Date: Fri, 6 Oct 2023 13:19:22 +1000 Subject: [PATCH] minor optimisation --- include/armadillo_bits/Mat_meat.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/armadillo_bits/Mat_meat.hpp b/include/armadillo_bits/Mat_meat.hpp index a96fbd9b..4cb8d765 100644 --- a/include/armadillo_bits/Mat_meat.hpp +++ b/include/armadillo_bits/Mat_meat.hpp @@ -2657,6 +2657,8 @@ Mat::operator=(const SpBase& m) (*this).zeros(x.n_rows, x_n_cols); + if(x.n_nonzero == 0) { return *this; } + const eT* x_values = x.values; const uword* x_row_indices = x.row_indices; const uword* x_col_ptrs = x.col_ptrs;