@@ -2004,12 +2004,7 @@ function isapprox(x::AbstractArray, y::AbstractArray;
20042004 atol:: Real = 0 ,
20052005 rtol:: Real = Base. rtoldefault (promote_leaf_eltypes (x),promote_leaf_eltypes (y),atol),
20062006 nans:: Bool = false , norm:: Function = norm)
2007- Base. promote_shape (size (x), size (y)) # ensure compatible size
2008- d = if isempty (x) && isempty (y)
2009- norm (zero (eltype (x)) - zero (eltype (y)))
2010- else
2011- norm_x_minus_y (x, y)
2012- end
2007+ d = norm_x_minus_y (x, y)
20132008 if isfinite (d)
20142009 return iszero (rtol) ? d <= atol : d <= max (atol, rtol* max (norm (x), norm (y)))
20152010 else
@@ -2023,7 +2018,12 @@ norm_x_minus_y(x, y) = norm(x - y)
20232018FastContiguousArrayView{T,N,P<: Array ,I<: Tuple{AbstractUnitRange, Vararg{Any}} } = Base. SubArray{T,N,P,I,true }
20242019const ArrayOrFastContiguousArrayView = Union{Array, FastContiguousArrayView}
20252020function norm_x_minus_y (x:: ArrayOrFastContiguousArrayView , y:: ArrayOrFastContiguousArrayView )
2026- norm (Iterators. map (splat (- ), zip (x,y)))
2021+ Base. promote_shape (size (x), size (y)) # ensure compatible size
2022+ if isempty (x) && isempty (y)
2023+ norm (zero (eltype (x)) - zero (eltype (y)))
2024+ else
2025+ norm (Iterators. map (splat (- ), zip (x,y)))
2026+ end
20272027end
20282028
20292029"""
0 commit comments