In my python code, I regularly verify some calculations using numpy.allclose
. On the other hand, apart from these checks the implementation is able to deal with multiprecision (mpmath.mpc
) numbers. If I want to run my verification code for the mpmath
numbers, I get something like
>>> check(H)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "module.py", line 19, in check_H
assert(numpy.allclose(H, I, rtol=rtol, atol=atol))
File "/home/gereon/python/numpy/core/numeric.py", line 2025, in allclose
xinf = isinf(x)
TypeError: ufunc 'isinf' not supported for the input types, and the inputs could
not be safely coerced to any supported types according to the casting rule ''safe''
What is the best way to check if two multiprecision arrays are sufficiently equal?