最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Select the largest available data type in Numpy - Stack Overflow

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论