Skip to content

Use ArrayInterfaceCore #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2022
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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name = "LabelledArrays"
uuid = "2ee39098-c373-598a-b85f-a56591580800"
authors = ["Chris Rackauckas <[email protected]>"]
version = "1.11.0"
version = "1.11.1"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
ArrayInterfaceStaticArrays = "b0d46f97-bff5-4637-a19a-dd75974142cd"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -14,7 +14,7 @@ PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"

[compat]
ArrayInterface = "2.8, 3.0, 4, 5, 6"
ArrayInterfaceCore = "0.1.13"
ArrayInterfaceStaticArrays = "0.1"
ChainRulesCore = "1"
MacroTools = "0.5"
Expand Down
8 changes: 4 additions & 4 deletions src/LabelledArrays.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module LabelledArrays

using LinearAlgebra, StaticArrays, ArrayInterface
using LinearAlgebra, StaticArrays, ArrayInterfaceCore
import RecursiveArrayTools, PreallocationTools

include("slarray.jl")
Expand Down Expand Up @@ -59,10 +59,10 @@ end
Base.NamedTuple(x::Union{LArray, SLArray}) = NamedTuple{symnames(typeof(x))}(x.__x)
@inline Base.reshape(a::SLArray, s::Size) = StaticArrays.similar_type(a, s)(Tuple(a))

function ArrayInterface.ismutable(::Type{<:LArray{T, N, Syms}}) where {T, N, Syms}
ArrayInterface.ismutable(T)
function ArrayInterfaceCore.ismutable(::Type{<:LArray{T, N, Syms}}) where {T, N, Syms}
ArrayInterfaceCore.ismutable(T)
end
ArrayInterface.can_setindex(::Type{<:SLArray}) = false
ArrayInterfaceCore.can_setindex(::Type{<:SLArray}) = false

function PreallocationTools.get_tmp(dc::PreallocationTools.DiffCache,
u::LArray{T, N, D, Syms}) where {T, N, D, Syms}
Expand Down
7 changes: 4 additions & 3 deletions src/larray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ function Base.convert(::Type{AbstractArray{T, N}},
end
Base.convert(::Type{AbstractArray{T, N}}, x::LArray{T, N}) where {T, N} = x

function ArrayInterface.restructure(x::LArray{T, N, D, Syms},
y::LArray{T2, N2, D2, Syms}) where {T, N, D, T2, N2, D2,
Syms}
function ArrayInterfaceCore.restructure(x::LArray{T, N, D, Syms},
y::LArray{T2, N2, D2, Syms}) where {T, N, D, T2, N2,
D2,
Syms}
reshape(y, size(x)...)
end

Expand Down