@@ -255,28 +255,13 @@ It returns true for `AbstractArray{T}`s when `check_type(T) == true` and the arr
255
255
To provide support for a custom array type, ensure that `check_args` returns true, either through overloading it or subtyping `DenseArray`.
256
256
Additionally, define `pointer` and `stride` methods.
257
257
"""
258
- @inline check_args (A:: SubArray{T,N,P,I} ) where {T,N,P,I<: Tuple{Vararg{Union{Int,Colon,AbstractRange}}} } = check_args (parent (A))
259
- @inline check_args (A:: OffsetArray ) = check_args (parent (A))
260
- @inline check_args (A:: Adjoint ) = check_args (parent (A))
261
- @inline check_args (A:: Transpose ) = check_args (parent (A))
262
- @inline check_args (A:: PermutedDimsArray ) = check_args (parent (A))
263
- @inline check_args (A:: StridedArray ) = check_type (eltype (A))
264
- @inline check_args (A:: AbstractRange ) = check_type (eltype (A))
265
- @inline check_args (A:: BitVector ) = true
266
- @inline check_args (A:: BitMatrix ) = true
267
- @inline function check_args (A:: AbstractArray )
268
- M = parentmodule (typeof (A))
269
- if parent (A) === A # SparseMatrix, StaticArray, etc
270
- false
271
- elseif M === Base || M === Core || M === LinearAlgebra
272
- # reshapes which aren't StridedArrays, plus UpperTriangular, etc.
273
- false
274
- else
275
- check_args (parent (A)) # PermutedDimsArray, NamedDimsArray
276
- end
258
+ @inline function check_args (A:: AbstractArray{T} ) where {T}
259
+ check_type (T) && ArrayInterface. device (A) === ArrayInterface. CPUPointer ()
277
260
end
278
- @inline check_args (A:: VectorizationBase.AbstractStridedPointer{T} ) where {T} = check_type (T)
279
- @inline check_args (A, Bs... ) = check_args (A) && check_args (Bs... )
261
+ @inline check_args (A:: BitVector ) = true
262
+ @inline check_args (A:: BitArray ) = iszero (size (A,1 ) & 7 )
263
+ @inline check_args (_) = false
264
+ @inline check_args (A, B, C:: Vararg{Any,K} ) where {K} = check_args (A) && check_args (B, C... )
280
265
"""
281
266
check_type(::Type{T}) where {T}
282
267
0 commit comments