sparsax.lu_backend¶
-
sparsax.lu_backend(Ai, Aj, n, backend=
'auto', workload='solve')[source]¶ Choose the faster LU backend for a sparsity pattern.
KLU’s left-looking factorization wins on sparse graphs, such as contiguity and few-neighbour k-NN weights. UMFPACK’s multifrontal one, which hands dense fronts to BLAS, wins once those fronts grow. One number decides between them: KLU’s flops per factor entry, roughly the size of a typical front. Mean degree does not decide it, because the crossover degree falls as
ngrows.The choice depends on the pattern alone, never on the values or on a timing, so a fixed seed reproduces the same draws: a sampler turns a 1e-15 difference in rounding into a different chain within a few dozen sweeps. Measuring the pattern costs one KLU factorization, once per pattern per process. The thresholds come from an Apple M3 Max; on other hardware they may shift, which moves near-ties.
- Parameters:¶
- Ai¶
COO pattern, concrete rather than traced. Duplicates and the order of entries do not matter.
- Aj¶
COO pattern, concrete rather than traced. Duplicates and the order of entries do not matter.
- n¶
matrix dimension.
- backend=
'auto'¶ "auto"(default), or"klu"or"umfpack"to pin one.- workload=
'solve'¶ what the factors are mostly for:
"solve"(default) or"logdet".
- Returns:¶
LUBackend, whosesolve,factor,solve_factor,logdet,logdet_factor,slogdetandrcondhave thelu_*signatures. Tokens belong to the backend that issued them.