title: Fast numpy roll
body: <p>I have a 2d numpy array and I want to roll each row in an incremental fashion. I am using <code>np.roll</code> in a <code>for</code> loop to do so. But since I am calling this thousands of times, my code is really slow. Can you please help me out on how to make it faster.</p>
  
  <p>My input looks like </p>
  
  <pre><code>array([[4,1],
         [0,2]])
  </code></pre>
  
  <p>and my output looks like</p>
  
  <pre><code>array([[4,1],
         [2,0]])
  </code></pre>
  
  <p>Here the zeroth row <code>[4,1]</code> was shifted by 0, and the first row <code>[0,2]</code> was shifted by 1. Similarly the second row will be shifted by 2 and so on.</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>temp = np.zeros([dd,dd])
  for i in range(min(t + 1, dd)):
      temp[i,:] = np.roll(y[i,:], i, axis=0)
  </code></pre>