From 17aeb65b3a20ad26a180f4a9d85e8b3a934d327b Mon Sep 17 00:00:00 2001 From: Matthew Priddin Date: Wed, 16 Nov 2022 11:41:07 +0000 Subject: [PATCH 1/3] Add erroring test --- test/_functions.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/_functions.jl b/test/_functions.jl index 40548b9..77c22be 100644 --- a/test/_functions.jl +++ b/test/_functions.jl @@ -148,7 +148,7 @@ end @test axiskeys(filter(isodd, V2),1) isa Vector{Int} @test dimnames(filter(isodd, V2)) == (:v,) - + V4 = wrapdims(rand(1:99, 10), collect(2:11)) V4c = copy(V4) @test filter!(isodd, V4c) === V4c == filter(isodd, V4) @@ -352,6 +352,10 @@ end @test axiskeys(T10 \ V, 1) == 1:3 end + # Catch issue #133 + S = wrapdims(Symmetric(rand(Int8,3,3)), 'a':'c', 10:10:30) + @test LinearAlgebra.copy_oftype(S, eltype(S)) == S + @testset "cholesky" begin A = rand(10, 3) ka = KeyedArray(A, (0:9, ["a", "b", "c"])) From bc6e15227ec289c56f98bdeaf4a947f43d81b731 Mon Sep 17 00:00:00 2001 From: Matthew Priddin Date: Wed, 16 Nov 2022 11:46:12 +0000 Subject: [PATCH 2/3] Extend `LinearAlgebra.copy_oftype` --- src/functions.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/functions.jl b/src/functions.jl index e65a97b..2caefc8 100644 --- a/src/functions.jl +++ b/src/functions.jl @@ -425,6 +425,11 @@ LinearAlgebra.cholesky(A::Hermitian{T, <:KeyedArray{T}}; kwargs...) where {T} = LinearAlgebra.cholesky(A::KeyedMatrix; kwargs...) = cholesky(keyless_unname(A); kwargs...) +# Defer to LinearAlgebra.copy_oftype for parent Array - see issue #133 +function LinearAlgebra.copy_oftype(A::KeyedArray, ::Type{T}) where {T} + return KeyedArray(LinearAlgebra.copy_oftype(parent(A), T), axiskeys(A)) +end + function Base.deleteat!(v::KeyedVector, inds) deleteat!(axiskeys(v, 1), inds) deleteat!(v.data, inds) @@ -441,4 +446,3 @@ function Base.filter!(f, a::KeyedVector) deleteat!(a, j:lastindex(a)) return a end - From fed0bcd2ff0552fc122e359dc61fcd836e465e46 Mon Sep 17 00:00:00 2001 From: mjp98 Date: Wed, 16 Nov 2022 11:51:29 +0000 Subject: [PATCH 3/3] Bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3015728..f00e2e5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AxisKeys" uuid = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" license = "MIT" -version = "0.2.10" +version = "0.2.11" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"