Skip to content
Open
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
11 changes: 6 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,30 @@ version = "1.11.1"

[deps]
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
ArrayInterfaceStaticArrays = "b0d46f97-bff5-4637-a19a-dd75974142cd"
ArrayInterfaceStaticArraysCore = "dd5226c6-a4d4-4bc7-8575-46859f9c95b9"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"

[compat]
ArrayInterfaceCore = "0.1.13"
ArrayInterfaceStaticArrays = "0.1"
ArrayInterfaceStaticArraysCore = "0.1"
ChainRulesCore = "1"
MacroTools = "0.5"
StaticArraysCore = "1"
PreallocationTools = "0.4"
RecursiveArrayTools = "2"
StaticArrays = "1.0"
julia = "1.6"

[extras]
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "OrdinaryDiffEq", "InteractiveUtils", "ChainRulesTestUtils"]
test = ["Test", "OrdinaryDiffEq", "InteractiveUtils", "ChainRulesTestUtils", "StaticArrays"]
2 changes: 1 addition & 1 deletion src/LabelledArrays.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module LabelledArrays

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

include("slarray.jl")
Expand Down
24 changes: 12 additions & 12 deletions src/slarray.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
struct SLArray{S, T, N, L, Syms} <: StaticArray{S, T, N}
__x::SArray{S, T, N, L}
struct SLArray{S, T, N, L, Syms} <: StaticArraysCore.StaticArray{S, T, N}
__x::StaticArraysCore.SArray{S, T, N, L}
#SLArray{Syms}(__x::StaticArray{S,T,N}) where {S,N,Syms,T} = new{S,N,Syms,T}(__x)
function SLArray{S, T, N, Syms}(__x::SArray) where {S, T, N, Syms}
function SLArray{S, T, N, Syms}(__x::StaticArraysCore.SArray) where {S, T, N, Syms}
new{S, T, N, length(__x), Syms}(convert.(T, __x))
end
function SLArray{S, Syms}(__x::SArray{S, T, N, L}) where {S, T, N, L, Syms}
function SLArray{S, Syms}(__x::StaticArraysCore.SArray{S, T, N, L}) where {S, T, N, L, Syms}
new{S, T, N, L, Syms}(__x)
end
function SLArray{S, T, Syms}(__x::SArray{S, T, N, L}) where {S, T, N, L, Syms}
function SLArray{S, T, Syms}(__x::StaticArraysCore.SArray{S, T, N, L}) where {S, T, N, L, Syms}
new{S, T, N, L, Syms}(__x)
end
function SLArray{S, Syms}(x::Tuple) where {S, Syms}
__x = SArray{S}(x)
__x = StaticArraysCore.SArray{S}(x)
SLArray{S, Syms}(__x)
end
function SLArray{S, T, Syms}(x::Tuple) where {S, T, Syms}
__x = SArray{S, T}(x)
__x = StaticArraysCore.SArray{S, T}(x)
SLArray{S, T, Syms}(__x)
end
function SLArray{S, T, N, L, Syms}(x::Tuple) where {S, T, N, L, Syms}
__x = SArray{S, T, N, L}(x)
__x = StaticArraysCore.SArray{S, T, N, L}(x)
new{S, T, N, L, Syms}(__x)
end
end
Expand All @@ -35,7 +35,7 @@ function Base.convert(::Type{NamedTuple},
end
Base.keys(x::SLArray{S, T, N, L, Syms}) where {S, T, N, L, Syms} = Syms

function StaticArrays.similar_type(::Type{SLArray{S, T, N, L, Syms}}, T2,
function StaticArraysCore.similar_type(::Type{SLArray{S, T, N, L, Syms}}, T2,
::Size{S}) where {S, T, N, L, Syms}
SLArray{S, T2, N, L, Syms}
end
Expand Down Expand Up @@ -159,7 +159,7 @@ function StaticArrays.similar_type(::Type{SLArray{S, T, N, L, Syms}}, ::Type{New
if n == L
SLArray{Tuple{NewSize...}, NewElType, length(NewSize), L, Syms}
else
SArray{Tuple{NewSize...}, NewElType, length(NewSize), n}
StaticArraysCore.SArray{Tuple{NewSize...}, NewElType, length(NewSize), n}
end
end

Expand Down Expand Up @@ -235,15 +235,15 @@ julia> y = EFG(1.0,2.5,3.0,5.0)
2.5 5.0

julia> y.g
3-element view(reshape(::StaticArrays.SArray{Tuple{2,2},Float64,2,4}, 4), 2:4) with eltype Float64:
3-element view(reshape(::StaticArrays.StaticArraysCore.SArray{Tuple{2,2},Float64,2,4}, 4), 2:4) with eltype Float64:
2.5
3.0
5.0

julia> Arr = @SLArray (2, 2) (a = (2, :), b = 3);
julia> z = Arr(1, 2, 3, 4);
julia> z.a
2-element view(::StaticArrays.SArray{Tuple{2,2},Int64,2,4}, 2, :) with eltype Int64:
2-element view(::StaticArrays.StaticArraysCore.SArray{Tuple{2,2},Int64,2,4}, 2, :) with eltype Int64:
2
4
```
Expand Down