Giter VIP home page Giter VIP logo

pyfma's Introduction

pyfma

Fused multiply-add for Python.

PyPi Version PyPI pyversions GitHub stars PyPi downloads

Discord

gh-actions codecov Code style: black

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/ and make.

Testing

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

tox

License

pyfma is published under the MIT license.

pyfma's People

Contributors

nschloe avatar vutshi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.