Coverage for src/pymor/tools/floatcmp : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
'''Compare x and y component-wise for almost equality.
For scalars we define almost equality as ::
float_cmp(x,y) <=> |x - y| <= atol + |y|*rtol
.. note:: Numpy's :meth:`~numpy.allclose` method uses the same definition but treats arrays containing infinities as close if the infinities are at the same places and all other entries are close. In our definition, arrays containing infinities can never be close which seems more appropriate in most cases.
Parameters ---------- x, y |NumPy arrays| to be compared. Have to be broadcastable to the same shape. rtol The relative tolerance. If `None`, it is set to `float_cmp_tol` |default| value. atol The absolute tolerance. If `None`, it is set to `rtol`. '''
'''Compare x and y for almost equality.
Returns `True` if all components of `x` are almost equal to the corresponding components of `y`.
See :meth:`float_cmp`. ''' |