Repository navigation
Return OffDiagonal when slicing Diagonal of LayoutVector (require FillArrays v1.18) - #285
Merged
Merged
Conversation
Require FillArrays v1.18 and reuse its single-band slicing so that indexing a Diagonal whose diagonal is a LayoutVector (or a SubArray of a LayoutArray) by unit ranges returns a FillArrays.OffDiagonal instead of a dense Matrix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #285 +/- ##
==========================================
+ Coverage 90.33% 90.53% +0.19%
==========================================
Files 12 12
Lines 1987 2028 +41
==========================================
+ Hits 1795 1836 +41
Misses 192 192 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This lets downstream packages such as BandedMatrices.jl read the band of a view of a Diagonal or OffDiagonal without materialising it. Co-Authored-By: Claude Opus 5.5 <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.
FillArrays v1.18 adds
OffDiagonaland returns it when slicing aDiagonalof anAbstractFillby unit ranges. This PR does the same for aDiagonalwhose diagonal is aLayoutVectoror aSubArray{<:Any,1,<:LayoutVecOrMat}: before, these slices fell back to Base and returned a denseMatrix.Changes:
1.18and the version to 1.15.getindex(::Diagonal{<:Any,<:Union{LayoutVector,SubArray{<:Any,1,<:LayoutVecOrMat}}}, ::Union{AbstractUnitRange,Colon}, ::Union{AbstractUnitRange,Colon}), which calls FillArrays' internal_onebased_indexand_singleband_getindex. Offset and infinite index shapes still go to the generic fallback, as they do in FillArrays.Coloncombinations, empty ranges, out-of-bounds slices, and diagonals backed by views.Note: the new method relies on FillArrays internals, so a later FillArrays release that renames them would break it.
🤖 Generated with Claude Code