def dim_reduce_data(data, d):
genes, cells = data.shape<EOL>distances = np.zeros((cells, cells))<EOL>for i in range(cells):<EOL><INDENT>for j in range(cells):<EOL><INDENT>distances[i,j] = poisson_dist(data[:,i], data[:,j])<EOL><DEDENT><DEDENT>proximity = distances**<NUM_LIT:2><EOL>J = np.eye(cells) - <NUM_LIT:1.>/cells<EOL>B = -<NUM_LIT:0.5>*np.dot(J, np.dot(proximity, J))<EOL>e_val, e_vec = np.linalg.eigh(B)<EOL>lam = np.diag(e_val[-d:])[::-<NUM_LIT:1>]<EOL>E = e_vec[:,-d:][::-<NUM_LIT:1>]<EOL>X = np.dot(E, lam**<NUM_LIT:0.5>)<EOL>return X<EOL>
Does a MDS on the data directly, not on the means.

Args:
    data (array): genes x cells
    d (int): desired dimensionality

Returns:
    X, a cells x d matrix