From f3a07ae9ed5cc841f7423d2ae82b9d697ba72608 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Mon, 10 Aug 2015 19:19:23 -0400 Subject: [PATCH] don't use pointwise isapprox for rough array comparisons --- src/helpers.jl | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/helpers.jl b/src/helpers.jl index fe082fd..399677c 100644 --- a/src/helpers.jl +++ b/src/helpers.jl @@ -35,17 +35,11 @@ roughly(x::Number; kvtols...) = (y::Number) -> isapprox(y, x; kvtols...) roughly(A::AbstractArray, atol) = (B::AbstractArray) -> begin size(A) != size(B) && return false - for i in 1:length(A) - !isapprox(A[i], B[i], atol=atol) && return false - end - return true + return isapprox(A, B, atol=atol) end roughly(A::AbstractArray; kvtols...) = (B::AbstractArray) -> begin size(A) != size(B) && return false - for i in 1:length(A) - !isapprox(A[i], B[i]; kvtols...) && return false - end - return true + return isapprox(A, B; kvtols...) end # anyof: match any of the arguments