Skip to content

An accuracy estimate names its coordinates, and the bare name is retired - #487

Merged
ofloveandhate merged 1 commit into
fix/combining-systems-compares-the-variablesfrom
rename-accuracy-estimate-to-say-its-coordinates
Oct 3, 2026
Merged

ofloveandhate merged 1 commit into
fix/combining-systems-compares-the-variablesfrom
rename-accuracy-estimate-to-say-its-coordinates

Conversation

@ofloveandhate

Copy link
Copy Markdown
Contributor

Stacked on #486 (fix/combining-systems-compares-the-variables), so the diff shows only this work; it retargets when that one merges.

A solve reports two accuracy estimates for an endpoint, and both are the infinity-norm distance between the endgame's last two approximations. One is measured in the coordinates the tracker works in, homogenized and patched; the other after dehomogenization, in the coordinates the caller wrote the system in. The second was already named accuracy_estimate_user_coords. The first was the bare accuracy_estimate, and a caller reads a bare name as being about their own coordinates, which it was not. It is now accuracy_estimate_internal_coords, in the C++ results (zero_dim_solve.hpp, parallel/path_result.hpp, nag_algorithms/output.hpp), in the records writer, and in the Python dataframe columns. The records reader accepts the earlier key, so records written before this change still load.

The bare name is retired rather than aliased. In Python it is a property that raises RuntimeError naming both successors. It is deliberately not an AttributeError, because getattr(md, 'accuracy_estimate', 0.0) would swallow that and silently read zero, which is exactly the silent misreading the rename is meant to end.

The final_tolerance docstring now says what the setting is: a number of digits, applied in internal coordinates, so that a solution of size 1000 with six digits correct reports an accuracy near 1e-3 in user coordinates.

ADR-0069 records the naming decision. Tests: python/test/zero_dim/accuracy_estimate_names_test.py and a records round trip in core/test/nag_algorithms/zero_dim_records.cpp. Verified: all C++ suites, the Python suite, the tutorial doctests, and the three lints; the cellular decomposition port was moved to the new name in the same session.

🤖 Generated with Claude Code

A solution's metadata carries two accuracy estimates, both the distance between the endgame's last two approximations of the root.  accuracy_estimate was in the solver's internal coordinates (homogenized, on the patch) and accuracy_estimate_user_coords in the user's.  The plain name read as the accuracy of my solution in my coordinates, and it was not that: the internal estimate is what final_tolerance is compared with, so it behaves like a number of correct digits, and the absolute error in the user's variables is that times roughly the scale of the solution.

accuracy_estimate is renamed accuracy_estimate_internal_coords.  accuracy_estimate_user_coords keeps its name.  The bare name is retired, not given to the other estimate: the same name returning a different number would leave every reader running on a value off by the scale of its solution, with no error anywhere.  In Python, reading it raises a RuntimeError that names both successors.  It is not an AttributeError, because getattr with a default swallows that and the caller goes on with the default.

The records write each estimate under its new key, and the reader accepts the earlier key for the internal one, so a record written before the rename loads.  The dataframe column is renamed with the field.  The docstrings of both estimates and of final_tolerance now say which coordinates they are in, and that the tolerance is in effect a number of digits.

Whether either estimate bounds the true error is a separate question and is not asserted here.  ADR-0069.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ofloveandhate
ofloveandhate added this pull request to stack #488 October 3, 2026 17:12

@ofloveandhate ofloveandhate left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is correct, and closes a point of confusion i have had for a while. the aphorism i am practicing is "prefer explicit to implicit".

@ofloveandhate
ofloveandhate merged commit e638995 into develop Oct 3, 2026
20 checks passed
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.

1 participant