The use of np.allclose introduced a severe performance penalty, caused by the creation of two `np.array`s for each check. Instead create and use a similar check which maintains tolerance to floating point rounding, but operates only on scalars.