title: Combining numpys fancy indexing with slicing
body: <p>I currently have a two-dimensional numpy array of shape <code>(m, n)</code>. Furthermore, I have two <code>(m, p)</code> arrays of indices <code>i1</code> and <code>i2</code>. The indices are always contiguous!</p>
  
  <pre><code>import numpy as np
  t = np.array([[-1, -1,  0,  0,  1,  2,  2],
                [-1, -1,  0,  1,  2,  3,  3],
                [0,  0,  1,  2,  2,  3,  3]])
  
  i1 = np.array([3, 2, 2])
  i2 = np.array([4, 3, 3])
  </code></pre>
  
  <p>How do I use the arrays <code>i1</code> and <code>i2</code> to slice <code>t</code> in order to obtain the following sub-matrix?</p>
  
  <pre><code>expected_t = np.array([
                        [0, 1],
                        [0, 1],
                        [1, 2]
  ])
  </code></pre>
  
  <p>That is</p>
  
  <pre><code>expected_t[0, :] = t[0, i1[0]:i2[0]]
  expected_t[1, :] = t[1, i1[1]:i2[1]]
  expected_t[2, :] = t[2, i1[2]:i2[2]]
  </code></pre>
  
  <p>Furthermore, is this possible to do without copying the data by creating a view?</p>
  
  <p>Thanks in advance for all help! </p>