Skip to main content

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

rslab-0.22.0.tar.gz (4.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rslab-0.22.0-cp39-abi3-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

rslab-0.22.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

rslab-0.22.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rslab-0.22.0-cp39-abi3-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rslab-0.22.0-cp39-abi3-macosx_10_12_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file rslab-0.22.0.tar.gz.

File metadata

  • Download URL: rslab-0.22.0.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for rslab-0.22.0.tar.gz
Algorithm Hash digest
SHA256 123bf385affe2a4ce49d91a9ecfc0a40776e28b0935135cf2a7b606c2fdeed9b
MD5 705f7d662bd2323f42dff70c85dc2210
BLAKE2b-256 248941e3eb454ef690744df405808aaa02ab6d1e50ed5845530143ee3ae65e71

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0.tar.gz:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rslab-0.22.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rslab-0.22.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/6.1.0 CPython/3.13.14

File hashes

Hashes for rslab-0.22.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f7ad7b2ad3ec6db71131b22d7a95f7ac191103a0a97f1965d58bc9fe2da5fa6d
MD5 b9ba9343f1addf6ba7b675c34fe42efb
BLAKE2b-256 4abca1284935618d1bc6b8d1bf9b4e434ed7b245efc1300c00a6838c668cf090

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rslab-0.22.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rslab-0.22.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ca3131d9735e2aa3052987af714887255432752cb1cad265cae148dfcfda0f1
MD5 ca3ae20b3b5901bb36a15bc477e5f6a6
BLAKE2b-256 53723406b6f5ad44ca2219a571aeb04948ef39319cee3a36f58b014181fe8924

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rslab-0.22.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rslab-0.22.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4de8c65f5e817c16af0148d64a3306f17a3e8e7190e720188bd76da435856363
MD5 65987787cc16b8cf895439c91387846a
BLAKE2b-256 902e326ffc6f944f92731af8aa04d410edb49c190e54e7e6e86d49c28ebdee6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rslab-0.22.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rslab-0.22.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db50ad6b6491a6e6de9a23c7c901018c9b62748a13615c775547e265915a9e69
MD5 371b7a7bb7bad1f3359a4e7f5f83034b
BLAKE2b-256 45807630add8a639576181c84be61f7f6ad4df09d86f46b5851a3003d1dbcd60

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rslab-0.22.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rslab-0.22.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f37551dc8ecf9f0b485936ee6643ba2d44d97538c01e80080976acb72bfe2007
MD5 38b57475b1c39938e4bd09cc7239cdc4
BLAKE2b-256 6be3eda7a0dbb96361d31620334db7909407918368043d8f68d678aaf6b0c21e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.22.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: publish.yml on milanofthe/rslab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page