Repository navigation
Faster solver: Brent search, parallel figure tabs, optional Numba (results unchanged) - #1
Merged
Merged
Conversation
Weighted sums use sum(map(mul, ...)), which keeps the products and their order (and Python 3.12's compensated float summation). A unit test pins the step against the plain loop; all 14 paper runs checked identical.
Finds r_s = r_sb with about a quarter of the trials, to the same 1e-12 precision; rho_0 agrees with the paper code's bisection to 2e-12. method='bisection' keeps the paper code's search.
One worker process per run, falling back to one after another if processes cannot start. The page code is now under if __name__ == '__main__' because workers re-import the script.
src/outflow/_compiled.py repeats the trial integration line by line. Exponents are read at run time so powers call pow() as Python does, and sums repeat Python 3.12's compensated sum(), so all 14 paper runs are bit-for-bit identical (tested). Installed with the 'fast' extra; without Numba the Python code runs.
…. 7 about 1.5 s) Starting worker processes took longer than the compiled runs; the parallel pool is kept for installs without Numba.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speeds up the solver about 30x (default run 2.6 s -> 0.1 s; all 14 paper runs 95 s -> 1.4 s) without changing the physics.
Changes
find_central_density(..., method=bisection)keeps the paper code's search.if __name__ == __main__.pip install -e .[dev,fast]): a compiled copy of the trial integration insrc/outflow/_compiled.py, bit-for-bit identical to the Python code on all 14 paper runs. With it, figure tabs solve their runs in-process (about 1.5 s).Checks
Decisions and measurements:
docs/decisions.md, section Speed.