Skip to content
Fast numpy ufunc operations.
C++ Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
fastfunc
src
test
.flake8
.gitignore
LICENSE.txt
Makefile
README.md
codecov.yml
setup.py

README.md

fastfunc

CircleCI codecov Code style: black speedy PyPi Version GitHub stars PyPi downloads

NumPy's own ufunc operations are handy, but can be quite slow (see https://github.com/numpy/numpy/issues/5922 and https://github.com/numpy/numpy/issues/11156). Use fastfunc as a drop-in replacement

# import numpy
# numpy.add.at(target, idx, vals)

import fastfunc
fastfunc.add.at(target, idx, vals)

# If you really only need _add_, you can use
# numpy.bincount(idx, weights=vals, minlength=target.shape[0])

to get a speed-up by a factor of 40.

This is achieved by moving the operations to C++ using pybind11.

Installation

fastfunc is available from the Python Package Index, so simply do

pip install -U fastfunc

to install or upgrade.

Testing

To run the fastfunc unit tests, check out this repository and type

pytest

License

fastfunc is published under the MIT license.

You can’t perform that action at this time.