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.26.1.tar.gz (4.6 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.26.1-cp39-abi3-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.9+Windows x86-64

rslab-0.26.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

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

rslab-0.26.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rslab-0.26.1-cp39-abi3-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rslab-0.26.1-cp39-abi3-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rslab-0.26.1.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

Hashes for rslab-0.26.1.tar.gz
Algorithm Hash digest
SHA256 95406a3621c6da4631818baca6a06c297712e2748f5f3486eace1f8fb3a76ae1
MD5 d225e7d70591e9040cda3f5a7d6868c8
BLAKE2b-256 f82cc4f5c4ba749d2ce7f7addc8f8bc201dc124591f9c08e86a2f4db7b90c95f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1.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.26.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rslab-0.26.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.2 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

Hashes for rslab-0.26.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 59591773d5a4d297dcec1ea4b8a34a18418363b9ea8cfd96005a628ca21573df
MD5 40f3efcb1495070b8f4cae05f055ab4f
BLAKE2b-256 0c8725746a999bdf31b836699a2082dcdbac7eef26226024d23801ab4b500c90

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1-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.26.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rslab-0.26.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 850b72549d2f2ae4c89d118b65cb6400f71284cf82772b4465f184cd187e4f74
MD5 6778f82fbd4565c8359f93897d0cc0ed
BLAKE2b-256 253f28ad1f233679480709cae146fa6357c8969d2a8b86d2e9dc2f39ebc1a9f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1-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.26.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rslab-0.26.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05514763500a1ba40dbbe626b4a6e5cc2c3395d347c9b6134b75db00c4d28139
MD5 3f18f5c571880a08cf26bec6d1bcd11d
BLAKE2b-256 e62f764b120c9ce798ec45ae41ccc321f9128a84cf88cc62d96b1665acc0aa99

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1-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.26.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rslab-0.26.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bc3d5910d7a06cbe325d8a4f478733ecdbf884ddc2911b12d3ab0338fcb95fc
MD5 1f88a83a34425a070b0c0d8ae40ff8b0
BLAKE2b-256 07e3455e11acbd944fc56ee858d77586fe96c13453c95e5100a084d658de91e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1-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.26.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rslab-0.26.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5f959739a95cae3cc2fe99d72be8b02dfbcc3c9d2e0ce3e123be2e57e0e69166
MD5 05162033800b2740518abecb0098d07e
BLAKE2b-256 8269a871bbb58aa566cddbe0a1971762bc32018cc733160fcf2ee28db4d46b8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rslab-0.26.1-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