I'd like to create a 1D NumPy array that would consist of 1000 back-to-back repetitions of another 1D array, without replicating the data 1000 times.
Is it possible?
If it helps, I intend to treat both arrays as immutable.
You can't do this; a NumPy array must have a consistent stride along each dimension, while your strides would need to go one way most of the time but sometimes jump backwards.
The closest you can get is either a 1000-row 2D array where every row is a view of your first array, or a
flatiter object, which behaves kind of like a 1D array. (flatiters support iteration and indexing, but you can't take views of them; all indexing makes a copy.)
import numpy as np a = np.arange(10)
b = np.lib.stride_tricks.as_strided(a, (1000, a.size), (0, a.itemsize))
c = b.flat