numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)

The tolerance values are positive, typically very small numbers. The relative difference (:None:None:`rtol` * abs(b)) and the absolute difference :None:None:`atol` are added together to compare against the absolute difference between a and b.

NaNs are treated as equal if they are in the same place and if equal_nan=True . Infs are treated as equal if they are in the same place and of the same sign in both arrays.

Notes

If the following equation is element-wise True, then allclose returns True.

absolute(a - b) <= (:None:None:`atol` + :None:None:`rtol` * absolute(b))

The above equation is not symmetric in a and b, so that allclose(a, b) might be different from allclose(b, a) in some rare cases.

The comparison of a and b uses standard broadcasting, which means that a and b need not have the same shape in order for allclose(a, b) to evaluate to True. The same is true for :None:None:`equal` but not array_equal .

allclose is not defined for non-numeric data types. :None:None:`bool` is considered a numeric data-type for this purpose.

Parameters

a, b : array_like

Input arrays to compare.

rtol : float

The relative tolerance parameter (see Notes).

atol : float

The absolute tolerance parameter (see Notes).

equal_nan : bool

Whether to compare NaN's as equal. If True, NaN's in a will be considered equal to NaN's in b in the output array.

versionadded

Returns

allclose : bool

Returns True if the two arrays are equal within the given tolerance; False otherwise.

Returns True if two arrays are element-wise equal within a tolerance.

See Also

all
any
equal
isclose

Examples

>>> np.allclose([1e10,1e-7], [1.00001e10,1e-8])
False
>>> np.allclose([1e10,1e-8], [1.00001e10,1e-9])
True
>>> np.allclose([1e10,1e-8], [1.0001e10,1e-9])
False
>>> np.allclose([1.0, np.nan], [1.0, np.nan])
False
>>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy

47 Elements
scipy.linalg._solvers.solve_continuous_are
scipy.linalg._decomp_update.qr_insert
scipy.linalg._decomp_qr.qr
scipy.linalg._basic.pinv
scipy.sparse.linalg._dsolve.linsolve.spsolve
scipy.special._orthogonal.chebyu
scipy.linalg._cythonized_array_utils.issymmetric
scipy.linalg._decomp_lu.lu_factor
scipy.linalg._decomp_svd.svd
scipy.optimize._zeros_py.newton
scipy.fft._realtransforms.dctn
scipy.linalg._decomp_lu.lu
scipy.fft._realtransforms.idctn
scipy.linalg._decomp_qr.qr_multiply
scipy.sparse.linalg._isolve.iterative.gmres
scipy.special._spherical_bessel.spherical_kn
scipy.special._orthogonal.genlaguerre
scipy.linalg._expm_frechet.expm_frechet
scipy.special._spherical_bessel.spherical_yn
scipy.linalg._decomp_cholesky.cholesky_banded
scipy.linalg._decomp_cholesky.cho_factor
scipy.linalg._solvers.solve_sylvester
scipy.linalg._decomp.eig_banded
scipy.sparse.linalg._eigen._svds.svds
scipy.special._orthogonal.chebyt
scipy.linalg._solvers.solve_discrete_lyapunov
scipy.linalg._basic.pinvh
scipy.sparse.linalg._isolve.tfqmr.tfqmr
scipy.linalg._decomp_cholesky.cho_solve_banded
scipy.special._spherical_bessel.spherical_jn
scipy.fft._realtransforms.idstn
scipy.special._orthogonal.laguerre
scipy.special._spherical_bessel.spherical_in
scipy.fft._realtransforms.dstn
scipy.linalg._cythonized_array_utils.ishermitian
scipy.linalg._decomp_update.qr_delete
scipy.linalg._decomp_update.qr_update
scipy.sparse.linalg._dsolve.linsolve.spsolve_triangular
scipy.linalg._decomp_cholesky.cho_solve
scipy.linalg._decomp_lu.lu_solve
scipy.interpolate._cubic.CubicSpline
scipy.linalg._solvers.solve_discrete_are
scipy.linalg._decomp_qr.rq
scipy.linalg._decomp.eigh
scipy.sparse.linalg._isolve.iterative.qmr
scipy.linalg._solvers.solve_continuous_lyapunov
scipy.interpolate._bsplines.make_interp_spline

skimage

skimage.restoration.uft.uirfft2
skimage.restoration.uft.uirfftn
skimage.restoration.uft.uifftn
skimage.measure._moments.moments_coords_central
skimage.restoration.uft.urfftn
skimage.restoration.uft.ufftn
skimage.restoration.uft.ufft2
skimage.restoration.uft.urfft2
skimage.restoration.uft.uifft2

dask

dask.array.routines.allclose

numpy

numpy.array_equal
numpy.isclose
numpy.ma.core.allclose
numpy.allclose

astropy

astropy.io.fits.diff.TableDataDiff.__init__
astropy.io.fits.diff.ImageDataDiff.__init__
astropy.io.fits.diff.HDUDiff.__init__
astropy.io.fits.diff.HeaderDiff.__init__
astropy.io.fits.diff.FITSDiff.__init__

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/numeric.py#2180
type: <class 'function'>
Commit: