Some useful extensions for NumPy
Project description
npx
NumPy and SciPy are large libraries used everywhere in scientific computing. That's why breaking backwards-compatibility comes as a significant cost and is almost always avoided, even if the API of some methods is arguably lacking. 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
aand the first axis ofb.(Not the second-last axis of
basnumpy.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
asummed up at indicesidxwith a minumum length ofminlength.idxcan have any shape as long as it's matchinga. The output shape is(minlength,...).The numpy equivalent
numpy.add.atis much slower:(See also this numpy bug.)
-
npx.unique_rows(a, return_inverse=False, return_counts=False)
Returns the unique rows of the integer array
a. The numpy alternativenp.unique(a, axis=0)is slow. -
sol, info = npx.cg(A, b, tol=1.0e-10) sol, info = npx.minres(A, b, tol=1.0e-10) sol, info = npx.gmres(A, b, tol=1.0e-10)
solis the solution of the linear systemA @ x = b(orNoneif no convergence), andinfocontains some useful data, e.g.,info.resnorms. The methods are wrappers around SciPy's iterative solvers.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file npx-0.0.3.tar.gz.
File metadata
- Download URL: npx-0.0.3.tar.gz
- Upload date:
- Size: 6.8 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 |
5b86af7d1ca8d7a0c818e104b4e357aa8af9a7c335e3b865acf50150eb38580c
|
|
| MD5 |
e8913bc08b6577c6e1dc8956ed48d75f
|
|
| BLAKE2b-256 |
d3173c15ef5aa1aada469242dae1d17337fbae222fe99673f9fcf8debbfe2855
|
File details
Details for the file npx-0.0.3-py3-none-any.whl.
File metadata
- Download URL: npx-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
efe065fdb67cb7cd738930ded7c5c2b6cbcda6b604216c71a9057d13b062acb6
|
|
| MD5 |
4d601f42674840ea43ebca24a81e3a14
|
|
| BLAKE2b-256 |
fbab3432b73e80db6771315ab65aa6e39aa246339af3c2b3c533d158b2106305
|