From e05bc82e7bdaf8f25a2b170aa0b4e039d5e549e7 Mon Sep 17 00:00:00 2001 From: conrad Date: Thu, 12 Mar 2026 15:30:34 +1000 Subject: [PATCH] speedups for empty subcubes --- include/armadillo_bits/subview_cube_meat.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/armadillo_bits/subview_cube_meat.hpp b/include/armadillo_bits/subview_cube_meat.hpp index 8382fbce..8b0e9c3a 100644 --- a/include/armadillo_bits/subview_cube_meat.hpp +++ b/include/armadillo_bits/subview_cube_meat.hpp @@ -1125,6 +1125,8 @@ subview_cube::each_slice(const std::function< void(Mat&) >& F) { arma_debug_sigprint(); + if( (n_rows == 0) || (n_cols == 0) ) { return; } + Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); Mat tmp2('j', tmp1.memptr(), n_rows, n_cols); @@ -1153,6 +1155,8 @@ subview_cube::each_slice(const std::function< void(const Mat&) >& F) con { arma_debug_sigprint(); + if( (n_rows == 0) || (n_cols == 0) ) { return; } + Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); const Mat tmp2('j', tmp1.memptr(), n_rows, n_cols);