This project has been archived by its maintainers, and is no longer receiving any updates.
sparse_grid
A Python Sparse Grid Package
sparse_grid is a pure-Python implementation of regular
sparse grids
over box domains. It provides hierarchical index generation, nodal-to-hierarchical
coefficient conversion, and fast function evaluation using the hat basis:
$$f_n(\mathbf{x}) = \sum_{\lvert\mathbf{l}\rvert_1 \le n+d-1} \sum_{\mathbf{p}} \alpha_{\mathbf{l},\mathbf{p}}, \prod_{i=1}^{d} \phi_{l_i, p_i}(x_i)$$
Quick example
from sparse_grid import SparseGrid
sg = SparseGrid(dim=2, level=3)
sg.generate_points()
for index in sg.indices:
pos = sg.g_p[tuple(index)].pos
sg.g_p[tuple(index)].fv = (
4.0 * pos[0] * (1.0 - pos[0]) * 4.0 * pos[1] * (1.0 - pos[1])
)
sg.nodal_2_hier()
print(sg.eval_funct([0.25, 0.75]))
Installation
pip install sparse_grid
Requires Python 3.10+. No external runtime dependencies. See the full installation guide for uv, poetry, and source builds.
Documentation
- Theory — mathematical background, hierarchical basis, algorithms
- Quickstart — runnable examples
- API Reference — class and function signatures
- References — literature citations
License
BSD-3-Clause — see LICENSE.
Metadata
Release files for sparse-grid 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sparse_grid-0.1.6.tar.gz | 59.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sparse_grid-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.2 kB
Release files / sparse_grid-0.1.6.tar.gz
| Download URL | sparse_grid-0.1.6.tar.gz |
|---|---|
| Size | 59.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ed2077946179f785597680adafee1d36a66a50188a96a8c3c6e8f335be862b3
|
|
BLAKE2b-256 checksum How to use checksums |
9a0df79e6aad94df339ab23bd7d128ab79096c76b7c60c9f40f9a94c4850732e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.
Transparency logRelease files / sparse_grid-0.1.6-py3-none-any.whl
| Download URL | sparse_grid-0.1.6-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c84957e0ae418b9fed47a7babcbe46baead19d97f563985648cf5cf326a94ffc
|
|
BLAKE2b-256 checksum How to use checksums |
69c1da1d76bc0aa523c744bc907d1c53525666a58c1dc0f87a23623c1d045fd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.
Transparency log