Skip to main content

rslab (Python bindings)

NumPy/SciPy bindings for RSLAB, a pure-Rust sparse direct solver: symmetric and complex-symmetric LDL^T (Bunch-Kaufman), unsymmetric LU, and a KLU path for circuit-shaped matrices. All numeric work happens in Rust. Supported dtypes: float64, float32, complex128, complex64.

pip install rslab

Usage

import numpy as np
import scipy.sparse as sp
import rslab

x = rslab.spsolve(A, b)              # one-shot, picks LDL^T or LU by symmetry

f = rslab.ldlt(A)                    # symmetric or complex-symmetric
x = f.solve(b)
X = f.solve_many(B)                  # n x nrhs
print(f.factor_nnz, f.inertia, f.diagnostics()["summary"])

f = rslab.lu(A_general)              # unsymmetric
y = f.solve_transpose(b)             # A.T @ y = b, on every handle

Circuit-shaped matrices (MNA / SPICE class) take the KLU path, with a numeric-only refactor for fixed-pattern sweeps and its factors exported:

f = rslab.klu(A)
x = f.solve(b)
f.refactor(A_next.data)              # same pattern, new values, no pivot search
y = f.solve_transpose(b)             # A.T @ y = b (conjugate b and y for A^H)
L, U, F = f.L, f.U, f.F              # (R A)[perm_r][:, perm_c] = L @ U + F

Symbolic reuse

The analysis depends on the pattern only; pay it once per sweep:

sym = rslab.analyze(A)               # LdltSymbolic, LuSymbolic or KluSymbolic
print(sym.estimate_memory()["factor_mb"])
for omega in frequencies:
    f = sym.factor(K + 1j * omega * C)   # the matrix or its data array
    x = f.solve(b)

Preconditioners and Krylov solvers

Static pivoting never fails; refinement or a Krylov method recovers the accuracy. gmres, gmres_block, cocg and cocr take any factor handle as preconditioner:

f = rslab.ldlt(A, preconditioner=1e-4)
x = f.solve(b, refine=20)

M = rslab.lu(A, drop_tol=1e-3)       # incomplete factor
x, converged, iters, res, stop = rslab.gmres(A, b, M, tol=1e-10)

Settings

Factor knobs are keyword arguments of ldlt, lu, spsolve and analyze, or a rslab.Settings object (rslab.KluSettings for klu). Every tuning constant of the solver is one (nd_fm_passes, race_candidates, solve_block, ...), with the tuned value as default; rslab.Settings().to_dict() lists them all. Common overrides:

f = rslab.lu(A, ordering="metis", threads=8, pivot_threshold=0.5)
s = rslab.Settings(preconditioner=1e-6, drop_tol=1e-3)

Settings a path does not read are listed under diagnostics()["warnings"]. Every keyword, handle and method is documented in the generated reference docs/api.md (help(rslab.lu) shows the same text).

Logging

rslab.set_log_level("info")          # or the RLA_LOG environment variable
log = logging.getLogger("rslab")
rslab.set_log_sink(lambda level, msg: log.log(logging.getLevelName(level.upper()), msg))

License

MIT.

Release files for rslab 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rslab 1.0.0
File Size Uploaded
rslab-1.0.0.tar.gz 496.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rslab 1.0.0
File
rslab-1.0.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
rslab-1.0.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
rslab-1.0.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
rslab-1.0.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
rslab-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 13.3 MB

Release files / rslab-1.0.0.tar.gz

Download URL rslab-1.0.0.tar.gz
Size 496.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f1a94a3bda0d8763fbb1f11efba42be6331515532dfc3f1c3db03c71a84d4037
BLAKE2b-256 checksum
How to use checksums
393d7bc52539107764486c646361c34396c988942e8cc48542c69f12faf4c337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / rslab-1.0.0-cp39-abi3-win_amd64.whl

Download URL rslab-1.0.0-cp39-abi3-win_amd64.whl
Size 2.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
04f3ba9cbcca9d89866a4350b6602b226ff8d5677750faeb0cb74b451f572071
BLAKE2b-256 checksum
How to use checksums
d60fcd99e04e2eb8ed7e9f960fe37fd03200a305170ccaf54fb12186df3d209d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / rslab-1.0.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL rslab-1.0.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 2.8 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
acc8967ac1172086f8dbd8aadafde3ae26bec4375d939ff29527495d3782e457
BLAKE2b-256 checksum
How to use checksums
609194382d32abc4c1e4665ffb8dfe7a378a17e1149de731053ef0e71dff1b45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / rslab-1.0.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL rslab-1.0.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 2.4 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b7562f1f89b035a28769a5733befa46aeae77407fe43892b7dfa5d5d466ec2e2
BLAKE2b-256 checksum
How to use checksums
b3d5dccdccae4860828e0521f6f236ad6c5bb7d8ad45450e20a987cb507ea2b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / rslab-1.0.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL rslab-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Size 2.2 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b4f8f4cd51d886e0941eceee1cb5608ffc4324b47f3e6347cbfe5235098a59be
BLAKE2b-256 checksum
How to use checksums
356814c797a081fffbe8b8b04798d1edeae9756da7ae38f760975e95db76bfee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / rslab-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL rslab-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.6 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
cc51d3a04824ab78e751503a47c10921fc2c9e2771f43ac2d81c55a199ff9c93
BLAKE2b-256 checksum
How to use checksums
330d6591b643d62a53e86d47dda94730f29c58634aed679490319387539db1a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page