title: transform the upper/lower triangular part of a symmetric matrix (2D array) into a 1D array and return it to the 2D format
body: <p>In <a href="https://stackoverflow.com/q/8905501/832621">this question</a> it is explained how to access the <code>lower</code> and <code>upper</code> triagular parts of a given matrix, say:</p>
  
  <pre><code>m = np.matrix([[11, 12, 13],
                 [21, 22, 23],
                 [31, 32, 33]])
  </code></pre>
  
  <p>Here I need to transform the matrix in a 1D array, which can be done doing:</p>
  
  <pre><code>indices = np.triu_indices_from(m)
  a = np.asarray( m[indices] )[-1]
  #array([11, 12, 13, 22, 23, 33])
  </code></pre>
  
  <p>After doing a lot of calculations with <code>a</code>, changing its values, it will be used to fill a symmetric 2D array:</p>
  
  <pre><code>new = np.zeros(m.shape)
  for i,j in enumerate(zip(*indices)):
      new[j]=a[i]
      new[j[1],j[0]]=a[i]
  </code></pre>
  
  <p>Returning:</p>
  
  <pre><code>array([[ 11.,  12.,  13.],
         [ 12.,  22.,  23.],
         [ 13.,  23.,  33.]])
  </code></pre>
  
  <p>Is there a better way to accomplish this? More especifically,  avoiding the Python loop to rebuild the 2D array?</p>