Acyclic shifting of arrays (`eoshift`) in Julia
Circular shifting cshift in fortran as an equivalent in Julia : circshift. But I'am seeking an equivalent of eoshift (https://fortranwiki.org/fortran/show/eoshift) which is a acyclic shifting that pads the new slots with zeros or some another boundary value. For 1D arrays, I can emulate it using diagonal matrices like in eoshift(x, k) = diagm(k=> ones(length(x)-abs(k)))*x but I prefer to find a more built-in way to compute it in Julia Bests, For instance eoshit([1:9;], 2) => 3 4 5 6 7 8 9 0 0 eoshift([1:9;] -2) => 0 0 1 2 3 4 5 6 7
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.