pyyeti.cla.nan_absmax

pyyeti.cla.nan_absmax(v1, v2)[source]

Get absolute maximum values between v1 and v2 while retaining signs and ignoring NaNs.

Parameters:
  • v1 (ndarray) – First set of values to compare

  • v2 (ndarray) – Second set of values to compare; must be broadcast-compatible with v1.

Returns:

  • amax (ndarray) – The absolute maximum values over v1 and v2. The signs are retained and NaNs are ignored as much as possible.

  • pv (bool ndarray) – Contains True where abs(v2) is greater than abs(v1) ignoring NaNs.

Examples

>>> import numpy as np
>>> from pyyeti import cla
>>> v1 = np.array([[1, -4], [3, 5]])
>>> v2 = np.array([[-2, 3], [4, np.nan]])
>>> cla.nan_absmax(v1, v2)
(array([[-2, -4],
       [ 4,  5]]), array([[ True, False],
       [ True, False]], dtype=bool))