Backend-agnostic vector spaces and linear operators.
Project description
SpaceCore
SpaceCore is a lightweight backend-agnostic library for working with vector spaces and linear operators.
It provides a small set of abstractions for:
- backend-aware numerical operations
- contexts carrying backend and dtype information
- structured vector spaces
- structured linear operators
- conversion between compatible contexts
Installation
Base install:
pip install spacecore
With JAX support:
pip install "spacecore[jax]"
spacecore[jax]: installs optional JAX support.- GPU users should install the appropriate CUDA-enabled JAX build first, following the official JAX installation guide.
Main concepts
Context
A Context specifies how objects are represented, in particular:
- backend (
NumPy,JAX, etc.) - dtype
- validation/conversion behavior
Space
A Space describes the structure of objects space, for example:
VectorSpace- Euclidean spaceHermitianSpace- space of Hermitian (symmetric) matricesProductSpace- Cartesian product of spaces
LinOp
A LinOp represents a linear operator between spaces, for example:
DenseLinOp- linear operator represented by dense matrixSparseLinOp- linear operator represented by sparse matrixBlockDiagonalLinOp- linear operator from $X_1 \times \dots \times X_k$ to $Y_1 \times \dots \times Y_k$StackedLinOp- linear operator from $X$ to $Y_1 \times \dots \times Y_k$SumToSingleLinOp- linear operator from $X_1 \times \dots \times X_k$ to $Y$
Minimal example
import numpy as np
import spacecore as sc
sc.set_context('numpy', dtype='float64')
X = sc.VectorSpace((3,))
Y = sc.VectorSpace((2,))
A = np.array(
[[1.0, 2.0, 3.0],
[0.0, 1.0, 0.0]]
)
linop = sc.DenseLinOp(
A,
dom=X,
cod=Y,
)
x = X.ctx.asarray([1.0, 0.0, -1.0])
y = linop.apply(x)
print(y)
Status
SpaceCore is currently experimental and under active development. The public API may still evolve.
Tutorials
See the tutorials/ directory for usage examples and design guidance.
License
Apache License 2.0
Project details
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 spacecore-0.1.3.tar.gz.
File metadata
- Download URL: spacecore-0.1.3.tar.gz
- Upload date:
- Size: 37.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08ec98211ed400d403aa34c460b83ec5fd39f57865083da9a55dcf3df61419a3
|
|
| MD5 |
fb0ab9b92e6673dbccacf09659d7820a
|
|
| BLAKE2b-256 |
21777744c51080542a24ec1edf0ee84034866e4142c740353563dee441f8cf67
|
Provenance
The following attestation bundles were made for spacecore-0.1.3.tar.gz:
Publisher:
ci.yml on Pavlo3P/SpaceCore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spacecore-0.1.3.tar.gz -
Subject digest:
08ec98211ed400d403aa34c460b83ec5fd39f57865083da9a55dcf3df61419a3 - Sigstore transparency entry: 1245076528
- Sigstore integration time:
-
Permalink:
Pavlo3P/SpaceCore@e60f4b21a154aefd1bf827d0c1d27b7c73fe535c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Pavlo3P
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e60f4b21a154aefd1bf827d0c1d27b7c73fe535c -
Trigger Event:
push
-
Statement type:
File details
Details for the file spacecore-0.1.3-py3-none-any.whl.
File metadata
- Download URL: spacecore-0.1.3-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c50e7f5998beaa037b173342f609cf03e9254346321febf7617ed7266b63d8f6
|
|
| MD5 |
48b3c910b431c8a7183af1b50d04b093
|
|
| BLAKE2b-256 |
e05e883edc996e936c2447b45937de2e452bbb49e503803aea1f083d3578f038
|
Provenance
The following attestation bundles were made for spacecore-0.1.3-py3-none-any.whl:
Publisher:
ci.yml on Pavlo3P/SpaceCore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spacecore-0.1.3-py3-none-any.whl -
Subject digest:
c50e7f5998beaa037b173342f609cf03e9254346321febf7617ed7266b63d8f6 - Sigstore transparency entry: 1245076531
- Sigstore integration time:
-
Permalink:
Pavlo3P/SpaceCore@e60f4b21a154aefd1bf827d0c1d27b7c73fe535c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Pavlo3P
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e60f4b21a154aefd1bf827d0c1d27b7c73fe535c -
Trigger Event:
push
-
Statement type: