Skip to content

Commit

Permalink
Remove k < 1 special case
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Jun 18, 2020
1 parent 05d1091 commit 01485ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ julia> stride(A,3)
"""
function stride(A::AbstractArray, k::Integer)
st = strides(A)
k < 1 && return 1
k ndims(A) && return st[k]
length(A)
end
Expand Down
4 changes: 2 additions & 2 deletions stdlib/LinearAlgebra/test/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,19 +462,19 @@ Base.strides(A::WrappedArray) = strides(A.A)

@testset "strided interface adjtrans" begin
x = WrappedArray([1, 2, 3, 4])
@test stride(x,0) == 1
@test stride(x,1) == 1
@test stride(x,2) == stride(x,3) == 4
@test strides(x') == strides(transpose(x)) == (4,1)
@test pointer(x') == pointer(transpose(x)) == pointer(x)
@test_throws BoundsError stride(x,0)

A = WrappedArray([1 2; 3 4; 5 6])
@test stride(A,0) == 1
@test stride(A,1) == 1
@test stride(A,2) == 3
@test stride(A,3) == stride(A,4) == 6
@test strides(A') == strides(transpose(A)) == (3,1)
@test pointer(A') == pointer(transpose(A)) == pointer(A)
@test_throws BoundsError stride(A,0)

y = WrappedArray([1+im, 2, 3, 4])
@test strides(transpose(y)) == (4,1)
Expand Down

0 comments on commit 01485ed

Please sign in to comment.