Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect diagrams returned from ripsDiag() using distance matrices as input. #31

Open
jordanschupbach opened this issue Mar 11, 2019 · 0 comments

Comments

@jordanschupbach
Copy link

There seems to be a bug in how the ripsDiag() function calculates persistence diagrams when using a distance matrix as input. The following code illustrates this bug:

    sphere_points <- matrix(c(-1, 0,  0, 1, 0, 0, 0, -1, 0,
                               0, 1, 0, 0,  0, -1, 0, 0, 1),
                            nrow = 6, ncol = 3)
  
    # Use distance matrix for sphere
    diag1 <- ripsDiag(dist(sphere_points), maxdimension = 2,
                      maxscale = 5, dist = "arbitrary")
  
    # Use distance  matrix
    diag2 <- ripsDiag(sphere_points, maxdimension = 2,
                      maxscale = 5, dist = "euclidean")
  
diag1$diagram
     dimension Birth    Death
[1,]         0     0 5.000000
[2,]         0     0 1.414214
[3,]         0     0 1.414214
[4,]         0     0 1.414214
[5,]         0     0 1.414214
[6,]         0     0 1.414214

diag2$diagram

     dimension    Birth    Death
[1,]         0 0.000000 5.000000
[2,]         0 0.000000 1.414214
[3,]         0 0.000000 1.414214
[4,]         0 0.000000 1.414214
[5,]         0 0.000000 1.414214
[6,]         0 0.000000 1.414214
[7,]         2 1.414214 2.000000

When using the distance matrix as input, we see that we are unable to find the two-dimensional feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant