return early if there are no non-zero elements

This commit is contained in:
conrad
2025-06-29 22:52:33 +10:00
parent a902935f11
commit e7bd7e4e18
+4
View File
@@ -1408,6 +1408,8 @@ accu(const SpOp<T1, spop_square>& expr)
{
const SpSubview_col<eT>& svcol = reinterpret_cast<const SpSubview_col<eT>&>(expr.m);
if(svcol.n_nonzero == 0) { return eT(0); }
if(svcol.n_rows == svcol.m.n_rows)
{
arma_debug_print("accu(): SpSubview_col spop_square optimisation");
@@ -1460,6 +1462,8 @@ accu_spop_omit_helper(const T1& expr, functor is_omitted)
{
const SpSubview_col<eT>& svcol = reinterpret_cast<const SpSubview_col<eT>&>(expr);
if(svcol.n_nonzero == 0) { return eT(0); }
if(svcol.n_rows == svcol.m.n_rows)
{
arma_debug_print("accu_spop_omit_helper(): SpSubview_col optimisation");