I was hoping a more concise solution using maybe vector operations, but at least with loops it works. Just two remarks : the rationale for having charfillvalue and fillvalue is a litlle bit disappoiting and
in Fortran the shift argument could be a vector such as in the following example
`a = eoshift(reshape([(i,i=1,9)], [3, 3]) , shift=[1, 2, 1], boundary=-5, dim=2) `
transforms
1 4 7 4 7 -5
2 5 8 -> 8 -5 -5
3 6 9 6 9 -5