11using ArrayInterface, Static, LinearAlgebra
22
3- struct MArray{T,N,R} <: AbstractArray {T,N}
3+ struct MArray{T,N,R} <: DenseArray {T,N}
44 parent:: Array{T,N}
55 indices:: LinearIndices{N,R}
66end
@@ -14,6 +14,7 @@ Base.axes(x::MArray) = ArrayInterface.axes(x)
1414ArrayInterface. axes_types (T:: Type{<:MArray} ) = T. parameters[3 ]
1515# ArrayInterface.size(x::MArray) = ArrayInterface.size(x.indices)
1616ArrayInterface. defines_strides (:: Type{<:MArray} ) = true
17+ Base. strides (x:: MArray ) = strides (parent (x))
1718function Base. getindex (x:: MArray , inds... )
1819 @boundscheck checkbounds (x, inds... )
1920 @inbounds parent (x)[inds... ]
@@ -49,9 +50,8 @@ struct Wrapper{T,N,P<:AbstractArray{T,N}} <: ArrayInterface.AbstractArray2{T,N}
4950end
5051ArrayInterface. parent_type (:: Type{<:Wrapper{T,N,P}} ) where {T,N,P} = P
5152Base. parent (x:: Wrapper ) = x. parent
52- ArrayInterface. device (:: Type{T} ) where {T<: Wrapper } = device (parent_type (T))
53+ ArrayInterface. device (:: Type{T} ) where {T<: Wrapper } = ArrayInterface . device (ArrayInterface . parent_type (T))
5354
5455struct DenseWrapper{T,N,P<: AbstractArray{T,N} } <: DenseArray{T,N} end
5556ArrayInterface. parent_type (:: Type{DenseWrapper{T,N,P}} ) where {T,N,P} = P
5657
57-
0 commit comments