Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

Fixes #486

This PR adds the issparse method for AbstractVectorOfArray, resolving a MethodError that occurred when issparse(::SubArray) tried to call issparse on its parent array.

Changes

  1. Added issparse method in RecursiveArrayToolsSparseArraysExt.jl

    • Returns false for AbstractVectorOfArray since it is not a sparse array type
    • Placed in the SparseArrays extension to keep sparse-related functionality together
  2. Added comprehensive tests in test/interface_tests.jl

    • Test issparse returns false for VectorOfArray
    • Test issparse returns false for DiffEqArray
    • Test the original issue with SubArray views
    • Test nested VectorOfArray structures

Test Results

All tests pass successfully. The fix resolves the error described in the issue:

julia> U = mapreduce(u -> view(u, :, :), hcat, us)
# Previously: MethodError: no method matching issparse(::ODESolution{...})
# Now: Works correctly, issparse returns false

Checklist

  • Added implementation in appropriate extension file
  • Added comprehensive tests
  • All tests pass locally (129 tests passed)
  • Code formatted with JuliaFormatter SciMLStyle

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

ChrisRackauckas and others added 2 commits October 17, 2025 08:24
Fixes SciML#486

When issparse(::SubArray) is called, it tries to call issparse on the
parent array. If the parent is an AbstractVectorOfArray, there was no
issparse method defined, causing a MethodError.

This commit adds issparse method that returns false for
AbstractVectorOfArray, since it is not a sparse array type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Adds comprehensive tests for the issparse method including:
- Testing issparse returns false for VectorOfArray
- Testing issparse returns false for DiffEqArray
- Testing the original issue with SubArray views
- Testing nested VectorOfArray structures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit d848bfb into SciML:master Oct 17, 2025
15 of 25 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.

issparse is not defined but is requested for a view's parent

2 participants