Skip to content

Commit

Permalink
Merge pull request #393 from rafaqz/arrayinterfacecore
Browse files Browse the repository at this point in the history
use ArrayInterfaceCore for fast `using` time
  • Loading branch information
rafaqz authored Aug 11, 2022
2 parents 195e533 + a387cae commit ed98fb6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version = "0.20.11"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
Expand All @@ -21,7 +21,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
Adapt = "2, 3.0"
ArrayInterface = "3.1, 4, 5, 6"
ArrayInterfaceCore = "0.1"
ConstructionBase = "1"
Extents = "0.1"
IntervalSets = "0.5, 0.6, 0.7"
Expand Down
2 changes: 1 addition & 1 deletion src/DimensionalData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using Base: tail, OneTo, @propagate_inbounds

# Ecosystem
import Adapt,
ArrayInterface,
ArrayInterfaceCore,
ConstructionBase,
Extents,
IteratorInterfaceExtensions,
Expand Down
2 changes: 1 addition & 1 deletion src/array/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ for (d, s) in ((:AbstractDimArray, :AbstractDimArray),
end
Base.copy!(dst::SparseArrays.SparseVector, src::AbstractDimArray{T,1}) where T = copy!(dst, parent(src))

ArrayInterface.parent_type(::Type{<:AbstractDimArray{T,N,D,A}}) where {T,N,D,A} = A
ArrayInterfaceCore.parent_type(::Type{<:AbstractDimArray{T,N,D,A}}) where {T,N,D,A} = A

function Adapt.adapt_structure(to, A::AbstractDimArray)
rebuild(A,
Expand Down
6 changes: 1 addition & 5 deletions test/array.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DimensionalData, Test, Unitful, SparseArrays, Dates, Random, ArrayInterface
using DimensionalData, Test, Unitful, SparseArrays, Dates, Random
using DimensionalData: layerdims

using DimensionalData.LookupArrays, DimensionalData.Dimensions
Expand Down Expand Up @@ -343,7 +343,3 @@ end
da3 = DimArray(a2, dimz2; refdims=refdimz, name=DimensionalData.Name(:test3))
@test NamedTuple(da, da3) == (; test=da, test3=da3)
end

@testset "ArrayInterface" begin
@test ArrayInterface.parent_type(da) == Matrix{Int}
end
9 changes: 8 additions & 1 deletion test/ecosystem.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using OffsetArrays, ImageFiltering, ImageTransformations, DimensionalData
using OffsetArrays, ImageFiltering, ImageTransformations, ArrayInterfaceCore, DimensionalData, Test

@testset "ArrayInterface" begin
a = [1 2; 3 4]
dimz = X(143.0:2.0:145.0), Y(-38.0:2.0:-36.0)
da = DimArray(a, dimz)
@test ArrayInterfaceCore.parent_type(typeof(da)) == Matrix{Int}
end

@testset "OffsetArray" begin
a = [1 2 3 4
Expand Down

0 comments on commit ed98fb6

Please sign in to comment.