title: Is it possible to use einsum to transpose everything?
body: <p>Ok, I know how to transpose a matrix, with for instance:</p>
  
  <pre><code>A = np.arange(25).reshape(5, 5)
  print A
  array([[ 0,  1,  2,  3,  4],
     [ 5,  6,  7,  8,  9],
     [10, 11, 12, 13, 14],
     [15, 16, 17, 18, 19],
     [20, 21, 22, 23, 24]])
  A.T
  array([[ 0,  5, 10, 15, 20],
     [ 1,  6, 11, 16, 21],
     [ 2,  7, 12, 17, 22],
     [ 3,  8, 13, 18, 23],
     [ 4,  9, 14, 19, 24]])
  </code></pre>
  
  <p>In the case of unidimensional arrays, it's not possible to use this ".T" tool (I don't know why, honestly) so to transpose a vector you have to change the paradigm and use, for instance:</p>
  
  <pre><code>B = np.arange(5) 
  print B
  array([0, 1, 2, 3, 4])
  </code></pre>
  
  <p>and because <code>B.T</code> would give the same result, we, applying this change of paradigm, use:</p>
  
  <pre><code>B[ :, np.newaxis]
  array([[0],
     [1],
     [2],
     [3],
     [4]])
  </code></pre>
  
  <p>and I find this change of paradigm a little bit antiesthetic because a 1-D vector is in no way a different entity to a 2-D vector (a matrix), in the sense that mathematically speaking they come from the same family and share many things.</p>
  
  <p>My question is: is it possible to do this tranposition with the (sometimes called) jewel of the crown of numpy that is einsum, in a more compact and unifying way for every kind of tensor? I know that for a matrix you do </p>
  
  <pre><code>np.einsum('ij-&gt;ji', A)
  </code></pre>
  
  <p>and you get, as previosuly with <code>A.T</code>:</p>
  
  <pre><code>array([[ 0,  5, 10, 15, 20],
     [ 1,  6, 11, 16, 21],
     [ 2,  7, 12, 17, 22],
     [ 3,  8, 13, 18, 23],
     [ 4,  9, 14, 19, 24]])
  </code></pre>
  
  <p>is it possible to do it with 1-D arrays?</p>
  
  <p>Thank you in advance.</p>