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)

ldlt, lu and spsolve accept:

kwarg default meaning
threads None (auto) None = per-matrix auto predictor, capped at 4 workers; 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.18.0.tar.gz (4.0 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.18.0-cp39-abi3-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

rslab-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

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

rslab-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rslab-0.18.0-cp39-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rslab-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for rslab-0.18.0.tar.gz
Algorithm Hash digest
SHA256 c26a288b413e96f1a0ee57545519b670cd7f712f5e6786414fd29ac712d6e73c
MD5 2c28e24c0842a1466d31b25381e74fb0
BLAKE2b-256 b2087c96212d64871008a99fd47e45fd5e0085fab2a9b6b70931619de6b880f3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rslab-0.18.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rslab-0.18.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e87225e2240c8d87e0edaa8ad072f30166f6c348d6c96fc64c614dfbe37a4b96
MD5 7f5d5f629ccabf41bf445a17f393602d
BLAKE2b-256 4fce23a90c72ec51d6ecb0d5f60f8c9d345fdfade8dc54edd0c51df1fd54d3a4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rslab-0.18.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 177b56a35357cb9af78aaa8d4095b08d864beb10f5a30d01dc7e59f45dc74fa3
MD5 cdace7eceb5e5117f279729a8030ebb6
BLAKE2b-256 ffda7849708329508920aef0f8c18f8cbc235067b237760bccd019041fb07241

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rslab-0.18.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 61a53dcf0dd5bd819bf68abca266308d3401735fc328a4a25bb789dfd101ff40
MD5 b01b95384bce88886e26e03ffefa3f08
BLAKE2b-256 70cb0cb459f720596549939546fb42b5196e017f93c10c54cdca6887179cc543

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rslab-0.18.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba25b7c9754ade9d79e18460296e34c784cf58d605f7f46524aa6a1713a34222
MD5 296b3d9a1bcf2c2b2ace63c188470f9c
BLAKE2b-256 6c962381f56cc7d2b277598af63a7674c9b5ba5642ac04ed11bb304b58a0b2cc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rslab-0.18.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ceea1d93d2c0dce9486cc851d0c9d65cebfe89af9d9f6d505e55f9d5e2883503
MD5 cac5dad50837a952ce88569fbe3cfb8c
BLAKE2b-256 ae90483764139601f166cc238ecbd88e83fb6e45cf874bf904b8728d47a7f8d1

See more details on using hashes here.

Provenance

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