blocksolver 0.8.5__cp310-cp310-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,83 @@
1
+ """
2
+ BLIT - Block Iterative Sparse Linear Solvers
3
+
4
+ A Python interface to the BLIT Fortran library for solving sparse linear systems.
5
+ Falls back to pure-Python implementation when Fortran extension is unavailable.
6
+
7
+ Examples
8
+ --------
9
+ >>> from blocksolver import blqmr_solve
10
+ >>> result = blqmr_solve(Ap, Ai, Ax, b)
11
+ >>> print(result.x, result.converged)
12
+
13
+ >>> # With scipy sparse matrices:
14
+ >>> from blocksolver import blqmr_scipy
15
+ >>> x, flag = blqmr_scipy(A, b)
16
+
17
+ >>> # Direct block QMR with custom preconditioner:
18
+ >>> from blocksolver import blqmr, make_preconditioner
19
+ >>> M1 = make_preconditioner(A, 'ilu')
20
+ >>> x, flag, relres, niter, resv = blqmr(A, b, M1=M1)
21
+
22
+ >>> # Check which backend is being used:
23
+ >>> from blocksolver import BLQMR_EXT
24
+ >>> print("Using Fortran" if BLQMR_EXT else "Using pure Python")
25
+ """
26
+
27
+ from .blqmr import (
28
+ blqmr_solve,
29
+ blqmr_solve_multi,
30
+ blqmr_scipy,
31
+ blqmr,
32
+ BLQMRResult,
33
+ BLQMR_EXT,
34
+ qqr,
35
+ BLQMRWorkspace,
36
+ SparsePreconditioner,
37
+ DensePreconditioner,
38
+ make_preconditioner,
39
+ HAS_NUMBA,
40
+ )
41
+
42
+ __version__ = "0.8.5"
43
+ __author__ = "Qianqian Fang"
44
+
45
+ __all__ = [
46
+ "blqmr_solve",
47
+ "blqmr_solve_multi",
48
+ "blqmr_scipy",
49
+ "blqmr",
50
+ "BLQMRResult",
51
+ "BLQMR_EXT",
52
+ "HAS_NUMBA",
53
+ "qqr",
54
+ "BLQMRWorkspace",
55
+ "SparsePreconditioner",
56
+ "DensePreconditioner",
57
+ "make_preconditioner",
58
+ ]
59
+
60
+
61
+ def test():
62
+ """Run basic tests to verify installation."""
63
+ from .blqmr import _test
64
+
65
+ return _test()
66
+
67
+
68
+ def get_backend_info():
69
+ """Return information about the active backend.
70
+
71
+ Returns
72
+ -------
73
+ dict
74
+ Dictionary containing:
75
+ - 'backend': 'binary' or 'native'
76
+ - 'has_fortran': bool
77
+ - 'has_numba': bool (for Python backend acceleration)
78
+ """
79
+ return {
80
+ "backend": "binary" if BLQMR_EXT else "native",
81
+ "has_fortran": BLQMR_EXT,
82
+ "has_numba": HAS_NUMBA,
83
+ }
Binary file