[MRG] Correct pointer overflow in EMD by ncassereau · Pull Request #381 · PythonOT/POT

Motivation and context / Related issue

When doing a transport plan with EMD between two 50k points clouds with uniform probability, the transport matrix would be a sparse matrix with only 42950 non-zero values. When solving the assignment problem between two pictures (as in https://github.com/ncassereau-idris/pictures-optimal-transport), this meant that some points would evade to the origin rather than their respective target points. This is unexpected, as the correct transport matrix should be a sparse matrix with 50k nonzero values.

What happened then ?

When computing transport plan with EMD, some pointers remained as int. This meant that if your cost matrix is over 46k lines and columns, pointers would overflow and the cost matrix would not be correctly converted.

How has this been tested (if it applies)

After modifying the openmp version, I tried to make a transport between two clouds of 50k points, and successfully obtained a sparse matrix with 50k nonzero values. I will try to use it on the picture assignment problem as well as execute unit tests to make sure the given matrix makes sense.

A picture assignment problem was solved with 60k points and produced a sound gif, therefore the fix is working correctly. At 70k and above, there is a risk of infeasible problem.

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.