rslab (Python bindings)
NumPy/SciPy bindings for RSLAB, a pure-Rust sparse direct solver and preconditioner: complex/real symmetric LDLᵀ (Bunch-Kaufman) plus unsymmetric LU. A thin wrapper, all numeric work happens in Rust.
Install
pip install rslab
Usage
import numpy as np
import scipy.sparse as sp
import rslab
# Symmetric system (real or complex; the dtype selects the path).
A = sp.random(5000, 5000, density=1e-3, format="csc") + sp.eye(5000) * 10
A = A + A.T
b = np.random.rand(5000)
# One-shot solve.
x = rslab.spsolve(A, b)
# Factor once, solve many right-hand sides.
f = rslab.ldlt(A)
x1 = f.solve(b)
X = f.solve_many(np.random.rand(5000, 8)) # n x nrhs
print(f.n, f.factor_nnz, f.inertia, f.dtype)
Complex-symmetric matrices (EM/FEM, PARDISO mtype 6) work identically:
A = A.astype(np.complex128); A.data += 1j * 0.3 * A.data.real
x = rslab.ldlt(A).solve(np.ones(A.shape[0], dtype=np.complex128))
Unsymmetric matrices use the LU path:
f = rslab.lu(A_general)
x = f.solve(b)
Circuit-shaped matrices (MNA / SPICE-class: very sparse, unsymmetric,
near-triangularizable) use the KLU path, bit-deterministic, with a
numeric-only refactor for fixed-pattern sweeps:
f = rslab.klu(A_circuit)
x = f.solve(b)
A_circuit.data *= 1.5 # frequency sweep: same pattern, new values
f.refactor(A_circuit.data) # no symbolic work, no pivot search
x2 = f.solve(b)
y = f.solve_transpose(b) # A.T @ y = b on the same factors (adjoint)
solve_transpose is the plain transpose; for the conjugate-transpose adjoint
use f.solve_transpose(b.conj()).conj().
Preconditioner mode
Never-fail static pivoting plus iterative refinement for hard/indefinite systems:
f = rslab.ldlt(A, preconditioner=1e-4)
x = f.solve(b, refine=20) # refine against the original A
Configuration (keyword arguments)
By default ldlt, lu and spsolve use RSLAB's deterministic heuristic
pick, the adaptive ordering plus an exact nested-dissection bakeoff on large
systems (adopted only on a clear predicted win with no fill/memory
regression). A one-time rslab.install_diagnose() measures this machine's
throughput and speedup curve and caches it; afterwards the default also picks
its worker count from the calibration (until then the conservative capped
default applies). Keyword arguments override the pick:
| kwarg | default | meaning |
|---|---|---|
threads |
None (auto) |
None = calibrated/structural per-matrix pick; int = fixed (0 = all) |
preconditioner |
None |
static-pivot floor (e.g. 1e-4); never-fail, refine to solve |
drop_tol |
None |
incomplete-factor threshold (preconditioner) |
method |
"left_looking" |
"left_looking" or "multifrontal" |
memory |
"low" |
"low" or "eager" factor emit strategy |
force_accept |
False |
accept tiny pivots in exact mode instead of failing |
klu accepts:
| kwarg | default | meaning |
|---|---|---|
pivot_tol |
1e-3 |
diagonal-preference threshold; 1.0 = plain partial pivoting |
row_scaling |
True |
divide each row by its max-magnitude entry before factoring |
btf |
True |
permute to block upper triangular form first (keep it on) |
Supported dtypes: float64, float32, complex128, complex64.
License
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 rslab-0.23.0.tar.gz.
File metadata
- Download URL: rslab-0.23.0.tar.gz
- Upload date:
- Size: 4.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51382390f34b667bcf7bdf3a26d74dd4cae0afcdde98c3abcdf2368df9ba91b9
|
|
| MD5 |
9b202791cf0729f27128ced27d2c5e1f
|
|
| BLAKE2b-256 |
006c7a9de16b98feaccbd5140828831c3c38b42558119c1c2c11f8293a9a9d45
|
Provenance
The following attestation bundles were made for rslab-0.23.0.tar.gz:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0.tar.gz -
Subject digest:
51382390f34b667bcf7bdf3a26d74dd4cae0afcdde98c3abcdf2368df9ba91b9 - Sigstore transparency entry: 2300492202
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rslab-0.23.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: rslab-0.23.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aae4eff6689283b302810bf22be038ff975a1daf957a06397a0241ab84d11e40
|
|
| MD5 |
6f34ea13360c155c4a47465085c40b36
|
|
| BLAKE2b-256 |
1357130eeea6ab55e99e1cb6cc5ba0abdd6282bd01c5cef460d55a09c3a66f72
|
Provenance
The following attestation bundles were made for rslab-0.23.0-cp39-abi3-win_amd64.whl:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0-cp39-abi3-win_amd64.whl -
Subject digest:
aae4eff6689283b302810bf22be038ff975a1daf957a06397a0241ab84d11e40 - Sigstore transparency entry: 2300492460
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rslab-0.23.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rslab-0.23.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49cc590916aae97fb2d3771adb742bb41386c3b5eaee4e447cc843cc9eb6f2c0
|
|
| MD5 |
8691c3368a20143181813d2502fb42a4
|
|
| BLAKE2b-256 |
68d1c3ca0ace281e2d6caf593853824e192d671a49ce6153e236c496f89c99bd
|
Provenance
The following attestation bundles were made for rslab-0.23.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
49cc590916aae97fb2d3771adb742bb41386c3b5eaee4e447cc843cc9eb6f2c0 - Sigstore transparency entry: 2300492262
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rslab-0.23.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rslab-0.23.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba2a43a6179e032cfea0ba2782fcf2ffee62476ba04c5eba9fe0916f11b51a7a
|
|
| MD5 |
9509f670c72b58504a572776e7da1843
|
|
| BLAKE2b-256 |
331a0151917337df96fb14a228e04bc53ce0eed1f3104ed65063ed92d4697247
|
Provenance
The following attestation bundles were made for rslab-0.23.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
ba2a43a6179e032cfea0ba2782fcf2ffee62476ba04c5eba9fe0916f11b51a7a - Sigstore transparency entry: 2300492542
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rslab-0.23.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rslab-0.23.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81a2013155e451cd484bffda0d781dff24d658fd96b839110cded5428f0e229a
|
|
| MD5 |
fa1a3aa0793f99d6300a6aa706a3bdda
|
|
| BLAKE2b-256 |
4f56e2c88755a9c277f4f13c7dfe1e9a98ac7578b2af9e3bbc6736493025fcd9
|
Provenance
The following attestation bundles were made for rslab-0.23.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
81a2013155e451cd484bffda0d781dff24d658fd96b839110cded5428f0e229a - Sigstore transparency entry: 2300492331
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rslab-0.23.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rslab-0.23.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cb801b656abffceb5875c7ce2de01c58f8ded39f4216708ba9c2555464eb0c6
|
|
| MD5 |
9de97aac029e02acb56ca89664de1130
|
|
| BLAKE2b-256 |
d5e5883a7f37eea750b19e03217a4abc08f16db7e992ab0779166ca6633f1dc5
|
Provenance
The following attestation bundles were made for rslab-0.23.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on milanofthe/rslab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rslab-0.23.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
4cb801b656abffceb5875c7ce2de01c58f8ded39f4216708ba9c2555464eb0c6 - Sigstore transparency entry: 2300492399
- Sigstore integration time:
-
Permalink:
milanofthe/rslab@02781793feb97e664a82c20956953bc4add2d7e6 -
Branch / Tag:
refs/tags/v0.23.0 - Owner: https://github.com/milanofthe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02781793feb97e664a82c20956953bc4add2d7e6 -
Trigger Event:
push
-
Statement type: