Suppose a is some 1d numppy.array with n elements:
a = np.array([a_0, a_1, ..., a_n_minus_1])
I'd like to generate the 2d (n X n) numpy.array containing, at row i, the ith cyclic shift of a:
np.array([[a_0, a_1, ..., a_n_minus_1], [a_n_minus_1, a_0, a_1, ...], ...]])
preferably without loops. How can this be done efficiently?
(The function np.roll seems related, but apparently takes only a scalar shift.)