numpy.testing.assert_array_less()

numpy.testing.assert_array_less(x, y, err_msg='', verbose=True) [source] Raises an AssertionError if two array_like objects are not ordered by less than. Given two array_like objects, check that the shape is equal and all elements of the first object are strictly smaller than those of the second object. An exception is raised at shape mismatch or incorrectly ordered values. Shape mismatch does not raise if an object has zero dimension. In contrast to the standard usage in numpy, NaNs are co

numpy.testing.assert_array_equal()

numpy.testing.assert_array_equal(x, y, err_msg='', verbose=True) [source] Raises an AssertionError if two array_like objects are not equal. Given two array_like objects, check that the shape is equal and all elements of these objects are equal. An exception is raised at shape mismatch or conflicting values. In contrast to the standard usage in numpy, NaNs are compared like numbers, no assertion is raised if both objects have NaNs in the same positions. The usual caution for verifying equali

numpy.testing.assert_array_almost_equal_nulp()

numpy.testing.assert_array_almost_equal_nulp(x, y, nulp=1) [source] Compare two arrays relatively to their spacing. This is a relatively robust method to compare two arrays whose amplitude is variable. Parameters: x, y : array_like Input arrays. nulp : int, optional The maximum number of unit in the last place for tolerance (see Notes). Default is 1. Returns: None Raises: AssertionError If the spacing between x and y for one or more elements is larger than nulp. See also asse

numpy.testing.assert_array_almost_equal()

numpy.testing.assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True) [source] Raises an AssertionError if two objects are not equal up to desired precision. Note It is recommended to use one of assert_allclose, assert_array_almost_equal_nulp or assert_array_max_ulp instead of this function for more consistent floating point comparisons. The test verifies identical shapes and verifies values with abs(desired-actual) < 0.5 * 10**(-decimal). Given two array_like objects, che

numpy.testing.assert_approx_equal()

numpy.testing.assert_approx_equal(actual, desired, significant=7, err_msg='', verbose=True) [source] Raises an AssertionError if two items are not equal up to significant digits. Note It is recommended to use one of assert_allclose, assert_array_almost_equal_nulp or assert_array_max_ulp instead of this function for more consistent floating point comparisons. Given two numbers, check that they are approximately equal. Approximately equal is defined as the number of significant digits that

numpy.testing.assert_almost_equal()

numpy.testing.assert_almost_equal(actual, desired, decimal=7, err_msg='', verbose=True) [source] Raises an AssertionError if two items are not equal up to desired precision. Note It is recommended to use one of assert_allclose, assert_array_almost_equal_nulp or assert_array_max_ulp instead of this function for more consistent floating point comparisons. The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal). Given two objects (numbers or ndarrays), check that all elements

numpy.testing.assert_allclose()

numpy.testing.assert_allclose(actual, desired, rtol=1e-07, atol=0, equal_nan=False, err_msg='', verbose=True) [source] Raises an AssertionError if two objects are not equal up to desired tolerance. The test is equivalent to allclose(actual, desired, rtol, atol). It compares the difference between actual and desired to atol + rtol * abs(desired). New in version 1.5.0. Parameters: actual : array_like Array obtained. desired : array_like Array desired. rtol : float, optional Relative t

numpy.tensordot()

numpy.tensordot(a, b, axes=2) [source] Compute tensor dot product along specified axes for arrays >= 1-D. Given two tensors (arrays of dimension greater than or equal to one), a and b, and an array_like object containing two array_like objects, (a_axes, b_axes), sum the products of a?s and b?s elements (components) over the axes specified by a_axes and b_axes. The third argument can be a single non-negative integer_like scalar, N; if it is such, then the last N dimensions of a and the fi

numpy.tanh()

numpy.tanh(x[, out]) = Compute hyperbolic tangent element-wise. Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x). Parameters: x : array_like Input array. out : ndarray, optional Output array of same shape as x. Returns: y : ndarray The corresponding hyperbolic tangent values. Raises: ValueError: invalid return array shape if out is provided and out.shape != x.shape (See Examples) Notes If out is provided, the function writes the result into it, and returns a referenc

numpy.tan()

numpy.tan(x[, out]) = Compute tangent element-wise. Equivalent to np.sin(x)/np.cos(x) element-wise. Parameters: x : array_like Input array. out : ndarray, optional Output array of same shape as x. Returns: y : ndarray The corresponding tangent values. Raises: ValueError: invalid return array shape if out is provided and out.shape != x.shape (See Examples) Notes If out is provided, the function writes the result into it, and returns a reference to out. (See Examples) Reference