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 be applied any kind of float32 ndarray.
- Written in C and takes advantage of AVX for speed
- Roughly 2.3x speedup compared to the numpy amin+amax equivalent (tested on Intel CPU with numpy 1.24-1.26)
- The fast implementation is tailored for float32 arrays that are C-contiguous, F-contiguous or 1D strided. Strided arrays with ndim >= 2 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
Changelog
See CHANGELOG.md
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.2.0-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bddafe29318aad24575a9cfc4a28d91ca297f81b6d9583e3c7657dfe488d9a7b |
|
MD5 | 0e01dd357c32dca4cdd61de16034d589 |
|
BLAKE2b-256 | 51d83626cb5338a0326c4f9847a038a583abcf133176bd31b726b154582ef3f4 |
Close
Hashes for numpy_minmax-0.2.0-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a355114d78faa8ae926a5e90c5034011d4c2d3fb51b48ce21d24761f156c225f |
|
MD5 | 9a0a95c4548da1b2dc2502276ced7335 |
|
BLAKE2b-256 | c01f2be3dd2b1d6504fe33069a0c4e135a69cc3efb73eba770169dcdb56a7d1e |
Close
Hashes for numpy_minmax-0.2.0-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49b40776f5c4541bc40f0c890a4a31f2626d67a26a58dc65d7b69a4bc97fc523 |
|
MD5 | ff27774603a0793a80724ca75ab0bacf |
|
BLAKE2b-256 | 24ddbd7330c6d2fddc7e988965de1db2ab0a0ba1b644e7d93966b6003f797cb1 |
Close
Hashes for numpy_minmax-0.2.0-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6f91b4507df52d3c40a530636ced2a49adbcbba5a172524e3da89cfad5a163c |
|
MD5 | 25084eaf084d4460d37d79f13a11c56e |
|
BLAKE2b-256 | 34777941f71c12edb5cf9f2cba6dff51ec79ca48ca4fdf97ce3dbfbeadad1a8b |
Close
Hashes for numpy_minmax-0.2.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c9229fda2db145f271f42b10a7a1c68c6298507cbfa2042d700d8b961116c9f |
|
MD5 | 21a0aa83e0dfbc57acee6c1eea8ed832 |
|
BLAKE2b-256 | cf57425090a2f8fe1a80bc3a4b3aa5199efbe1d432ca369f51cf1aab973f7478 |
Close
Hashes for numpy_minmax-0.2.0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aac29b0fa56e4133653473e9ae7186d236c328df3028f41ef0e006fdac3c29a |
|
MD5 | f1545f46cad16d2d5c950488b06876e3 |
|
BLAKE2b-256 | e25ea6ed491bc5b3d47e709d0923e6bfe3c4cfd111ff0f82c5063715c7fb54da |
Close
Hashes for numpy_minmax-0.2.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80edaa3f624f25d9b18e8711ef4560a2387d6e6bccf84e11540f63f0281c131e |
|
MD5 | a1e01e9916c76bc58800231372c6abdf |
|
BLAKE2b-256 | 231b900992fcb60874fe5095d1a058f65527ae0ff0c3139e279ebc3de5527731 |
Close
Hashes for numpy_minmax-0.2.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22c5778a6bcddf756f30015c566b2857f8dee4fb12df922d0d28143d4f27a37 |
|
MD5 | 41d16b2a56307d27e580f2ac0df3a2c2 |
|
BLAKE2b-256 | 97205b054832492ddb7d8ed883fbc5041ebbe6de6843574c0f5041782d950963 |
Close
Hashes for numpy_minmax-0.2.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89ba6bdccae6c5782a650bd630e986aa4be7bc7ac3d8900171414dfccb616a76 |
|
MD5 | d9c14130445be2dc165f43959886cd31 |
|
BLAKE2b-256 | e04c2224c040beef10b00d7f2bc9ea3a52761067d5caf4ec3a97d8c850262e72 |
Close
Hashes for numpy_minmax-0.2.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 388474d9b485d17232f702dd3ed4e30d3659a0dc530a36cd252ddc87fa8692c8 |
|
MD5 | aba28b9616f00300f7b5546d68b38998 |
|
BLAKE2b-256 | b210d6af0b926af8da2dcb0b94d30ba83a3a68685a318389356c0f17389aea8d |
Close
Hashes for numpy_minmax-0.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c027d39bb8f29c0377a766fb7b29c64753303bd473242de20f28875480c8f07a |
|
MD5 | 26ec85eff0dcc9c4ab770c2d02ed594b |
|
BLAKE2b-256 | b5a169f15be3c618a8ee859a38c4656713c66ccbb71ba7eb9fc35618c42d2855 |
Close
Hashes for numpy_minmax-0.2.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d6dcc4506d7e00ca79cb630add413f55cc1c55f0cf493c74d2b7cb5d7c6aa77 |
|
MD5 | 2d84b943f229752f764a829f3be1c0c3 |
|
BLAKE2b-256 | 9136386d0ff434e952507bb6de160c1196bc5e09264020f68271b1c673aa5166 |
Close
Hashes for numpy_minmax-0.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03916789d84db81b897da8e986832ce8f93444eded7137fc26e6363a109e6598 |
|
MD5 | 6d53c6b35a5f2775021eee2a65e6c9ff |
|
BLAKE2b-256 | b1511fc2345806dbde82fa313a084bba4a1fdcf23d28db6b1c35ea94c80ba1a8 |
Close
Hashes for numpy_minmax-0.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97768d4657cfeb85cc080450a90972d68a6e9cccbb58cfeb88a66fd133d5c764 |
|
MD5 | a6970e631633143986a2c70d46a6cadc |
|
BLAKE2b-256 | 96455bb0be66339f8a14c39daf07af30c02f48388472b6f4db338d287c72f37e |
Close
Hashes for numpy_minmax-0.2.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76b38ddb18e5444ad4a5578d000dfb197f7a486f157bb5a93c470a5fdb4ce45 |
|
MD5 | 2d50a4df9287638f4cf3f3bb7a015835 |
|
BLAKE2b-256 | 50c520a60dc5fc2729d5f8f10b5385f22723d1c39134db2c71c8fcae80216ae8 |
Close
Hashes for numpy_minmax-0.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d054fe4ceeda5204c2b83adc40ce9681018a1044ff40ba683b16ec2b0db752c1 |
|
MD5 | 9b8042f85b836fa213e7526521a120f3 |
|
BLAKE2b-256 | d88b89e971c76611c0895d36df77e336d27609827cd1e3d39379d98c8d2d0045 |
Close
Hashes for numpy_minmax-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647fc7a2142e4a9c0d09d68f745dfd0bcf88ac49cf8b8ecbe23267476ef7ea34 |
|
MD5 | a683229c20f414bac62270c9dc401fee |
|
BLAKE2b-256 | ed270e2b8fa9e09cb1c24f7dd09957a6c927811063e3080091be52a7eb43fadf |
Close
Hashes for numpy_minmax-0.2.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a250f70791ebbe7aab40c55207004d775d975e22f81ef6eb1e6fca59e7c97c9 |
|
MD5 | d3673c53e1f24efc2a8cfb3ba20116fc |
|
BLAKE2b-256 | 8ad70db58e7ff6278895fa659b0d25e01e2573b9681235e4169838e294ec0c53 |
Close
Hashes for numpy_minmax-0.2.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51d0b075380bc47de3c4b9fb960950110e9a84d736905b1d392e17594fbda922 |
|
MD5 | 4510a8fb7e9e5a724b064e6294695c9f |
|
BLAKE2b-256 | b59afe03dd84d8f7b17d9ca4a378364d55c3b82b976a8731fed9c623e18b9126 |