def riemann_metric( Y, laplacian=None, n_dim=None, invert_h=False, mode_inv = 'svd'):
    n_samples = laplacian.shape[0]
    h_dual_metric = np.zeros((n_samples, n_dim, n_dim ))
    for i in np.arange(n_dim ):
        for j in np.arange(i,n_dim ):
            yij = Y[:,i]*Y[:,j]
            h_dual_metric[ :, i, j] = 0.5*(laplacian.dot(yij)-Y[:,j]*laplacian.dot(Y[:,i])-Y[:,i]*laplacian.dot(Y[:,j]))
    for j in np.arange(n_dim-1):
        for i in np.arange(j+1,n_dim):
            h_dual_metric[ :,i,j] = h_dual_metric[:,j,i]

    # compute rmetric if requested
    if( invert_h ):
        riemann_metric, Hvv, Hsvals, Gsvals = compute_G_from_H( h_dual_metric )
    else:
        riemann_metric = Hvv = Hsvals = Gsvals = None

    return h_dual_metric, riemann_metric, Hvv, Hsvals, Gsvals
Parameters
dataset/ETHPy150Open mmp2/megaman/megaman/geometry/rmetric.py/riemann_metric