Fused multiply-add for Python
Project description
pyfma
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.
Use as
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.
Installation
pyfma can be installed from the Python Package Index, so with
pip install pyfma
you can install/upgrade.
Manual installation
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, do
pip install .
. This does the trick most the time. - As a fallback, there's a CMake-based installation. Simply go
cmake /path/to/sources/
andmake
.
Testing
To run the pyfma unit tests, check out this repository and type
tox
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyfma-0.1.6.tar.gz
.
File metadata
- Download URL: pyfma-0.1.6.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 869c2fd247ee027ebe28be0c41509923878bcfda9da7fbda1220f9e0f4bb1110 |
|
MD5 | 82e19a4d7f7ce26bcddc35b04b24eb5f |
|
BLAKE2b-256 | 8f8ec2383cf8618c225beb5e9b43545f5ae36cc041115c3e029ecb9eef4b16c1 |