Skip to content

Commit 0016985

Browse files
Merge pull request #204 from SciML/arrayinterfacecore
Only require ArrayInterfaceCore
2 parents 839d011 + d56473d commit 0016985

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name = "RecursiveArrayTools"
22
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "2.27.1"
4+
version = "2.28.0"
55

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

1919
[compat]
2020
Adapt = "3"
21-
ArrayInterface = "2.7, 3.0, 4, 5"
21+
ArrayInterfaceCore = "0.1.1"
2222
ChainRulesCore = "0.10.7, 1"
2323
DocStringExtensions = "0.8"
2424
FillArrays = "0.11, 0.12, 0.13"

src/RecursiveArrayTools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module RecursiveArrayTools
66

77
using DocStringExtensions
88
using RecipesBase, StaticArrays, Statistics,
9-
ArrayInterface, LinearAlgebra
9+
ArrayInterfaceCore, LinearAlgebra
1010

1111
import ChainRulesCore
1212
import ChainRulesCore: NoTangent

src/array_partition.jl

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

8585
# mutable iff all components of ArrayPartition are mutable
86-
@generated function ArrayInterface.ismutable(::Type{<:ArrayPartition{T,S}}) where {T,S}
87-
res = all(ArrayInterface.ismutable, S.parameters)
86+
@generated function ArrayInterfaceCore.ismutable(::Type{<:ArrayPartition{T,S}}) where {T,S}
87+
res = all(ArrayInterfaceCore.ismutable, S.parameters)
8888
return :( $res )
8989
end
9090

@@ -342,7 +342,7 @@ common_number(a, b) =
342342

343343
## Linear Algebra
344344

345-
ArrayInterface.zeromatrix(A::ArrayPartition) = ArrayInterface.zeromatrix(Vector(A))
345+
ArrayInterfaceCore.zeromatrix(A::ArrayPartition) = ArrayInterfaceCore.zeromatrix(Vector(A))
346346

347347
LinearAlgebra.ldiv!(A::Factorization, b::ArrayPartition) = (x = ldiv!(A, Array(b)); copyto!(b, x))
348348
function LinearAlgebra.ldiv!(A::LU, b::ArrayPartition)

src/utils.jl

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

99
function recursivecopy(a::AbstractArray{T,N}) where {T<:AbstractArray,N}
10-
if ArrayInterface.ismutable(a)
10+
if ArrayInterfaceCore.ismutable(a)
1111
b = similar(a)
1212
map!(recursivecopy, b, a)
1313
else
14-
ArrayInterface.restructure(a, map(recursivecopy, a))
14+
ArrayInterfaceCore.restructure(a, map(recursivecopy, a))
1515
end
1616
end
1717

@@ -31,7 +31,7 @@ function recursivecopy!(b::AbstractArray{T,N},a::AbstractArray{T2,N}) where {T<:
3131
end
3232

3333
function recursivecopy!(b::AbstractArray{T,N},a::AbstractArray{T2,N}) where {T<:AbstractArray,T2<:AbstractArray,N}
34-
if ArrayInterface.ismutable(T)
34+
if ArrayInterfaceCore.ismutable(T)
3535
@inbounds for i in eachindex(b, a)
3636
recursivecopy!(b[i], a[i])
3737
end
@@ -108,7 +108,7 @@ end
108108

109109
function copyat_or_push!(a::AbstractVector{T},i::Int,x,nc::Type{Val{perform_copy}}=Val{true}) where {T,perform_copy}
110110
@inbounds if length(a) >= i
111-
if !ArrayInterface.ismutable(T) || !perform_copy
111+
if !ArrayInterfaceCore.ismutable(T) || !perform_copy
112112
# TODO: Check for `setindex!`` if T <: StaticArray and use `copy!(b[i],a[i])`
113113
# or `b[i] = a[i]`, see https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19
114114
a[i] = x

test/partitions_test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using RecursiveArrayTools, Test, Statistics, ArrayInterface
1+
using RecursiveArrayTools, Test, Statistics, ArrayInterfaceCore
22
A = (rand(5),rand(5))
33
p = ArrayPartition(A)
44
@test (p.x[1][1],p.x[2][1]) == (p[1],p[6])
@@ -188,8 +188,8 @@ up = ap .+ 1
188188
up = 2 .* ap .+ 1
189189
@test typeof(ap) == typeof(up)
190190

191-
@testset "ArrayInterface.ismutable(ArrayPartition($a, $b)) == $r" for (a, b, r) in ((1,2, false), ([1], 2, false), ([1], [2], true))
192-
@test ArrayInterface.ismutable(ArrayPartition(a, b)) == r
191+
@testset "ArrayInterfaceCore.ismutable(ArrayPartition($a, $b)) == $r" for (a, b, r) in ((1,2, false), ([1], 2, false), ([1], [2], true))
192+
@test ArrayInterfaceCore.ismutable(ArrayPartition(a, b)) == r
193193
end
194194

195195
# Test unary minus

test/upstream.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using OrdinaryDiffEq, NLsolve, RecursiveArrayTools, Test, ArrayInterface
1+
using OrdinaryDiffEq, NLsolve, RecursiveArrayTools, Test, ArrayInterfaceCore
22
function lorenz(du,u,p,t)
33
du[1] = 10.0*(u[2]-u[1])
44
du[2] = u[1]*(28.0-u[3]) - u[2]
55
du[3] = u[1]*u[2] - (8/3)*u[3]
66
end
77
u0 = ArrayPartition([1.0,0.0],[0.0])
8-
@test ArrayInterface.zeromatrix(u0) isa Matrix
8+
@test ArrayInterfaceCore.zeromatrix(u0) isa Matrix
99
tspan = (0.0,100.0)
1010
prob = ODEProblem(lorenz,u0,tspan)
1111
sol = solve(prob,Tsit5())

0 commit comments

Comments
 (0)