How can I slice a numpy
array beyond its shape such that values in the array are repeated without having to store the entire array in memory? Here's what I'd like to do:
x = numpy.array([[1, 2], [3, 4]])
x[0:3, 0:3]
->
[[1, 2, 1, 2],
[3, 4, 3, 4],
[1, 2, 1, 2],
[3, 4, 3, 4]]
I am aware of numpy.repeat
and numpy.tile
but both of these make a copy of the array, and I would like to slice my array like x[1238123:1238143,5328932:5328941]
without needing to make millions of copies of the smaller array.