Skip to content

Commit

Permalink
Improve find() deprecation for multidimensional arrays
Browse files Browse the repository at this point in the history
findall() returns cartesian indices (except for vectors), while find() returned linear indices.
  • Loading branch information
nalimilan committed Feb 23, 2018
1 parent cca1261 commit 5f427c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,10 @@ end
@deprecate findin(a, b) findall(occursin(b), a)

@deprecate find findall
@deprecate find(A::AbstractVector) findall(A)
@deprecate find(A::AbstractArray) LinearIndices(A)[findall(A)]
@deprecate find(f::Function, A::AbstractVector) findall(f, A)
@deprecate find(f::Function, A::AbstractArray) LinearIndices(A)[findall(f, A)]

@deprecate findn(x::AbstractVector) (findall(!iszero, x),)
@deprecate findn(x::AbstractMatrix) (I = findall(!iszero, x); (getindex.(I, 1), getindex.(I, 2)))
Expand Down

0 comments on commit 5f427c7

Please sign in to comment.