@@ -151,6 +151,15 @@ function contiguous_axis(::Type{T}) where {T<:PermutedDimsArray}
151
151
return from_parent_dims (T, c)
152
152
end
153
153
end
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
154
163
function contiguous_axis (:: Type{T} ) where {T<: SubArray }
155
164
return _contiguous_axis (T, contiguous_axis (parent_type (T)))
156
165
end
267
276
function stride_rank (:: Type {Base. ReshapedArray{T, N, P, Tuple{Vararg{Base. SignedMultiplicativeInverse{Int},M}}}}) where {T,N,P,M}
268
277
_reshaped_striderank (is_column_major (P), Val {N} (), Val {M} ())
269
278
end
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
+
270
289
_reshaped_striderank (:: True , :: Val{N} , :: Val{0} ) where {N} = nstatic (Val (N))
271
290
_reshaped_striderank (_, __, ___) = nothing
272
291
425
444
function dense_dims (:: Type {Base. ReshapedArray{T, N, P, Tuple{Vararg{Base. SignedMultiplicativeInverse{Int},M}}}}) where {T,N,P,M}
426
445
return _reshaped_dense_dims (dense_dims (P), is_column_major (P), Val {N} (), Val {M} ())
427
446
end
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
+
428
455
_reshaped_dense_dims (_, __, ___, ____) = nothing
429
456
function _reshaped_dense_dims (dense:: D , :: True , :: Val{N} , :: Val{0} ) where {D,N}
430
457
if all (dense)
0 commit comments