Context
After #277, GrangerCausalityResult._stacked() (src/impulso/results.py, ~line 898) builds a named (chain, draw, term) DataArray via np.concatenate on every call — required by the seam's hdi_bounds contract and correct.
Problem
summary() (~line 944) triggers that construction three times per call: once through _stacked_hdi(prob) (which itself calls _stacked() + hdi_bounds) and again directly for the median row. Refactor artifact from the migration; purely repeated work, no correctness impact.
Suggested approach
Bind stacked = self._stacked() once in summary() and pass it through (e.g. let _stacked_hdi accept an optional prebuilt array, or inline the hdi_bounds call). Behaviour covered by existing Granger tests; no new tests needed.
Affected files
- src/impulso/results.py (GrangerCausalityResult._stacked / _stacked_hdi / summary)
Context
After #277,
GrangerCausalityResult._stacked()(src/impulso/results.py, ~line 898) builds a named(chain, draw, term)DataArray vianp.concatenateon every call — required by the seam'shdi_boundscontract and correct.Problem
summary()(~line 944) triggers that construction three times per call: once through_stacked_hdi(prob)(which itself calls_stacked()+hdi_bounds) and again directly for the median row. Refactor artifact from the migration; purely repeated work, no correctness impact.Suggested approach
Bind
stacked = self._stacked()once insummary()and pass it through (e.g. let_stacked_hdiaccept an optional prebuilt array, or inline the hdi_bounds call). Behaviour covered by existing Granger tests; no new tests needed.Affected files