I'm working on numerical algorithms and I have a Numpy backend for fast, fixed-precision calculations.
During the initialization of the interface I let the user choose among the complex data types npplex128
, npplex192
, npplex256
, npplex512
.
I know that Numpy defines these types as dummy types if the underlying platform doesn't support them. I would like to check at runtime whether these types are supported, and take the largest available.
How do I check for 'dumminess'? My idea was to try instantiate a numpy array with the dtype and see whether it raises an error, but it's not very clean to do... I was wondering if there is a better way to do it.