Interface compatibility: Accept AbstractMatrix in getstructure#13
Merged
ChrisRackauckas merged 2 commits intoSciML:mainfrom Dec 29, 2025
Merged
Conversation
Change getstructure signature from Matrix to AbstractMatrix to support more array types like Symmetric, Adjoint, Transpose, and SubArray views. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
|
All tests pass locally with this interface improvement. The change from Ready to merge. cc @ChrisRackauckas 🤖 Generated with Claude Code |
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 PR improves interface compliance by accepting
AbstractMatrixinstead of justMatrixin thegetstructurefunction.getstructure(A::Matrix)togetstructure(A::AbstractMatrix)to support more array wrapper types (Symmetric, Adjoint, Transpose, SubArray views, etc.)Interface Testing Performed
I tested the package against Julia's standard interfaces and SciML's array/number interfaces:
BigFloat Support ✓
All core functions work correctly with BigFloat:
check_diagonal,is_toeplitz,is_banded,compute_bandedness- all passgetstructure- passessparsestructure- works for Toeplitz, Banded, LowerTriangular, UpperTriangularisposdeffails for BigFloat sparse matrices, but this is a Julia SparseArrays limitation, not this package's issueJLArray (GPU-like) Support
The package uses scalar indexing which is fundamental to the algorithms (element-by-element comparison for Toeplitz detection, banded detection, etc.). This is a design constraint rather than a bug - these algorithms inherently need to compare individual matrix elements.
ArrayInterface.jl Compatibility ✓
Works correctly with arrays that support
fast_scalar_indexing.Test plan
getstructurenow works with Adjoint, Symmetric, Transpose, and SubArray typescc @ChrisRackauckas
🤖 Generated with Claude Code