@@ -164,7 +164,8 @@ function contiguous_axis(::Type{T}) where {T<:PermutedDimsArray}
164
164
end
165
165
end
166
166
function contiguous_axis (:: Type{<:Base.ReshapedArray{T, N, A, Tuple{}}} ) where {T, N, A}
167
- if isone (- contiguous_axis (A))
167
+ c = contiguous_axis (A)
168
+ if c != = nothing && isone (- c)
168
169
return StaticInt (- 1 )
169
170
elseif dynamic (is_column_major (A) & is_dense (A))
170
171
return StaticInt (1 )
@@ -455,9 +456,17 @@ _dense_dims(::Type{S}, ::Nothing, ::Val{R}) where {R,N,NP,T,A<:AbstractArray{T,N
455
456
end
456
457
end
457
458
458
- function dense_dims (:: Type {Base. ReshapedArray{T, N, P, Tuple{Vararg{Base. SignedMultiplicativeInverse{Int},M}}}}) where {T,N,P,M}
459
- return _reshaped_dense_dims (dense_dims (P), is_column_major (P), Val {N} (), Val {M} ())
459
+ function dense_dims (T:: Type{<:Base.ReshapedArray} )
460
+ d = dense_dims (parent_type (T))
461
+ if d === nothing
462
+ return nothing
463
+ elseif all (d)
464
+ return n_of_x (StaticInt (ndims (T)), True ())
465
+ else
466
+ return n_of_x (StaticInt (ndims (T)), False ())
467
+ end
460
468
end
469
+
461
470
is_dense (A) = is_dense (typeof (A))
462
471
is_dense (:: Type{A} ) where {A} = _is_dense (dense_dims (A))
463
472
_is_dense (:: Tuple{False,Vararg} ) = False ()
@@ -466,19 +475,6 @@ _is_dense(t::Tuple{True}) = True()
466
475
_is_dense (t:: Tuple{} ) = True ()
467
476
_is_dense (:: Nothing ) = False ()
468
477
469
-
470
- _reshaped_dense_dims (_, __, ___, ____) = nothing
471
- function _reshaped_dense_dims (dense:: Tuple , :: True , :: Val{N} , :: Val{0} ) where {N}
472
- if all (dense)
473
- return _all_dense (Val {N} ())
474
- else
475
- return nothing
476
- end
477
- end
478
- function _reshaped_dense_dims (dense:: Tuple{Static.False} , :: True , :: Val{N} , :: Val{0} ) where {N}
479
- return return ntuple (_ -> False (), Val {N} ())
480
- end
481
-
482
478
"""
483
479
known_strides(::Type{T}) -> Tuple
484
480
known_strides(::Type{T}, dim) -> Union{Int,Nothing}
0 commit comments