def sdm_from_dmi(dmi, N): from pylocus.basics import matrix_from_vector sdm_upper = matrix_from_vector(dmi, N) sdm = sdm_upper - sdm_upper.T # assure diagonal is zero np.fill_diagonal(sdm, 0) return sdm
def edm_from_dm(dm, N): from pylocus.basics import matrix_from_vector edm_upper = matrix_from_vector(dm, N) edm = np.power(edm_upper + edm_upper.T, 2.0) return edm