From eef2a2706c7e36578cbfb360d1a60e7bf58aff75 Mon Sep 17 00:00:00 2001 From: conrad Date: Tue, 6 Feb 2024 11:35:20 +1000 Subject: [PATCH] minor optimisation --- include/armadillo_bits/op_shift_meat.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/armadillo_bits/op_shift_meat.hpp b/include/armadillo_bits/op_shift_meat.hpp index b369b5d3..216290b5 100644 --- a/include/armadillo_bits/op_shift_meat.hpp +++ b/include/armadillo_bits/op_shift_meat.hpp @@ -64,6 +64,8 @@ op_shift::apply_noalias(Mat& out, const Mat& X, const uword len, const u arma_debug_check_bounds( ((dim == 0) && (len >= X.n_rows)), "shift(): shift amount out of bounds" ); arma_debug_check_bounds( ((dim == 1) && (len >= X.n_cols)), "shift(): shift amount out of bounds" ); + if(len == 0) { out = X; return; } + out.copy_size(X); const uword X_n_rows = X.n_rows;