Open
Conversation
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.
Summary
This change speeds up NumericMatrix.walk for the reduced one-symbol numeric walk path used by CMF.walk, without changing the public API or checkpoint behavior.
The optimization works by compiling the reduced rational matrix into:
It then:
Multi-symbol direct numeric walks are unchanged and still use the previous evaluator.
Validated with:
direct unit tests for the optimized numeric walk path
sparse checkpoint tests
fallback coverage for multi-symbol walks
reduced 2F1 and 3F2 coverage
full ramanujantools suite
The Performance benefit is for reduced one-symbol walks at medium and larger depths.
Representative total-time comparison including setup costs:
pFq(2,1,-1), depth 1000: 0.0341s -> 0.0217s
pFq(3,2,1/4), depth 1000: 0.0754s -> 0.0390s
pFq(6,5,-1), depth 1000: 0.9992s -> 0.3796s
pFq(9,8,-1/2), depth 1000: 4.7452s -> 2.4830s
There is a first-call "compile" cost for the new path (which is still much smaller than the trajectory matrix calculation cost), but it is paid back quickly and the cumulative runtime becomes better as depth grows.
Cache is stored on the reduced matrix object.
Optimization is only enabled when the walk is:
Unsupported cases fall back to the previous implementation