Skip to content

[MRG] Fix sparse simplex projection with oversized budgets - #876

Open
AHMETHAKANBEZIR1 wants to merge 7 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sparse-simplex-oversized-budget
Open

AHMETHAKANBEZIR1 wants to merge 7 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sparse-simplex-oversized-budget

Conversation

@AHMETHAKANBEZIR1

@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 commented Oct 2, 2026 •

Copy link
Copy Markdown

Types of changes

Bug fix, analytic regression tests and release note.

Motivation and context / Related issue

Fixes #875. An oversized max_nz in projection_sparse_simplex previously creates threshold indices longer than the projected row and raises a broadcasting error. When the budget is at least the projected dimension, use the existing ordinary simplex projection directly, as the documented contract requires. All axis modes inherit this through their existing recursion; smaller sparsity budgets retain their existing path. The fallback avoids indexed mutation on TensorFlow tensors.

How has this been tested

Current head df3d62d includes master 0b6f8d5. Only RELEASES.md conflicted; both release notes are retained, and the PR production/regression files are unchanged from the previous head.

  • Full utility module and doctests: NumPy 124 passed; NumPy/PyTorch 2.9.1 CPU 190 passed; NumPy/TensorFlow 158 passed, 32 existing skips, one median-detachment warning. Each process verifies the source checkout and actual loaded backends. Torch and TensorFlow use separate environments.
  • Analytic simplex regressions cover budgets equal to and exceeding the projected dimension across all axis modes, and passing controls for constrained budgets.
  • All applicable configured pre-commit hooks for the PR files and diff checks pass.

Windows/Python 3.12.14. Existing native POT extensions were reused; upstream changes no native extension source. No new full-package, local full documentation/gallery, GPU, JAX or CuPy run is claimed. Historical focused API documentation passed; current-head upstream CircleCI documentation build 4270 completed successfully. GitHub status propagation may still be pending. Zero/negative sparsity-budget validation is outside this change.

PR checklist

  • I have read CONTRIBUTING.
  • Full documentation build: current-head upstream CircleCI 4270 completed successfully; not a local full-gallery run.
  • Full package suite: utility tests above pass; the full package suite was not run locally.
  • Added the fix to RELEASES.md.

AI assistance disclosure

Prepared, investigated and tested autonomously by OpenAI Codex on behalf of AHMETHAKANBEZIR1. No independent human review has been performed.

Cap the effective row budget at its width, preserving the documented
equivalence to the unconstrained projection. Add an analytic regression
for exact and oversized budgets across all supported axis modes.

Co-authored-by: Codex <noreply@openai.com>
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (604c47f) to head (61e13ba).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #876      +/-   ##
==========================================
- Coverage   97.00%   95.54%   -1.46%     
==========================================
  Files         128      128              
  Lines       26349    26365      +16     
==========================================
- Hits        25559    25191     -368     
- Misses        790     1174     +384     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

projection_sparse_simplex fails when max_nz exceeds the projected dimension

1 participant