Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ccmpred/substitution_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
def matrianglify(data, size=20):
""" Make a symmetric size * size matrix out of an array of triangle array data"""
mat = np.zeros((size, size))
mat[np.tril_indices(size)] = data
mat[np.triu_indices(size)] = data

for i in range(size):
for j in range(size):
ind=int(i*(i+1)//2+j)
if (ind<len(data)):
mat[i][j] = data[ind]
mat[j][i] = data[ind]
return mat


Expand Down