diff --git a/src/wrappers.jl b/src/wrappers.jl index b103569..09301d6 100644 --- a/src/wrappers.jl +++ b/src/wrappers.jl @@ -41,6 +41,8 @@ adapt_structure(to, A::LinearAlgebra.Diagonal) = LinearAlgebra.Diagonal(adapt(to, Base.parent(A))) adapt_structure(to, A::LinearAlgebra.Tridiagonal) = LinearAlgebra.Tridiagonal(adapt(to, A.dl), adapt(to, A.d), adapt(to, A.du)) +adapt_structure(to, A::LinearAlgebra.Symmetric) = + LinearAlgebra.Symmetric(adapt(to, Base.parent(A))) # we generally don't support multiple layers of wrappers, but some occur often @@ -92,6 +94,7 @@ WrappedArray{T,N,Src,Dst} = Union{ LinearAlgebra.UnitUpperTriangular{T,<:Dst}, LinearAlgebra.Diagonal{T,<:Dst}, LinearAlgebra.Tridiagonal{T,<:Dst}, + LinearAlgebra.Symmetric{T,<:Dst}, WrappedReinterpretArray{T,N,<:Src}, WrappedReshapedArray{T,N,<:Src}, diff --git a/test/runtests.jl b/test/runtests.jl index 41f716a..b582913 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -162,6 +162,7 @@ using LinearAlgebra @test_adapt CustomArray UnitLowerTriangular(mat.arr) UnitLowerTriangular(mat) AnyCustomArray @test_adapt CustomArray UpperTriangular(mat.arr) UpperTriangular(mat) AnyCustomArray @test_adapt CustomArray UnitUpperTriangular(mat.arr) UnitUpperTriangular(mat) AnyCustomArray +@test_adapt CustomArray Symmetric(mat.arr) Symmetric(mat) AnyCustomArray @test_adapt CustomArray Diagonal(vec.arr) Diagonal(vec) AnyCustomArray