-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]
Description
The docstring for stride
:
help?> stride
search: stride strides StridedArray StridedVector StridedMatrix StridedVecOrMat strwidth SymTridiagonal
stride(A, k)
Returns the distance in memory (in number of elements) between adjacent elements in dimension k.
specifies "in memory", but the signature for stride
is stride(a::AbstractArray, i::Integer)
, and some AbstractArray
s do not even store their values in memory:
julia> stride(1:5, 1)
1
julia> isa(1:5, StridedArray)
false
Should we change it to StridedArray
? The biggest problem with this is that StridedArray
was the motivating poster child for the desirability of traits, because StridedArray
cannot be extended to user types.
We could introduce an IsStrided
trait,
strided(A::StridedArray) = IsStrided()
strided(A) = NotStrided()
and dispatch on it for strides
and stride
. But then that implicitly places some expectation that the linear algebra code might switch to the trait rather than dispatching on StridedArray
, and that's a lot of code to modify. So I didn't want to do this lightly.
Metadata
Metadata
Assignees
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]