Fused multiply-add (with a single rounding) for Python
Fused multiply-add for Python. Fused multiply-add computes (x*y) + z with a single rounding. Useful for dotproducts, 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 […]
Read more