def _gt_weights(W): """Computes the weights V for a Guttman transform V X = B(X) Z.""" V = -W V[np.diag_indices(V.shape[0])] = W.sum(axis=1) - W.diagonal() return V