Skip to content

Commit

Permalink
fix strides of zero-dimensional arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Mar 1, 2019
1 parent c9d9e41 commit da6574d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/stridedview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ StridedView(a::Base.ReshapedArray) = sreshape(StridedView(a.parent), a.dims)
# Methods for StridedView
Base.size(a::StridedView) = a.size
Base.strides(a::StridedView) = a.strides
Base.stride(a::StridedView{<:Any, 0}, n::Int) = 1
Base.stride(a::StridedView{<:Any, N}, n::Int) where N =
(n <= N) ? a.strides[n] : a.strides[N]*a.size[N]
offset(a::StridedView) = a.offset
Expand Down
1 change: 1 addition & 0 deletions src/unsafestridedview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ UnsafeStridedView(a::Base.ReshapedArray) = sreshape(UnsafeStridedView(a.parent),
# Methods for UnsafeStridedView
Base.size(a::UnsafeStridedView) = a.size
Base.strides(a::UnsafeStridedView) = a.strides
Base.stride(a::UnsafeStridedView{<:Any, 0}, n::Int) = 1
Base.stride(a::UnsafeStridedView{<:Any, N}, n::Int) where {N} =
(n <= N) ? a.strides[n] : a.strides[N]*a.size[N]
offset(a::UnsafeStridedView) = a.offset
Expand Down

0 comments on commit da6574d

Please sign in to comment.