Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/RecursiveArrayToolsSparseArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ function Base.copyto!(
dest
end

# Fix for issue #486: Define issparse for AbstractVectorOfArray
# AbstractVectorOfArray is not a sparse array type, so it should return false
SparseArrays.issparse(::RecursiveArrayTools.AbstractVectorOfArray) = false

end
21 changes: 21 additions & 0 deletions test/interface_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,24 @@ end
darr = DiffEqArray([ones(2)], [1.0], :params, :sys)
@test darr.sys == :sys
end

@testset "issparse for AbstractVectorOfArray (issue #486)" begin
using SparseArrays

# Test that issparse returns false for VectorOfArray
testva = VectorOfArray([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
@test issparse(testva) == false

# Test that issparse returns false for DiffEqArray
testda = DiffEqArray([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1:3)
@test issparse(testda) == false

# Test the original issue: issparse should work with SubArray views
# This was failing before because issparse(::SubArray) calls issparse on the parent
testview = view(testva, :, :)
@test issparse(testview) == false

# Test with nested VectorOfArray
nested_voa = VectorOfArray([testva, testva])
@test issparse(nested_voa) == false
end
Loading