Skip to main content

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 vector
  • flag: 0=converged, 1=maxiter, 2=precond fail, 3=stagnation
  • iter: Iterations performed
  • relres: Relative residual
  • converged: Boolean property

Testing

make test
# or
pytest tests/ -v

License

BSD / LGPL / GPL - see LICENSE files in parent directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

blocksolver-0.8.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

blocksolver-0.8.0-cp313-cp313-win_amd64.whl (182.7 kB view details)

Uploaded CPython 3.13Windows x86-64

blocksolver-0.8.0-cp313-cp313-macosx_15_0_x86_64.whl (78.7 kB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

blocksolver-0.8.0-cp313-cp313-macosx_14_0_arm64.whl (79.3 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

blocksolver-0.8.0-cp312-cp312-win_amd64.whl (182.7 kB view details)

Uploaded CPython 3.12Windows x86-64

blocksolver-0.8.0-cp312-cp312-macosx_15_0_x86_64.whl (78.7 kB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

blocksolver-0.8.0-cp312-cp312-macosx_14_0_arm64.whl (79.3 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

blocksolver-0.8.0-cp311-cp311-win_amd64.whl (182.5 kB view details)

Uploaded CPython 3.11Windows x86-64

blocksolver-0.8.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

blocksolver-0.8.0-cp311-cp311-macosx_10_9_universal2.whl (139.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

blocksolver-0.8.0-cp310-cp310-win_amd64.whl (182.5 kB view details)

Uploaded CPython 3.10Windows x86-64

blocksolver-0.8.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

blocksolver-0.8.0-cp310-cp310-macosx_10_9_universal2.whl (139.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

blocksolver-0.8.0-cp39-cp39-win_amd64.whl (182.4 kB view details)

Uploaded CPython 3.9Windows x86-64

blocksolver-0.8.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

blocksolver-0.8.0-cp38-cp38-win_amd64.whl (180.7 kB view details)

Uploaded CPython 3.8Windows x86-64

File details

Details for the file blocksolver-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: blocksolver-0.8.0-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

Hashes for blocksolver-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dc6b4aafcd141cf934813da06fa707c368f54582fb7688438b993bfba2bea35
MD5 8859b03ed6cd54d3cbbd2389aed3e9e2
BLAKE2b-256 e2a9e060bf8de52291f316c3f0bad2a2d1f16ad4817e54db1f107f934b1228e3

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9474ac321f6c6f17d5352822e96717d973d50932b265281e1dedb9d81bf695cb
MD5 ebde77c0eb5d4bbcac30b5ab3960cfb1
BLAKE2b-256 6c4758f8677ce1d7f5868cf067b68bfb874ea7af1e157454bbbc405d600fa39e

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 2390b3269538eb92dcee438b8739e7a846521d9d7b0e1baacbd829d023572cad
MD5 6bbedb7bddeac38e7c52e88e980b9643
BLAKE2b-256 91419b453c4ac0d89a559971f431fc6dccfce6dffe39c5bc5dbbdfdc173c13f9

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 38c3b05e84e0b0a68925e09507a1c57e856e3be172344a4aec1da06dd5495fca
MD5 59ef728707a752b531cf2033395e5f76
BLAKE2b-256 fcdf598a5db90e1caaee32fbf6b558f946d84c3a4a76eeb9276d070ba0afaf6f

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ba53e36899802066fbb2fa8552d09fcc8e05e2fff2fd42116347c3a498fbc19c
MD5 8a2867a6f84c6e73c5b47f2338660118
BLAKE2b-256 e714230c4ce98466740003cb64eb89b4ed34723d9ee405c90fe8ae5018749f96

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 3a9a425f94d3e2a5c9ca9d2a322e581ec63215241118083cab0f9b0901b6f708
MD5 c895e807f839292acdceeeff3ae91998
BLAKE2b-256 bf6edc41ee46e5b81ac08069affff490ac56d1e62de1fd6a50eff640ce9336b4

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b611d58cbea93b4e797e713b223660ca05db701a4dce821549a464e60ba6dbd0
MD5 9ffc03bd7d804267cbfdb77a5beefc5e
BLAKE2b-256 a3609a50b0c9319f05fc79ccfa0a8e455d4079df628d6a732fa872dffcf2ed9f

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 25adfae12fab12ab43b044903b1babad654c0811a1f9965b6ef657f851638f4e
MD5 db5800257fc1b8e5a93ac13596a69403
BLAKE2b-256 494330f40a075b5ea1f75ed0ba24259d18d4b1123f61d3a3ecaf7fec1ec03164

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7ae390a740d1fd3d2af8339da63df88ebc5ada12fd9ad7c0093dedfe37a719b8
MD5 748aac91f0d6fa048e1bf6b4b3eefe65
BLAKE2b-256 3046508db34b76b738bc2918852517bdeeeef08ae2a18c1b396abff371e96611

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c44119a7d1febd8cf4dfb3bcf2cf131070e35c099cb6e4a9e4ad01a256997fc8
MD5 4a123d97e12ec1258dcdb752855aa82c
BLAKE2b-256 be02fbaf1943b6f3dbf7962d1c5c478b99cf214d7975fc1aff5157a75378997c

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 214e49ae28e06dd24332df9247088721339d1c2f790fa5a72b0f25404c712e22
MD5 231708c813ecc925b404e0bef7809b32
BLAKE2b-256 03958f2dc1d44b2abf12341dda97b95c6caad61e00b7eb3f7b7228b815514715

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 74e630bd052c6d31ab9b322ffd62c664b0eb7c88d3451f5169e028b6731b47f0
MD5 62b1da2fb9b92006ab9f78b94279d60b
BLAKE2b-256 b5969251824bbe38492fbfe2f84fdcabff38d36009233dd662d091bd49b2b4bb

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 da80c2e255a1aff2678a5ddb5f9b142631a9fa834560f23bb2b2a049e7f34fb5
MD5 c309d86172d3a3e721746f7a9ba051ba
BLAKE2b-256 5510565e098ff63a24d35e341ddf2e7d3444f3e576ff97fbeb66d9fdfddcfaaa

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: blocksolver-0.8.0-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

Hashes for blocksolver-0.8.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 aa7920c807c8a0e3815d89d5e0da3437a905d93d59e9d3a9f8724f43790f458d
MD5 a1862ca1d12643ea57e7fee2f2a92093
BLAKE2b-256 4445ae10585b462be4461615c2a8f686a550b1ae76f49f7c027beb58920beb93

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for blocksolver-0.8.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 aedb811f7a101ca8afc7df692d334a1cf652aeaf980ca43959e6cf5eba7475d3
MD5 b8a88f5a3f1f8a8a4bb29356529f9d78
BLAKE2b-256 4c573a6d742d56cae280b0cde25942df59e16cf586066043d1ca4879d52654e2

See more details on using hashes here.

File details

Details for the file blocksolver-0.8.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: blocksolver-0.8.0-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

Hashes for blocksolver-0.8.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4fd72d37eebab8a26ab77efa65933b3ac88947c836f2ca77d3a517dd34c74e2d
MD5 bcba695b67c2dad0e8c7f5df1c956b43
BLAKE2b-256 79edf4ff34c7c4b11fc7370eeab6d3c4bb368baf60074f8dc7884da274771a51

See more details on using hashes here.

Supported by

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