Fast numerical expression evaluator for NumPy
Project description
What is NumExpr?
Please refer to the original Numexpr repo.
Installation
From wheels
NumExpr is available for install via pip for a wide range of platforms and Python versions (which may be browsed at: https://pypi.org/project/numexpr/#files). Installation can be performed as:
pip install numexpr_mod
From Source
On most *nix systems your compilers will already be present. However if you are using a virtual environment with a substantially newer version of Python than your system Python you may be prompted to install a new version of gcc or clang.
For Windows, you will need to install the Microsoft Visual C++ Build Tools (which are free) first. The version depends on which version of Python you have installed:
https://wiki.python.org/moin/WindowsCompilers
For Python 3.6+ simply installing the latest version of MSVC build tools should be sufficient. Note that wheels found via pip do not include MKL support. Wheels available via conda will have MKL, if the MKL backend is used for NumPy.
See requirements.txt for the required version of NumPy.
NumExpr is built in the standard Python way:
python setup.py build install
You can test numexpr with:
python -c "import numexpr_mod; numexpr_mod.test()"
Do not test NumExpr in the source directory or you will generate import errors.
Usage
>>> import numexpr_mod as ne >>> import numpy as np >>> a = np.array([1,2,3,4,5]) >>> b = np.array([6,7,8,9,0]) >>> ne.cache_expression('a + b', 'sum_ab') {'ex': <numexpr_mod.NumExpr object at 0x1090e36b0>, 'argnames': ['a', 'b'], 'kwargs': {'out': None, 'order': 'K', 'casting': 'safe', 'ex_uses_vml': False}} >>> ne.re_evaluate('sum_ab') array([ 7, 9, 11, 13, 5], dtype=int64) >>> ne.evaluate('a + b') array([ 7, 9, 11, 13, 5], dtype=int64)
Documentation
Please see the official documentation at numexpr.readthedocs.io. Included is a user guide, benchmark results, and the reference API.
License
NumExpr is distributed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for numexpr_mod-2.8.5-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 692258c9c2a03ae055837c5ea1a48e247809fc40a425d162aedd91395d5df1d9 |
|
MD5 | 37bf9f546e57d3f649bf98c994a0d71c |
|
BLAKE2b-256 | 6dd14f9d81bffc163f2c31559d9190e623298f61a7e88ba808d4c8293287c02d |