快速纽比乌芬奇行动
fastfunc的Python项目详细描述
fastfunc
NumPy's own ufunc
operations
很方便,但是速度很慢(参见https://github.com/numpy/numpy/issues/5922https://github.com/numpy/numpy/issues/11156)。使用fastfunc
作为替换
# import numpy# numpy.add.at(target, idx, vals)importfastfuncfastfunc.add.at(target,idx,vals)# If you really only need _add_, you can use# numpy.bincount(idx, weights=vals, minlength=target.shape[0])
以40倍的速度加速。
这是通过使用pybind11将操作移动到C++来实现的。
安装
fastfunc是available from the Python Package Index,所以
pip install -U fastfunc
安装或升级
测试
要运行fastfunc单元测试,请签出此存储库并键入
pytest
许可证
fastfunc发布在MIT license下。