Some useful extensions for NumPy
Project description
npx
NumPy is a large library used everywhere in scientific computing. That's why breaking backwards-compatibility is comes as a significant cost and is almost always avoided, even if the API of some methods is arguably confusing. This package provides drop-in wrappers "fixing" those.
If you have a fix for a NumPy method that can't go upstream for some reason, feel free to PR here.
-
npx.dot(a, b)
Forms the dot product between the last axis of
a
and the first axis ofb
.(Not the second-last axis of
b
asnumpy.dot(a, b)
.) -
npx.solve(A, b)
Solves a linear equation system with a matrix of shape
(n, n)
and an array of shape(n, ...)
. The output has the same shape as the second argument. -
npx.sum_at(a, idx, minlength: int = 0) npx.add_at(out, idx, a)
Returns an array with entries of
a
summed up at indicesidx
with a minumum length ofminlength
.idx
can have any shape as long as it's matchinga
. The output shape is(minlength,...)
.The numpy equivalent
numpy.add.at
is much slower:(See also this numpy bug.)
License
npx is published 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
File details
Details for the file npx-0.0.1.tar.gz
.
File metadata
- Download URL: npx-0.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2808da74812cd62342b87087e4fa35270ab383941aee3c7fda57e90f119a59f6 |
|
MD5 | c3fb8168be5eadc8b316a1ffaea73eb5 |
|
BLAKE2b-256 | 4672c6f9218d6dffd29361f04b9f69b693e56198e60bd0bc33f9676635a42d57 |
File details
Details for the file npx-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: npx-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 682671453e8e371809a6fbd7cad555d3930a7127ae1085923a3ef652dcaeff78 |
|
MD5 | ae779ac11d6834107d996de39c56a619 |
|
BLAKE2b-256 | d7865e0aef1b65127f37cff8b14c362e87e45eec0319b92ab46dc4d660ac4daa |