Skip to content

Commit

Permalink
Add ndims(::Type{<:Symmetric}) (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuri3 authored Oct 31, 2023
1 parent 73ee022 commit 27aeab9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ ndims(::Type{<:LinearAlgebra.UpperTriangular}) = 2
ndims(::Type{<:LinearAlgebra.UnitUpperTriangular}) = 2
ndims(::Type{<:LinearAlgebra.Diagonal}) = 2
ndims(::Type{<:LinearAlgebra.Tridiagonal}) = 2
ndims(::Type{<:LinearAlgebra.Symmetric}) = 2
ndims(::Type{<:WrappedArray{<:Any,N}}) where {N} = N

eltype(::Type{<:WrappedArray{T}}) where {T} = T # every wrapper has a T typevar
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ end

@testset "type information" begin
@test Adapt.ndims(LinearAlgebra.Transpose{Float64,Array{Float64,1}}) == 2
@test Adapt.ndims(LinearAlgebra.Symmetric{Float64,Matrix{Float64}}) == 2
@test Adapt.ndims(Adapt.WrappedSubArray{Float64,3,Array{Float64,3}}) == 3

@test Adapt.parent(LinearAlgebra.Transpose{Float64,Array{Float64,1}}) == Array
Expand Down

0 comments on commit 27aeab9

Please sign in to comment.