Block Quasi-Minimal-Residual sparse linear solver
Project description
BLIT Python Bindings
Python interface for the BLIT (Block Iterative) sparse linear solver library.
Installation
Prerequisites
- Python >= 3.8
- NumPy
- Fortran compiler (gfortran, ifort)
- UMFPACK/SuiteSparse library
- BLAS/LAPACK
On Ubuntu/Debian:
sudo apt install gfortran libsuitesparse-dev libblas-dev liblapack-dev
On macOS (Homebrew):
brew install gcc suite-sparse openblas
Install
cd python
pip install .
For development:
pip install -e .
Usage
Basic Usage
import numpy as np
from blocksolver import blqmr_solve
# Define sparse matrix in CSC format (0-based indexing)
Ap = np.array([0, 2, 5, 9, 10, 12], dtype=np.int32)
Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4], dtype=np.int32)
Ax = np.array([2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.])
b = np.array([8.0, 45.0, -3.0, 3.0, 19.0])
# Solve
result = blqmr_solve(Ap, Ai, Ax, b, tol=1e-8)
print(f"Solution: {result.x}")
print(f"Converged: {result.converged}")
print(f"Iterations: {result.iter}")
With SciPy Sparse Matrices
from scipy.sparse import csc_matrix
from blocksolver import blqmr_scipy
A = csc_matrix([[4, 1, 0], [1, 3, 1], [0, 1, 2]])
b = np.array([1., 2., 3.])
x, flag = blqmr_scipy(A, b, tol=1e-10)
Multiple Right-Hand Sides
from blocksolver import blqmr_solve_multi
B = np.column_stack([b1, b2, b3]) # n x nrhs
result = blqmr_solve_multi(Ap, Ai, Ax, B)
# result.x is n x nrhs
API Reference
blqmr_solve(Ap, Ai, Ax, b, **kwargs) -> BLQMRResult
Solve sparse system Ax = b.
Parameters:
Ap: Column pointers (int32, length n+1)Ai: Row indices (int32, length nnz)Ax: Non-zero values (float64, length nnz)b: Right-hand side (float64, length n)tol: Convergence tolerance (default: 1e-6)maxiter: Maximum iterations (default: n)droptol: ILU drop tolerance (default: 0.001)use_precond: Use ILU preconditioner (default: True)zero_based: Input uses 0-based indexing (default: True)
Returns: BLQMRResult with attributes:
x: Solution vectorflag: 0=converged, 1=maxiter, 2=precond fail, 3=stagnationiter: Iterations performedrelres: Relative residualconverged: Boolean property
Testing
make test
# or
pytest tests/ -v
License
BSD / LGPL / GPL - see LICENSE files in parent directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 blocksolver-0.8.1-py3-none-any.whl.
File metadata
- Download URL: blocksolver-0.8.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ac2168864695294daa264d02a237ab1e2071b91721e85b7eeda49eaf7661081
|
|
| MD5 |
17304e7bc643eed2a7d0f8cbe15bb433
|
|
| BLAKE2b-256 |
002467e67be0349089d2ded2bb7d837fc8157f3d199cd5cd0bf0a58a1c5a1df7
|
File details
Details for the file blocksolver-0.8.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 15.6 MB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06111be524fe452b71b9527a49663c7380fce4f1a6a26f1d522d22e600c7de1b
|
|
| MD5 |
4cf62a67ee5b2df2801eceabc5c6740c
|
|
| BLAKE2b-256 |
51f77533637209ec59754bdb1117d9ba45d239346ec1279accb0f2578cdc3258
|
File details
Details for the file blocksolver-0.8.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 182.7 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e83894ce44e463e42bb66985cbc06e47d44b0a964f89b37ec0d8580ebdfb939c
|
|
| MD5 |
ada958619031953e5e7781b61e28b3ce
|
|
| BLAKE2b-256 |
a7a26cf68e3a8343440dd4909f09bafee82bae6564c81f1e8afb7e8b5e6a996f
|
File details
Details for the file blocksolver-0.8.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 15.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89e43ec01464dd0b416804705751f0a5a4c17c7f92c871a8513f5c27aefd776e
|
|
| MD5 |
ca33d62e0fc816884148969dff312acb
|
|
| BLAKE2b-256 |
574f24ed16fc5717bdfdb01cdcfb6ab8edab026683491d0d7e5c94a39649e440
|
File details
Details for the file blocksolver-0.8.1-cp313-cp313-macosx_15_0_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp313-cp313-macosx_15_0_x86_64.whl
- Upload date:
- Size: 78.7 kB
- Tags: CPython 3.13, macOS 15.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3605fa94d760a4c1665eba974760733ea4a57c817abe7c7e2d5b1f52d48e39c
|
|
| MD5 |
f8ef510864132ef014b472fbdea0f5a7
|
|
| BLAKE2b-256 |
901bc2d536532fd099a6f17c7aaf401678693dfcf07c856ab0eb9a613b843bdf
|
File details
Details for the file blocksolver-0.8.1-cp313-cp313-macosx_14_0_arm64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp313-cp313-macosx_14_0_arm64.whl
- Upload date:
- Size: 79.3 kB
- Tags: CPython 3.13, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a6be6572088e3321f958e3a92a9dd0faf602ad0f891ca86b54c869dce354a3
|
|
| MD5 |
fac272b29b42ac6c080aca128a0d2df4
|
|
| BLAKE2b-256 |
16925155338e3921dbcba7bc675f1a6bd8701c364116ff6ec9c7ddde1b97a6f2
|
File details
Details for the file blocksolver-0.8.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 182.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a56a588e248322882e47dac4b66b575f2b9ae33e07068a3cfa07d2ad02c5c32
|
|
| MD5 |
d7095c1cc52210397d68387f87874412
|
|
| BLAKE2b-256 |
dadb69ced76f23b42aa1e0aee9e72f29c4177c07b255cf166aae2ec32421dc70
|
File details
Details for the file blocksolver-0.8.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 15.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9b6086cffb8b4990c852cefb57c0f0d5af4acf3c19a318c04aeea1a0eebb1be
|
|
| MD5 |
c09ca4fd38fa95930bef4c9cf1d59133
|
|
| BLAKE2b-256 |
07eba7d3688491b07e9d904728fdcb11371d13528722dd16e8a14efad16a3391
|
File details
Details for the file blocksolver-0.8.1-cp312-cp312-macosx_15_0_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp312-cp312-macosx_15_0_x86_64.whl
- Upload date:
- Size: 78.7 kB
- Tags: CPython 3.12, macOS 15.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ab6659e87b84fe86e43b9681709a50b3fab2f62b640c37507bee2134bc982ca
|
|
| MD5 |
196f784ffd1062c4263e7007d3926667
|
|
| BLAKE2b-256 |
a3826412f0afe0b634920a0eedb0d9fad826b956b9eb922b6e3aaf9a473a2e57
|
File details
Details for the file blocksolver-0.8.1-cp312-cp312-macosx_14_0_arm64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 79.3 kB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b7ebea69dc3c809e7ad5f51ae49dba17da0b01fec7f5e9e80c53e5a843d1365
|
|
| MD5 |
5030a889a8ec7411cc0f72c93d8d8bdd
|
|
| BLAKE2b-256 |
1fd67ee007d967edf72b2830b99916bcc02d69a20b80b28f748f950e2cdfe52d
|
File details
Details for the file blocksolver-0.8.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 182.5 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf125298248050c2230c1a05d08b0c8867dbdd177ce6a802e4d0f2a72132e8d1
|
|
| MD5 |
d9a0a43212387e2c3b396c8c16b4d914
|
|
| BLAKE2b-256 |
0f35b94e43b488638a6e45de0f48476cd9e2e1e800319741e26d875979d23389
|
File details
Details for the file blocksolver-0.8.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 11.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e578b725e1f89ff630e687d5b7715c1fa982db0b545f202b7c392cbd4ed58476
|
|
| MD5 |
97a4924a60dad5bce9c8a56e0c027337
|
|
| BLAKE2b-256 |
a99ce4c4412ca55fb0aedc4bb5126cba331440555b6cc477d8e3f1c37ed46b11
|
File details
Details for the file blocksolver-0.8.1-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 142.2 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9639316b55d52731563a31971ba312647187f1c86e4490aaae43872f3a28556
|
|
| MD5 |
44d823ffd122d2e3dd9e6a42bafb8a7d
|
|
| BLAKE2b-256 |
cf3f0bb9c410e7c689f6c8e17d4ecb9fecabd942c5ecb2a5ed144afd1f4fb8de
|
File details
Details for the file blocksolver-0.8.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 182.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b03358b5b63b4ced5da27eec96bfd5108d60f9f1257e1f37a5278e0ea6a6140c
|
|
| MD5 |
e2a74d8e02febf5f3c6b2dfcaeb877f0
|
|
| BLAKE2b-256 |
641d1417fbf035f7297e61939a83b6572cb1e2159cb938188ed34ce0baffb057
|
File details
Details for the file blocksolver-0.8.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 11.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c685fc37f7c16ce0045908d87fc6e7971616e0702971e3b54985d9b9d045df75
|
|
| MD5 |
e0df5fdbd1e701bbb873274ce17e3acf
|
|
| BLAKE2b-256 |
1b59e4b07d57901fb4d2e383771e69a00dbf9bd316058444c8f93aa1d5dd26aa
|
File details
Details for the file blocksolver-0.8.1-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 139.8 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e32f65a70fea09b90cee108928bfd8b7f2136eafcec33bb3477ed91a34606c97
|
|
| MD5 |
0f27ef9e3c28d90f717da7988d049595
|
|
| BLAKE2b-256 |
4205adc63c06ca7e754b5358960454aa7ad35d87ea5e58db60a2af124805799a
|
File details
Details for the file blocksolver-0.8.1-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 182.4 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21c8da9cc20974f35192845c211375c7f50ce19b201888cdfdf224c574cfc4c9
|
|
| MD5 |
1eaffc427271205b35231beffe45f8c1
|
|
| BLAKE2b-256 |
b40597c759c6c515d1224144e9c8ba4e1d0c09ae03e7e5edb6c2aa188d8c36e9
|
File details
Details for the file blocksolver-0.8.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 11.5 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
167d49080fc4a31f09694b67d3d6edd7fa14374fd3f75e3dc454dd24d5c46848
|
|
| MD5 |
61dc00d3bec4a7b009b93dfdcc206e69
|
|
| BLAKE2b-256 |
d8ba4b6206822068bb9e8c60e6ae0a89246ac55b7f8336f018382a47fb92c7ef
|
File details
Details for the file blocksolver-0.8.1-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: blocksolver-0.8.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 180.7 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dd16948d7a0119445627445959a199f52df70b684a70327748129f30e35881d
|
|
| MD5 |
d985ce3abf1f5236909be98760e636aa
|
|
| BLAKE2b-256 |
d165615f5332e129bf1c1eb66bf77f3b8e7f9542a2439b7b9e93b56f6c2b6b61
|