You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make AbstractVectorOfArray <: AbstractArray for proper interface compliance
This is a breaking change that completes the long-planned migration (documented
since 2023) to make AbstractVectorOfArray a proper AbstractArray subtype.
Key changes:
- AbstractVectorOfArray{T,N,A} <: AbstractArray{T,N}
- Linear indexing A[i] now returns the i-th element in column-major order
(previously returned A.u[i], the i-th inner array)
- size() uses maximum sizes across inner arrays for ragged data
- Ragged out-of-bounds elements are treated as zero (sparse interpretation)
- Iteration goes over scalar elements (AbstractArray default)
- Removed deprecated linear indexing methods
- Updated Zygote extension (some adjoints marked broken pending update)
- Added parameter_values(::AbstractDiffEqArray, i) to fix dispatch ambiguity
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/RecursiveArrayTools.jl
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,13 @@ module RecursiveArrayTools
26
26
27
27
!!! note
28
28
29
-
In 2023 the linear indexing `A[i]` was deprecated. It previously had the behavior that `A[i] = A.u[i]`. However, this is incompatible with standard `AbstractArray` interfaces, Since if `A = VectorOfArray([[1,2],[3,4]])` and `A` is supposed to act like `[1 3; 2 4]`, then there is a difference `A[1] = [1,2]` for the VectorOfArray while `A[1] = 1` for the matrix. This causes many issues if `AbstractVectorOfArray <: AbstractArray`. Thus we plan in 2026 to complete the deprecation and thus have a breaking update where `A[i]` matches the linear indexing of an`AbstractArray`, and then making `AbstractVectorOfArray <: AbstractArray`. Until then, `AbstractVectorOfArray` due to
30
-
this interface break but manually implements an `AbstractArray`-like interface for
31
-
future compatibility.
29
+
As of v4.0, `AbstractVectorOfArray <: AbstractArray`. Linear indexing `A[i]`
30
+
now returns the `i`th element in column-major order, matching standard Julia
31
+
`AbstractArray` behavior. To access the `i`th inner array, use `A.u[i]` or
32
+
`A[:, i]`. For ragged arrays (inner arrays of different sizes), `size(A)`
33
+
reports the maximum size in each dimension and out-of-bounds elements are
34
+
interpreted as zero (sparse representation). This means all standard linear
35
+
algebra operations work out of the box.
32
36
33
37
## Fields
34
38
@@ -99,7 +103,7 @@ module RecursiveArrayTools
99
103
to make the array type match the internal array type (for example, if `A` is an array
100
104
of GPU arrays, `stack(A)` will be a GPU array).
101
105
"""
102
-
abstract type AbstractVectorOfArray{T, N, A} end
106
+
abstract type AbstractVectorOfArray{T, N, A} <:AbstractArray{T, N}end
103
107
104
108
"""
105
109
AbstractDiffEqArray{T, N, A} <: AbstractVectorOfArray{T, N, A}
0 commit comments