From c285ef6d9bf2b09cd9f119762e316b6a1c2db2d4 Mon Sep 17 00:00:00 2001 From: Lilith Orion Hafner Date: Wed, 22 May 2024 15:35:23 -0500 Subject: [PATCH 1/2] document that DenseArrays do not need to define `strides` to be Strided Arrays. --- doc/src/manual/interfaces.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/manual/interfaces.md b/doc/src/manual/interfaces.md index d158fb86575a2..87b8474f1eec3 100644 --- a/doc/src/manual/interfaces.md +++ b/doc/src/manual/interfaces.md @@ -399,10 +399,10 @@ perhaps range-types `Ind` of your own design. For more information, see | Methods to implement | | Brief description | |:----------------------------------------------- |:-------------------------------------- |:------------------------------------------------------------------------------------- | -| `strides(A)` | | Return the distance in memory (in number of elements) between adjacent elements in each dimension as a tuple. If `A` is an `AbstractArray{T,0}`, this should return an empty tuple. | | `Base.unsafe_convert(::Type{Ptr{T}}, A)` | | Return the native address of an array. | | `Base.elsize(::Type{<:A})` | | Return the stride between consecutive elements in the array. | | **Optional methods** | **Default definition** | **Brief description** | +| `strides(A)` | `strides(a::DenseArray{<:Any, 0}) = (); strides(a::DenseArray) = (1, accumulate(*, Base.front(size(a)))...);` | Return the distance in memory (in number of elements) between adjacent elements in each dimension as a tuple. If `A` is an `AbstractArray{T,0}`, this should return an empty tuple. Required iff `A` does not subtype `DenseArray`. | | `stride(A, i::Int)` | `strides(A)[i]` | Return the distance in memory (in number of elements) between adjacent elements in dimension k. | A strided array is a subtype of `AbstractArray` whose entries are stored in memory with fixed strides. From fb57c819dfebc426e1135caa562afa2fa0773358 Mon Sep 17 00:00:00 2001 From: Lilith Orion Hafner Date: Thu, 23 May 2024 15:31:36 -0500 Subject: [PATCH 2/2] Fix preexisting typo Co-authored-by: Daniel Karrasch --- doc/src/manual/interfaces.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/manual/interfaces.md b/doc/src/manual/interfaces.md index 87b8474f1eec3..07670e034a695 100644 --- a/doc/src/manual/interfaces.md +++ b/doc/src/manual/interfaces.md @@ -403,7 +403,7 @@ perhaps range-types `Ind` of your own design. For more information, see | `Base.elsize(::Type{<:A})` | | Return the stride between consecutive elements in the array. | | **Optional methods** | **Default definition** | **Brief description** | | `strides(A)` | `strides(a::DenseArray{<:Any, 0}) = (); strides(a::DenseArray) = (1, accumulate(*, Base.front(size(a)))...);` | Return the distance in memory (in number of elements) between adjacent elements in each dimension as a tuple. If `A` is an `AbstractArray{T,0}`, this should return an empty tuple. Required iff `A` does not subtype `DenseArray`. | -| `stride(A, i::Int)` | `strides(A)[i]` | Return the distance in memory (in number of elements) between adjacent elements in dimension k. | +| `stride(A, i::Int)` | `strides(A)[i]` | Return the distance in memory (in number of elements) between adjacent elements in dimension i. | A strided array is a subtype of `AbstractArray` whose entries are stored in memory with fixed strides. Provided the element type of the array is compatible with BLAS, a strided array can utilize BLAS and LAPACK routines