This package contains some convenient helper function for numpy. Nothing fancy, but quite useful. It works with python 2.7, 3.4, and 3.5.
Install
Simply install via pip:
pip install nphelper
nphelper only depends on numpy.
Usage / Features
Create block arrays (in matlabs’s [A A; B B] spirit):
>>> from nphelper import block
>>> A = np.array([[1, 2, 3]])
>>> B = np.array([[2, 3, 4]])
>>> C = np.ones((2, 6))
>>> block([[A, B], [C]])
array([[1, 2, 3, 2, 3, 4],
[[1, 1, 1, 1, 1, 1],
[[1, 1, 1, 1, 1, 1]])
Compute the cartesian product (similar to itertools.product):
>>> from nphelper import cartesian_product
>>> cartesian_product([[1, 2], [3, 4]])
array([[1, 3],
[1, 4],
[2, 3],
[2, 4]])
Easily multiply many arrays without the cubersome dot syntax. It’s also much faster than dot because it selects the fastest evaluation order. (This is part of numpy 1.10.0.)
>>> from nphelper import multi_dot
>>> A = np.random.random((10000, 100))
>>> B = np.random.random((100, 1000))
>>> C = np.random.random((1000, 5))
>>> D = np.random.random((5, 333))
>>> # Sick of this?
>>> np.dot(np.dot(np.dot(A, B), C), D) # doctest: +SKIP
>>> # Or this?
>>> A.dot(B).dot(C).dot(D) # doctest: +SKIP
>>> # Use multi_dot
>>> multi_dot([A, B, C, D]) # doctest: +SKIP
TODO along, maxalong, minalong, sumalong, meanalong, stdalong, varalong
Dev
Run the tests
Run tox to run the tests for python 2.7, 3.4, and 3.5:
tox
You might have to install addiotional dependencies to run the tests:
- ``py.test``, - ``nose``, - ``python2.7-dev``, - ``python3.4-dev``, and - ``python3.5-dev``.
Build the Docs
cd doc make html
You might have to install addiotional dependencies:
pip install sphinx sphinx_rtd_theme
Metadata
Release files for nphelper 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nphelper-0.0.5.tar.gz | 7.6 kB | Without provenance | Details for nphelper-0.0.5.tar.gz |
Release files / nphelper-0.0.5.tar.gz
| Download URL | nphelper-0.0.5.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a69b6882cbe0b101e34ffeb04e454edd710294f5eee4c84f2ee4c21640c3dc07
|
|
BLAKE2b-256 checksum How to use checksums |
d4e7cf2db92e4de44006734fb442a0dbc7cb4fc217325ec7bb96f06c43ba5480
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for nphelper 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.