A fast python library for finding both min and max value in a NumPy array
Project description
numpy-minmax: a fast function for finding the minimum and maximum value in a NumPy array
NumPy lacked an optimized minmax function, so we wrote our own. At Nomono, we use it for audio processing, but it can also be applied to other kinds of data of similar shape.
- Written in C and takes advantage of AVX2 for speed
- Roughly 2.3x speedup compared to the numpy amin+amax equivalent (tested with numpy 1.24-1.26)
- The fast implementation is tailored for C-contiguous 1-dimensional and 2-dimensional float32 arrays. Other types of arrays get processed with numpy.amin and numpy.amax, so no perf gain there.
Installation
$ pip install numpy-minmax
Usage
import numpy_minmax
import numpy as np
arr = np.arange(1337, dtype=np.float32)
min_val, max_val = numpy_minmax.minmax(arr) # 0.0, 1336.0
Development
- Install dev/build/test dependencies as denoted in setup.py
CC=clang pip install -e .
pytest
Running benchmarks
- Install diplib
pip install diplib
python scripts/perf_benchmark.py
Acknowledgements
This library is maintained/backed by Nomono, a Norwegian audio AI startup.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for numpy_minmax-0.1.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6fc693101ca68042a24be94e3e21afdbec1a3fa539c426af66f6e0c57291d8b |
|
MD5 | b6d90b05d85dcf8f91191c37fafe874d |
|
BLAKE2b-256 | b324b625f00fdd9e3e614a6819056fc5758be7aa7c1de002e1f318b5cd28f632 |
Close
Hashes for numpy_minmax-0.1.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 872cdcb176179d64a190d090123d5711a89e129b8faa6f91698c8b9e2a0c082f |
|
MD5 | dfa82d2164ed3dceeed5abfbf0e0bcf4 |
|
BLAKE2b-256 | 73a89bf2ab91f7e6717fb24c4ed4707500f0577b51ed85a087d9b2a6db4380b7 |
Close
Hashes for numpy_minmax-0.1.1-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935f916fbf6209cd2d64d8cae45ae0c2f964ba2a45882cb7de5f16580cffd4c1 |
|
MD5 | 90eeed8049281d6a814979440408ae59 |
|
BLAKE2b-256 | 6b3ec72eb3d4c8c32aa7127d6b837f4eb6d3d8f28a3da7d967c24030fd708463 |
Close
Hashes for numpy_minmax-0.1.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e7a8bf1e72f7d62b25ac3a025279f2009c9db67d562e50c2d4ec1503063cee6 |
|
MD5 | f5c2872091caf96ca49004a2e1b2e656 |
|
BLAKE2b-256 | 52d3847590035e7c143ff7599adfccac0a6b7012fe442f510169dfcf543e702d |
Close
Hashes for numpy_minmax-0.1.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f65cfbb637c3f9a8539da907a4c6480c0a703818ce3762a454d8395cd987951c |
|
MD5 | 699b21412470b93e2535e12f3f2c93c8 |
|
BLAKE2b-256 | 2a304da3eea681528597380db86c042ed4532b4a37005f43fdd70cfc44fc5208 |
Close
Hashes for numpy_minmax-0.1.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4bd854523d119137dddb34d8349448a618b60864697afbd09e221bb76d8e0df |
|
MD5 | 001455923048026c024ed4611786c573 |
|
BLAKE2b-256 | f984be2980210745f96eaa778817de11b2afac0158bb4317c96db145f28cd404 |
Close
Hashes for numpy_minmax-0.1.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 228b60abfeb3f4dab1473dd0576c118d717a6ddfde22deb99bbc5f25da0400fd |
|
MD5 | dd3bcc253c6ec747552b9463636015d9 |
|
BLAKE2b-256 | 99a3a1a8e6140cfb8f0f7147f021e40ce0ca6b4fb54da8809e2e95d962f21c4a |
Close
Hashes for numpy_minmax-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a2f753e8e768045251d9734085a90f0e7c2dd0076a68c5bbb275ec807a307f |
|
MD5 | bd78cf3dd216fd9a45711d5d31b41e14 |
|
BLAKE2b-256 | ef5dce2a2d5b51aefd721b7ba631500f112874686b04de229861dcff46ae0dee |
Close
Hashes for numpy_minmax-0.1.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a244349bae49c6890a41c2ccec4b959de748da7da24afcce6a284e0ab2e8368 |
|
MD5 | 2948e2e3b10ffbb5bf474f1b66adcb27 |
|
BLAKE2b-256 | a150c2b46eb9b113948ba00453d66c74a986832b2ebdab00ee6fb272b9b5bddb |
Close
Hashes for numpy_minmax-0.1.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13e81257b7931f0589a3c6e12059b4ff94fb0edf8bc8f9793b8a6f20f047ff74 |
|
MD5 | f3cef4b8af63f2cddc81141be3cd5f36 |
|
BLAKE2b-256 | 84f64775888ce1e3cd29fedec8636155788b7ed41b3a8d3be6dada85f38a636a |
Close
Hashes for numpy_minmax-0.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc2f7ae72eeaddca17dfb558ccc44c47e4da25b597517676afd02ca7adf90bdc |
|
MD5 | 7e7a32dea788a87e69ece4eb2f908d1f |
|
BLAKE2b-256 | a5a739de6311873414d308889b792b143aa69145f5495b27742b3c93678b61ce |
Close
Hashes for numpy_minmax-0.1.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d866dac1280062a3d6f7eb74ec9f870ee127f7cf2e2f39d1813dedb178ab19c4 |
|
MD5 | ebcc2ec113dc301d58877fcbbef85cee |
|
BLAKE2b-256 | c553a8795bda6bd0cdaf2d6d750c003e704f7435b1a10eff02c4f676b272d97b |
Close
Hashes for numpy_minmax-0.1.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ebb2a8fc75aa719c8c65cb60173882219fb371dc848805820d41e543d1bd8fb |
|
MD5 | f8e0548788d854a5e6ccd17fc5f68cb6 |
|
BLAKE2b-256 | c0db821451bbc4ff24d02fe4842af11d4d37567da7ef3c9886cd99714cd382f8 |
Close
Hashes for numpy_minmax-0.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63eea6dc1768ab7d4dd31a27bbcaa570dea9fd0f2d7cc24bf29279629ac7d9f0 |
|
MD5 | 4e17bc6a9b19488d13f73a54350d3d40 |
|
BLAKE2b-256 | a5e6f6b5ac906d593d3e7161605f7f82d4058cc2a9bb65d4e431c8e7918a3031 |
Close
Hashes for numpy_minmax-0.1.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66b8098470e7018c7a77483fbec5d01f92a9d661f15528b569f735eb1757e8c2 |
|
MD5 | d82482d3863297ad4dc687157905aa37 |
|
BLAKE2b-256 | 12eea388915968326838908b89ca491b007335768781461e445ee0e6c80b4d2c |
Close
Hashes for numpy_minmax-0.1.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0097ba027ff5f27151457017a69a927ad8459d7604ea467627722d7a3823b63b |
|
MD5 | 037db2c88e3fbc71e4c4ab949638082b |
|
BLAKE2b-256 | 7fa9cd9bbbac52fa47312e636301f39a8ee387c1430d0f7e795b938fdc07f9ef |