Skip to content

[MRG] Handle zero transported mass in entropic partial Wasserstein solvers - #943

Open
yqia03 wants to merge 1 commit into
PythonOT:masterfrom
yqia03:fix/entropic-partial-zero-mass
Open

yqia03 wants to merge 1 commit into
PythonOT:masterfrom
yqia03:fix/entropic-partial-zero-mass

Conversation

@yqia03

@yqia03 yqia03 commented Nov 30, 2026

Copy link
Copy Markdown

Types of changes

Bug fix, regression tests, and a release note.

Motivation and context / Related issue

The entropic partial Wasserstein problem constrains the entries of the plan to be nonnegative and their sum to equal the requested mass. When that mass is zero, the unique feasible plan is the zero matrix. On master, both the standard and log-domain solvers emit numerical warnings and return a plan and transport cost containing NaN for a small finite cost matrix with m=0.

Return a zero plan with the cost matrix's shape and dtype before entering either iteration. With log=True, report zero transport cost and an empty error history. The same behavior applies when a zero-total marginal makes the default mass zero.

How has this been tested

  • On macOS arm64 with NumPy, python -m pytest -q test/test_partial.py -k zero_mass failed in all four cases on the baseline and passed in all four cases with the fix.
  • The partial solver test module and doctests passed all 38 cases when using the NumPy scalar display setting already used by POT's Linux test configuration. Under the macOS default display setting, the same four existing doctests failed on both revisions because of scalar formatting.
  • Smoke-tested both public dispatcher methods with a float32 2-by-3 cost matrix and warnings promoted to errors.
  • All six hooks in the project's pinned pre-commit run --all-files passed.

PR checklist

  • OpenAI Codex checked the contribution guide and prepared the patch, tests, and PR. No human pre-submission review was performed.
  • Updated the affected parameter docstrings and added a release note.
  • Added regression tests. Validation above is scoped to NumPy CPU; the full CI matrix has not run locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant