Forward keyword arguments to the inner DescriptorSystems methods - #156
Merged
Merged
Conversation
`baltrunc_unstab` splatted its keyword arguments into both `DescriptorSystems.gsdec` and `DescriptorSystems.gbalmr`, neither of which slurps keyword arguments. Any keyword argument specific to one of the two therefore raised a `MethodError`: `smarg`, which determines the stability boundary used for the additive decomposition, could not be passed at all, and neither could `atolhsv` and the other truncation tolerances. `baltrunc_coprime` forwarded its keyword arguments to `gbalmr` only, so the factorization performed by `factorization` could not be controlled. Keyword arguments are now distributed over the inner methods: each inner method receives the keyword arguments that appear in the keyword-argument list of its own methods, so tolerances such as `atol` and `rtol` reach all of them while `smarg` reaches `gsdec` and the coprime factorization, and `atolhsv` reaches `gbalmr`. The keyword-argument lists are obtained from `Base.kwarg_decl`; `glcf` and `glcfid`, which slurp their keyword arguments, are resolved through `grcf` and `grcfid`. A keyword argument accepted by none of the inner methods of a given wrapper now raises an `ArgumentError` listing the supported names instead of being silently ignored. The keyword arguments `job`, `ord` and `matchdc` are determined by the arguments of the wrappers (`n` and `residual`) and are no longer accepted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #156 +/- ##
==========================================
- Coverage 91.87% 91.78% -0.10%
==========================================
Files 20 20
Lines 3065 3078 +13
==========================================
+ Hits 2816 2825 +9
- Misses 249 253 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the keyword-argument introspection (`_kwarg_names`, `_select_kwargs`, `_check_kwargs` and the associated tables) with explicit keyword arguments in the signatures of the wrappers: - `baltrunc_unstab` accepts `smarg`, which is passed to `DescriptorSystems.gsdec`, and `fast, atol, atol1, atol2, rtol`, which are passed to both `gsdec` and `DescriptorSystems.gbalmr`. The remaining keyword arguments are passed to `gbalmr`. - `baltrunc_coprime` accepts `factorization_kwargs`, a named tuple passed to `factorization` only, and `fast, atol, atol1, atol2, rtol`, which are passed to both `factorization` and `gbalmr`. The remaining keyword arguments are passed to `gbalmr`. - `baltrunc2` is restored to its previous form, all of its keyword arguments are passed to `gbalmr`. The new keyword arguments are documented in the docstrings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
baltrunc_unstabsplatted its keyword arguments into bothDescriptorSystems.gsdecandDescriptorSystems.gbalmr, neither of which slurps keyword arguments, so any keyword argument specific to one of the two raised aMethodError. In particularsmarg, which determines the stability boundary used for the additive decomposition, could not be passed at all, and neither couldatolhsvand the remaining truncation tolerances.baltrunc_coprimeforwarded its keyword arguments togbalmronly, so the coprime factorization performed byfactorizationcould not be controlled.The keyword arguments accepted by more than one inner method are now listed explicitly in the signatures of the wrappers and forwarded to each of them:
baltrunc_unstabacceptssmarg, which is passed togsdec, andfast, atol, atol1, atol2, rtol, which are passed to bothgsdecandgbalmr. The remaining keyword arguments are passed togbalmr.baltrunc_coprimeacceptsfactorization_kwargs, a named tuple passed tofactorizationonly, andfast, atol, atol1, atol2, rtol, which are passed to bothfactorizationandgbalmr. The remaining keyword arguments are passed togbalmr.baltrunc2is unchanged, all of its keyword arguments are passed togbalmr.The new keyword arguments are documented in the docstrings.
Tests covering the forwarding and the effect of
smargon the additive decomposition are added totest/test_descriptor.jl.test_descriptor.jl,test_reduction.jlandtest_glover_mcfarlane.jlpass locally.🤖 Generated with Claude Code