From 3bef07b3453ddde67ae9cc41beace96686cfa4ce Mon Sep 17 00:00:00 2001 From: Matthew Priddin Date: Wed, 16 Nov 2022 12:01:46 +0000 Subject: [PATCH 1/3] Add erroring test --- test/functions_linearalgebra.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/functions_linearalgebra.jl b/test/functions_linearalgebra.jl index 8e38390..1002051 100644 --- a/test/functions_linearalgebra.jl +++ b/test/functions_linearalgebra.jl @@ -222,3 +222,9 @@ end B = Float64.(A) @test isposdef!(NamedDimsArray{(:foo, :foo)}(B)) end + +@testset "#212 copy_oftype should defer to method for parent array" begin + # https://github.com/invenia/NamedDims.jl/issues/212 + nda = NamedDimsArray{(:foo, :bar)}(Symmetric([1 2 3; 4 5 4; 3 2 1])) # Int eltype + @test LinearAlgebra.copy_oftype(nda, Float64) == nda +end From 630ca6dbf3652c4e3a8743deab352fd4f50aacc5 Mon Sep 17 00:00:00 2001 From: Matthew Priddin Date: Wed, 16 Nov 2022 12:10:37 +0000 Subject: [PATCH 2/3] Extend `LinearAlgebra.copy_oftype` --- src/functions_linearalgebra.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/functions_linearalgebra.jl b/src/functions_linearalgebra.jl index c6555b2..8d7826d 100644 --- a/src/functions_linearalgebra.jl +++ b/src/functions_linearalgebra.jl @@ -178,3 +178,8 @@ LinearAlgebra.:\(A::Diagonal, B::NamedDimsArray) = LinearAlgebra.:\(A, parent(B) for f in [:isposdef, :eigen, :eigvals, :det, :logdet, :logabsdet] @eval LinearAlgebra.$f(A::NamedDimsArray) = $f(parent(A)) end + +# fix issue #212 copy_oftype should defer to method for parent array +function LinearAlgebra.copy_oftype(A::NamedDimsArray, ::Type{T}) where {T} + return NamedDimsArray(LinearAlgebra.copy_oftype(parent(A), T), dimnames(A)) +end From b2796468881927300cc1bd9c801ac576ffeb2731 Mon Sep 17 00:00:00 2001 From: Matthew Priddin Date: Wed, 16 Nov 2022 12:11:05 +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 eac8d2e..0472b57 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "NamedDims" uuid = "356022a1-0364-5f58-8944-0da4b18d706f" authors = ["Invenia Technical Computing Corporation"] -version = "1.1.0" +version = "1.1.1" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"