aeq

pyvsim.Utils.aeq(a, b, tol=1e-08)[source]

A tool for comparing numpy ndarrays and checking if all their values are Almost EQual up to a given tolerance.

Parameters :

a,b : scalar of numpy.ndarray

Values to be compared, must have the same size

tol = 1e-8 :

The tolerance of the comparison

Returns :

True, False :

Depending if the absolute difference between of one of the values of the inputs exceeds the tolerance

Examples

>>> aeq(0,0.00000000000001)
True
>>> aeq(np.array([1,0,0]),np.array([0.99999999999999,0,0]))
True
>>> aeq(np.array([1,0,0]),np.array([0.99999,0,0]))
False

This Page