A package that enables on-the-fly encoding and decoding of large NumPy arrays as Sparse binaries.
Project description
This package exists for one purpose: to encode and decode sparse numpy arrays into a more space-efficient format. Its target audience is users requiring rapid access to massive arrays without memory issues.
Ordinarily, a numpy array might be stored in one of a couple of ways:
- As a binary
- As a compressed file format (e.g., h5df)
The advantage of binary is that the file can be memory mapped, allowing access to sections of the array without out-of-memory (OOM) issues. The disadvantage is that such binaries are, necessarily, of a very large file size.
The advantage of compressed file formats is that they provide a much smaller disk space footprint, but at the cost of slower file access. Even h5df file formats, which can provide memory-mapped services of their own, will still be necessarily slow because the non-contiguous array has to be searched to find the relevant indices.
PySparse takes a given numpy array, and encodes it into two (smaller) arrays - a 1D array containing the non-zero values, and a 2D array containing the mapped coordinates for these values in the original 'dense' numpy array.
The resultant arrays can then be re-loaded into the SparseArray class, from which indexing can be performed to return to the original dense array.
SparseArray is NOT a child class of Numpy, and numpy functions cannot be performed directly on it (for now). To do this, you would need to manually implement a solution yourself e.g., decoding the entire array at once using [:], or using a for-loop to iterate through the SparseArray in chunks to avoid OOM errors.
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 pysparse-array-0.1.4.tar.gz.
File metadata
- Download URL: pysparse-array-0.1.4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
702ee929a6d906d244c85be98836198620f466259325750130a0ba8bfcca7f33
|
|
| MD5 |
d64abfb613ca958c9759843bbdf73624
|
|
| BLAKE2b-256 |
cb7de5b2cbba62953dde195f9bd045296ca5f56c6126636486b6eb72a97d3f85
|
File details
Details for the file pysparse_array-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pysparse_array-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a07ebefa3584928897ce23ef163e27979499b983a4063ca2ef70f3c85892d42
|
|
| MD5 |
4a0ffad5da170dd60dc24e30831fd54b
|
|
| BLAKE2b-256 |
edbe87a78f98f8e3c6883aae89fbbb70dac16573775f883e9f428d7c0a4fd028
|