From 5f427c72b1f46f0bbd335095917f68573e34a0f4 Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Fri, 23 Feb 2018 20:01:42 +0100 Subject: [PATCH] Improve find() deprecation for multidimensional arrays findall() returns cartesian indices (except for vectors), while find() returned linear indices. --- base/deprecated.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base/deprecated.jl b/base/deprecated.jl index 4f1e02b7f6d70..5502b32cdab04 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -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)))