Skip to content

Interface compatibility: Accept AbstractMatrix in getstructure#13

Merged
ChrisRackauckas merged 2 commits intoSciML:mainfrom
ChrisRackauckas-Claude:interface-check-20251229-152238
Dec 29, 2025
Merged

Interface compatibility: Accept AbstractMatrix in getstructure#13
ChrisRackauckas merged 2 commits intoSciML:mainfrom
ChrisRackauckas-Claude:interface-check-20251229-152238

Conversation

@ChrisRackauckas-Claude
Copy link
Contributor

Summary

This PR improves interface compliance by accepting AbstractMatrix instead of just Matrix in the getstructure function.

  • Changes getstructure(A::Matrix) to getstructure(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 pass
  • getstructure - passes
  • sparsestructure - works for Toeplitz, Banded, LowerTriangular, UpperTriangular
    • Note: isposdef fails for BigFloat sparse matrices, but this is a Julia SparseArrays limitation, not this package's issue

JLArray (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

  • All existing tests pass
  • Verified getstructure now works with Adjoint, Symmetric, Transpose, and SubArray types
  • Verified backward compatibility with regular Matrix inputs

cc @ChrisRackauckas

🤖 Generated with Claude Code

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>
@ChrisRackauckas-Claude
Copy link
Contributor Author

All tests pass locally with this interface improvement. The change from Matrix to AbstractMatrix in getstructure is a safe widening of the type signature that improves compatibility with wrapper types.

Ready to merge. cc @ChrisRackauckas

🤖 Generated with Claude Code

@ChrisRackauckas ChrisRackauckas merged commit eda025f into SciML:main Dec 29, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants