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;