I'm doing some computations on a full matrix that is redundant (i.e. can be a triangle matrix without losing info). I realized I can compute only the lower portion of the triangle for faster results. How can I project the lower triangle into the upper once I'm done?
In other words, how can I reverse the np.tril
method?
print DF_var.as_matrix()
# [[1 1 0 1 1 1 0 1 0 0 0]
# [1 1 1 1 1 0 1 0 1 1 1]
# [0 1 1 0 0 0 0 0 0 0 0]
# [1 1 0 1 0 0 0 0 0 0 0]
# [1 1 0 0 1 0 0 0 0 0 0]
# [1 0 0 0 0 1 1 0 0 0 0]
# [0 1 0 0 0 1 1 0 0 0 0]
# [1 0 0 0 0 0 0 1 1 0 0]
# [0 1 0 0 0 0 0 1 1 0 0]
# [0 1 0 0 0 0 0 0 0 1 0]
# [0 1 0 0 0 0 0 0 0 0 1]]
print np.tril(DF_var.as_matrix())
# [[1 0 0 0 0 0 0 0 0 0 0]
# [1 1 0 0 0 0 0 0 0 0 0]
# [0 1 1 0 0 0 0 0 0 0 0]
# [1 1 0 1 0 0 0 0 0 0 0]
# [1 1 0 0 1 0 0 0 0 0 0]
# [1 0 0 0 0 1 0 0 0 0 0]
# [0 1 0 0 0 1 1 0 0 0 0]
# [1 0 0 0 0 0 0 1 0 0 0]
# [0 1 0 0 0 0 0 1 1 0 0]
# [0 1 0 0 0 0 0 0 0 1 0]
# [0 1 0 0 0 0 0 0 0 0 1]]
How to convert it back to a full matrix?