Skip to content

Commit

Permalink
Use parent for similar(::PermutedDimsArray)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Abbott committed Mar 31, 2020
1 parent ddf79a8 commit 753eba6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/permuteddimsarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ function PermutedDimsArray(data::AbstractArray{T,N}, perm) where {T,N}
end

Base.parent(A::PermutedDimsArray) = A.parent
Base.size(A::PermutedDimsArray{T,N,perm}) where {T,N,perm} = genperm(size(parent(A)), perm)
Base.size(A::PermutedDimsArray{T,N,perm}) where {T,N,perm} = genperm(size(parent(A)), perm)
Base.axes(A::PermutedDimsArray{T,N,perm}) where {T,N,perm} = genperm(axes(parent(A)), perm)

Base.similar(A::PermutedDimsArray, T::Type, dims::Base.Dims) = similar(parent(A), T, dims)

Base.unsafe_convert(::Type{Ptr{T}}, A::PermutedDimsArray{T}) where {T} = Base.unsafe_convert(Ptr{T}, parent(A))

# It's OK to return a pointer to the first element, and indeed quite
Expand Down

0 comments on commit 753eba6

Please sign in to comment.