Skip to content

Commit 41a0803

Browse files
Merge pull request #250 from SciML/arrayinterface
update to ArrayInterface v7
2 parents b9bf2d1 + 96c7f5f commit 41a0803

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

Project.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ version = "2.37.0"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
8-
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
9-
ArrayInterfaceStaticArraysCore = "dd5226c6-a4d4-4bc7-8575-46859f9c95b9"
8+
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
109
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
1110
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1211
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
@@ -23,8 +22,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
2322

2423
[compat]
2524
Adapt = "3"
26-
ArrayInterfaceCore = "0.1.1"
27-
ArrayInterfaceStaticArraysCore = "0.1"
25+
ArrayInterface = "7"
2826
ChainRulesCore = "0.10.7, 1"
2927
DocStringExtensions = "0.8, 0.9"
3028
FillArrays = "0.11, 0.12, 0.13"

src/RecursiveArrayTools.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ module RecursiveArrayTools
66

77
using DocStringExtensions
88
using RecipesBase, StaticArraysCore, Statistics,
9-
ArrayInterfaceCore, LinearAlgebra
9+
ArrayInterface, LinearAlgebra
1010
using SymbolicIndexingInterface
1111

1212
import ChainRulesCore
1313
import ChainRulesCore: NoTangent
1414
import ZygoteRules, Adapt
1515

16-
# Required for the downstream_events.jl test
17-
# Since `ismutable` on an ArrayPartition needs
18-
# to know static arrays are not mutable
19-
import ArrayInterfaceStaticArraysCore
20-
2116
using FillArrays
2217

2318
import Tables, IteratorInterfaceExtensions

src/array_partition.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ end
114114
Base.ones(A::ArrayPartition, dims::NTuple{N, Int}) where {N} = ones(A)
115115

116116
# mutable iff all components of ArrayPartition are mutable
117-
@generated function ArrayInterfaceCore.ismutable(::Type{<:ArrayPartition{T, S}}) where {T, S
117+
@generated function ArrayInterface.ismutable(::Type{<:ArrayPartition{T, S}}) where {T, S
118118
}
119-
res = all(ArrayInterfaceCore.ismutable, S.parameters)
119+
res = all(ArrayInterface.ismutable, S.parameters)
120120
return :($res)
121121
end
122122

@@ -429,7 +429,7 @@ end
429429

430430
## Linear Algebra
431431

432-
ArrayInterfaceCore.zeromatrix(A::ArrayPartition) = ArrayInterfaceCore.zeromatrix(Vector(A))
432+
ArrayInterface.zeromatrix(A::ArrayPartition) = ArrayInterface.zeromatrix(Vector(A))
433433

434434
function LinearAlgebra.ldiv!(A::Factorization, b::ArrayPartition)
435435
(x = ldiv!(A, Array(b)); copyto!(b, x))

src/utils.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ function recursivecopy(a::AbstractArray{T, N}) where {T <: Number, N}
1818
end
1919

2020
function recursivecopy(a::AbstractArray{T, N}) where {T <: AbstractArray, N}
21-
if ArrayInterfaceCore.ismutable(a)
21+
if ArrayInterface.ismutable(a)
2222
b = similar(a)
2323
map!(recursivecopy, b, a)
2424
else
25-
ArrayInterfaceCore.restructure(a, map(recursivecopy, a))
25+
ArrayInterface.restructure(a, map(recursivecopy, a))
2626
end
2727
end
2828

@@ -59,7 +59,7 @@ end
5959
function recursivecopy!(b::AbstractArray{T, N},
6060
a::AbstractArray{T2, N}) where {T <: AbstractArray,
6161
T2 <: AbstractArray, N}
62-
if ArrayInterfaceCore.ismutable(T)
62+
if ArrayInterface.ismutable(T)
6363
@inbounds for i in eachindex(b, a)
6464
recursivecopy!(b[i], a[i])
6565
end
@@ -166,7 +166,7 @@ If `i<length(x)`, it's simply a `recursivecopy!` to the `i`th element. Otherwise
166166
"""
167167
function copyat_or_push!(a::AbstractVector{T}, i::Int, x, perform_copy = true) where {T}
168168
@inbounds if length(a) >= i
169-
if !ArrayInterfaceCore.ismutable(T) || !perform_copy
169+
if !ArrayInterface.ismutable(T) || !perform_copy
170170
# TODO: Check for `setindex!`` if T <: StaticArraysCore.StaticArray and use `copy!(b[i],a[i])`
171171
# or `b[i] = a[i]`, see https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19
172172
a[i] = x

0 commit comments

Comments
 (0)