Fused multiply-add for Python
Fused multiply-add for Python.
Fused multiply-add computes
(x*y) + z with a single rounding. Useful for dot
products, matrix multiplications, polynomial evaluations (e.g., with Horner's rule),
Newton's method for evaluating functions, convolutions, artificial neural networks etc.
import pyfma out = pyfma.fma(3.0, 2.0, 1.0) # 3.0*2.0 + 1.0 = 7.0
Also works with NumPy inputs:
import numpy import pyfma x = numpy.random.rand(3, 4, 5) y = numpy.random.rand(3, 4, 5) z = numpy.random.rand(3, 4, 5) out = pyfma.fma(x, y, z)
Built with pybind11.
Caution The C/C++ implementation of FMA in MS Windows is reportedly broken. Use with care.
pyfma can be installed from the Python Package Index, so with
pip3 install pyfma --user
you can install/upgrade.
For manual installation (if you're a developer or just really keen on getting the bleeding edge version of pyfma), there are two possibilities:
- Get the sources, type
python3 setup.py install. This does the trick most the time.
- As a fallback, there's a CMake-based installation. Simply go
To run the pyfma unit tests, check out this repository and type
pyfma is published under the MIT license.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyfma-0.1.1.tar.gz (3.4 kB)||File type Source||Python version None||Upload date||Hashes View|