Skip to content

Fix inverse transform in choose_point_in_simplex for non-symmetric transforms - #511

Merged
basnijholt merged 1 commit into
python-adaptive:mainfrom
chenyangsu:fix/choose-point-in-simplex-transpose
Dec 1, 2026
Merged

basnijholt merged 1 commit into
python-adaptive:mainfrom
chenyangsu:fix/choose-point-in-simplex-transpose

Conversation

@chenyangsu

Copy link
Copy Markdown
Contributor

Description

In choose_point_in_simplex, the forward transform computes simplex @ transform (row vectors multiplied on the right, equivalent to transform.T @ x for a column vector x), while the inverse calls np.linalg.solve(transform, point). For a non-symmetric transform, the returned point leaves the simplex (for simplex=[[0, 0], [1, 0], [0, 10]] and transform=[[2, 0.5], [1, 0.1]], it returns [-0.833, 13.333]), and LearnerND(f, bounds=[(0, 1), (0, 10)], anisotropic=True) suggests out-of-bounds points before raising AssertionError.

Could we solve with transform.T instead (np.linalg.solve(transform.T, point))? Happy to also add a 3D anisotropic unequal-bounds case if helpful.

Testing: pytest --no-cov adaptive/tests/test_learnernd.py adaptive/tests/unit/test_learnernd.py adaptive/tests/unit/test_learnernd_integration.py -> 30 passed, 6 skipped (2 new tests fail on main). ruff check and ruff format --check clean.

Checklist

  • Fixed style issues using ruff check and ruff format
  • pytest passed

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@akhmerov
akhmerov enabled auto-merge (squash) December 1, 2026 15:55
@basnijholt
basnijholt merged commit 8102817 into python-adaptive:main Dec 1, 2026
26 of 29 checks passed
@basnijholt

basnijholt commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Thanks for catching and fixing this, @chenyangsu! The transform.T fix and tests look clean, so I went ahead and merged this (no need for a separate 3D test).

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

Successfully merging this pull request may close these issues.

2 participants