@@ -151,6 +151,15 @@ function contiguous_axis(::Type{T}) where {T<:PermutedDimsArray}
151151 return from_parent_dims (T, c)
152152 end
153153end
154+ function contiguous_axis (:: Type{Base.ReshapedArray{T, 1, A, Tuple{}}} ) where {T, A}
155+ IfElse. ifelse (is_column_major (A) & is_dense (A), static (1 ), nothing )
156+ end
157+ function contiguous_axis (:: Type{Base.ReshapedArray{T, 1, LinearAlgebra.Adjoint{T, A}, Tuple{}}} ) where {T, A <: AbstractVector{T} }
158+ IfElse. ifelse (is_column_major (A) & is_dense (A), static (1 ), nothing )
159+ end
160+ function contiguous_axis (:: Type{Base.ReshapedArray{T, 1, LinearAlgebra.Transpose{T, A}, Tuple{}}} ) where {T, A <: AbstractVector{T} }
161+ IfElse. ifelse (is_column_major (A) & is_dense (A), static (1 ), nothing )
162+ end
154163function contiguous_axis (:: Type{T} ) where {T<: SubArray }
155164 return _contiguous_axis (T, contiguous_axis (parent_type (T)))
156165end
267276function stride_rank (:: Type {Base. ReshapedArray{T, N, P, Tuple{Vararg{Base. SignedMultiplicativeInverse{Int},M}}}}) where {T,N,P,M}
268277 _reshaped_striderank (is_column_major (P), Val {N} (), Val {M} ())
269278end
279+ function stride_rank (:: Type{Base.ReshapedArray{T, 1, A, Tuple{}}} ) where {T, A}
280+ IfElse. ifelse (is_column_major (A) & is_dense (A), (static (1 ),), nothing )
281+ end
282+ function stride_rank (:: Type{Base.ReshapedArray{T, 1, LinearAlgebra.Adjoint{T, A}, Tuple{}}} ) where {T, A <: AbstractVector{T} }
283+ IfElse. ifelse (is_dense (A), (static (1 ),), nothing )
284+ end
285+ function stride_rank (:: Type{Base.ReshapedArray{T, 1, LinearAlgebra.Transpose{T, A}, Tuple{}}} ) where {T, A <: AbstractVector{T} }
286+ IfElse. ifelse (is_dense (A), (static (1 ),), nothing )
287+ end
288+
270289_reshaped_striderank (:: True , :: Val{N} , :: Val{0} ) where {N} = nstatic (Val (N))
271290_reshaped_striderank (_, __, ___) = nothing
272291
425444function dense_dims (:: Type {Base. ReshapedArray{T, N, P, Tuple{Vararg{Base. SignedMultiplicativeInverse{Int},M}}}}) where {T,N,P,M}
426445 return _reshaped_dense_dims (dense_dims (P), is_column_major (P), Val {N} (), Val {M} ())
427446end
447+ is_dense (A) = is_dense (typeof (A))
448+ is_dense (:: Type{A} ) where {A} = _is_dense (dense_dims (A))
449+ _is_dense (:: Tuple{False,Vararg} ) = False ()
450+ _is_dense (t:: Tuple{True,Vararg} ) = _is_dense (Base. tail (t))
451+ _is_dense (t:: Tuple{True} ) = True ()
452+ _is_dense (t:: Tuple{} ) = True ()
453+
454+
428455_reshaped_dense_dims (_, __, ___, ____) = nothing
429456function _reshaped_dense_dims (dense:: D , :: True , :: Val{N} , :: Val{0} ) where {D,N}
430457 if all (dense)
0 commit comments