I can easily convert a symmetric matrix to an array/1-d matrix of one of its triangular components using
A_symmetric = np.matrix([[1,2][2,3]])
A_array = A_symmetric[np.triu_indices(2)] == np.matrix([1,2,3])
(and similary with tril_indices
)
But how can I reverse this operations, i.e. how do I get a symmetric matrix from the array/1-d matrix given by triu_indices
?