(For an obsolete version of this answer, see the horizontal line below.)
The version of the isapprox array was introduced in Julia 0.4, so now you can write:
isapprox(A, B)
As in the scalar case, you can specify relative rtol tolerance and absolute atol tolerance as keyword arguments.
But note that unlike NumPy allclose (and the previous solution to this answer below), array- isapprox first calculates the norm and then decides the resulting value. (Apparently, the check isapprox pointwise is incorrect .) By default, the Frobenius norm is vecnorm , but you can override this behavior with the norm keyword argument.
By the way, as mentioned in the linked pull request, in tests you can write @test isapprox(A, B) , so @test_approx_eq now deprecated and deprecated as 0.6. In addition, there exists A β B , which is equivalent to isapprox(A, B) and can be used as any comparison operator: a < b β c β€ d .
For reference, this is the previous, deprecated version of this post:
For single numbers, isapprox is isapprox . If you want to extend this to an elementary comparison on Array s, you can use:
all(x -> isapprox(x...), zip(A, B)) all(x -> isapprox(x...), zip(A, A + 1e-5))