CPU approximate-Cholesky preconditioner for graph-Laplacian / SDDM linear systems
Project description
apxchol (Python, CPU)
Approximate-Cholesky preconditioner for graph-Laplacian / SDDM linear systems.
pip install apxchol
Prebuilt wheels: Linux x86_64 (manylinux), CPython 3.10–3.14. CPU only.
The wheels are built with 32-bit indices: inputs (and factors) beyond ~2.1e9
nonzeros are unsupported — build from source with
-DAPXCHOL_64BIT_EDGE_INDICES=ON for larger problems.
import apxchol
solver = apxchol.factorize(A) # scipy sparse Laplacian or SDDM; factor once
res = solver.solve(b, rtol=1e-8, maxiter=500)
res.x, res.iters, res.residual, res.converged
z = solver.apply(r) # M^{-1} r
M = solver.aspreconditioner() # use as M= in scipy.sparse.linalg.cg
res = apxchol.solve(A, b) # one-shot convenience
Laplacian vs SDDM is auto-detected: singular Laplacians get a rank-(n−1)
factor with native null-space handling; SDDM systems get the full-rank factor.
The factor is built once per factorize(A) (alias: apxchol.solver(A)) and
reused across right-hand sides; solve runs the library's OpenMP-parallel PCG
(threads via OMP_NUM_THREADS).
Solving
res = solver.solve(b, rtol=1e-8, maxiter=500, x0=guess)
rtol is the relative-residual target (SciPy's name; tol is kept as an
alias and rtol wins if both are given, default 1e-8). x0 is an optional
initial guess — an already-converged x0 returns iters == 0.
out is an optional writable C-contiguous float64 array of length n: the
solution is written into it in place (no per-solve allocation) and returned as
SolveResult.x.
Options
solver = apxchol.factorize(A, seed=42, partitioner="block_greedy",
storage="vec_pool", keep_factor=True)
seed— RNG seed for the randomized clique sampling.partitioner— independent-set selector:block_greedy(default),luby,baumann_kyng,rootset.storage— graph backend:vec_pool(default),forward_star,vec,bstr.keep_factor— keep the factor arrays alive for export (defaultTrue). Costs one extra factor-sized copy in memory (~8 bytes per factor nonzero in the default fp32 wheels); withkeep_factor=Falsethechol()/L/Dexport raises, whileP,factor_nnzandfill_ratiostay available. Passkeep_factor=Falsefor the leanest factor-once / solve-many footprint (the 0.1.x behavior);apxchol.solve()(one-shot) usesFalse.
Advanced core knobs are passed through as extra keywords:
degree_quantile, degree_multiplier, degree_tiebreak,
exact_clique_max_degree, residual_peel
(natural | min_degree | bk_serial), stagnation_window. Unknown
keywords raise ValueError. Note: degree_multiplier only takes effect when
degree_quantile=0 (the quantile cap, default 0.2, replaces it).
Factor export
P = solver.P # int64: P[original_vertex] = position in elimination order
G = solver.chol() # scipy.sparse.csc_matrix, lower-triangular incl. sqrt-diagonal
L, D = solver.L, solver.D # unit-lower CSC and the diagonal of L·D·L^T
solver.factor_nnz, solver.fill_ratio
The factor lives in permuted space, ordered by elimination:
import numpy as np
import scipy.sparse as sp
p = np.argsort(solver.P) # original index of the k-th eliminated vertex
A_perm = A[p][:, p]
# A_perm ~= G @ G.T ~= L @ sp.diags(D) @ L.T
G is an approximate, randomly sampled factor, so that identity is
approximate by construction; L @ diags(D) @ L.T == G @ G.T is exact. For a
pure Laplacian (solver.sddm == False) it holds on the rank-(n−k) subspace
only, where k is the number of connected components — the last eliminated
column of each component carries a placeholder diagonal.
fill_ratio is (2 * factor_nnz - n) / nnz(A): the factor G reflected to a
full symmetric pattern (diagonal counted once) against the nonzeros of the full
symmetric A.
Exported values are float64 numpy arrays, but default builds store factor values in fp32, so they carry fp32 precision (~7 digits).
Thread safety
A Solver is not safe for concurrent use: solve() and apply() write shared
internal scratch buffers. Use one Solver per thread, or serialize calls
(each call is itself OpenMP-parallel).
License
Interim academic-evaluation license: free for academic research and
evaluation; redistribution and commercial use prohibited. See LICENSE.
From source
The wheel build compiles the library's two core translation units directly; building from a repository checkout works the same way:
pip install -e python # from the repository root
pytest python/tests -v
Source builds use -O3 -march=native (the distributed wheels are built
portable). If your environment requires --no-build-isolation, first
pip install pybind11 scikit-build-core.
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 apxchol-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: apxchol-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 425.8 kB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
597e9131558cb9bfabff637f92c55144373b726a7bb83ed3a73ea471d67bb181
|
|
| MD5 |
d677d83fe8f969c8d92afa69f465e7d4
|
|
| BLAKE2b-256 |
0a723f424663c848b8e896bcc374cabbea4452a9611b769f9d5623d9745487c5
|
Provenance
The following attestation bundles were made for apxchol-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on AlgOptGroup/apxchol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apxchol-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
597e9131558cb9bfabff637f92c55144373b726a7bb83ed3a73ea471d67bb181 - Sigstore transparency entry: 2256594887
- Sigstore integration time:
-
Permalink:
AlgOptGroup/apxchol@48686de020a5edf4110e6e3313f180d54dda41ed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AlgOptGroup
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48686de020a5edf4110e6e3313f180d54dda41ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file apxchol-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: apxchol-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 425.7 kB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e6d4055eb7232fd79d33b60814ff604243149cba2315cb6e8dd5800f3cedf7e
|
|
| MD5 |
5a754ffd4b9d98826d08c92f10dc8ff1
|
|
| BLAKE2b-256 |
f27a6992e526a09a7f23f91e4022e0a7ae0b02e2c0c8be3ceb7623e515dd5933
|
Provenance
The following attestation bundles were made for apxchol-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on AlgOptGroup/apxchol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apxchol-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
6e6d4055eb7232fd79d33b60814ff604243149cba2315cb6e8dd5800f3cedf7e - Sigstore transparency entry: 2256594894
- Sigstore integration time:
-
Permalink:
AlgOptGroup/apxchol@48686de020a5edf4110e6e3313f180d54dda41ed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AlgOptGroup
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48686de020a5edf4110e6e3313f180d54dda41ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file apxchol-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: apxchol-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 425.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ae1e132c65b4c89c4949e138c0c1e8bd8252c5ec34506b77f40ddad57d1277
|
|
| MD5 |
b0b6f7628a95bf1803c95954b33193f2
|
|
| BLAKE2b-256 |
8e1ea5f200feaa4e18e2907628615c8df740d9ef3acc2afe182fe45f1e11bd00
|
Provenance
The following attestation bundles were made for apxchol-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on AlgOptGroup/apxchol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apxchol-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
28ae1e132c65b4c89c4949e138c0c1e8bd8252c5ec34506b77f40ddad57d1277 - Sigstore transparency entry: 2256594882
- Sigstore integration time:
-
Permalink:
AlgOptGroup/apxchol@48686de020a5edf4110e6e3313f180d54dda41ed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AlgOptGroup
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48686de020a5edf4110e6e3313f180d54dda41ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file apxchol-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: apxchol-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 425.7 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a1988f7a45bd184946059b8e7b29801dd7530401c0fdfff136d9bba30236a5
|
|
| MD5 |
a99667140a1bbf1a91e960f84e737ed8
|
|
| BLAKE2b-256 |
695afde0b4e98ee1ae738f20afac950a9cee316d5b77a81c8aeb56de0dc368a6
|
Provenance
The following attestation bundles were made for apxchol-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on AlgOptGroup/apxchol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apxchol-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
00a1988f7a45bd184946059b8e7b29801dd7530401c0fdfff136d9bba30236a5 - Sigstore transparency entry: 2256594875
- Sigstore integration time:
-
Permalink:
AlgOptGroup/apxchol@48686de020a5edf4110e6e3313f180d54dda41ed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AlgOptGroup
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48686de020a5edf4110e6e3313f180d54dda41ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file apxchol-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: apxchol-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc3837897d18e323b0b734466375a536da608722735f2784ff6db8edfde1dc5
|
|
| MD5 |
24a9f0fae9be1ad0cbb05961956d33d2
|
|
| BLAKE2b-256 |
a7c1a729fb5543f83669e585c5eddcae12171557f3499765b76bf81d23f002b8
|
Provenance
The following attestation bundles were made for apxchol-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on AlgOptGroup/apxchol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apxchol-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
ddc3837897d18e323b0b734466375a536da608722735f2784ff6db8edfde1dc5 - Sigstore transparency entry: 2256594907
- Sigstore integration time:
-
Permalink:
AlgOptGroup/apxchol@48686de020a5edf4110e6e3313f180d54dda41ed -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AlgOptGroup
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@48686de020a5edf4110e6e3313f180d54dda41ed -
Trigger Event:
release
-
Statement type: