anigmetov / hera

Other
4 stars 3 forks source link

Diagonal points #4

Closed mglisse closed 3 years ago

mglisse commented 3 years ago

Hello, this is more a question than an issue: when calling wasserstein_dist, is it the responsibility of the caller to remove diagonal points before the call? I notice that diagram_reader.h does it, which is a big hint. And giving wasserstein_dist two diagrams that only differ by a point on the diagonal (say [[0,0],[0,1]] and [[0,1]]) can send it into an infinite loop, which is another big hint. This requirement is fine, I just wanted to get confirmation before I introduce a filter in my wrapper.

anigmetov commented 3 years ago

Hello, actually, it is very easy to ignore the diagonal points in Hera code, so I updated the code accordingly. Now there should be no need to filter the points on the caller side.

mglisse commented 3 years ago

Hmm, but the test hera::ws::are_equal(A, B) happens before removing the points with x == y, so I still get an infinite loop for the diagram mentioned above :disappointed:

anigmetov commented 3 years ago

Sorry, I overlooked the real cause of the problem. Fixed (with your example added to tests).