Preconditioner Design via Bregman Divergences
This package implements the preconditioners in [1]. A simple use case
is demonstrated below. See examples/example_pcg.py for a demo of all the
preconditioners defined in this package.
[1] TODO
Build Status
Installation
pip install scaled_preconditioners
A simple example
Define some parameters
dimension = 100
psd_rank = 50
Construct S = A + B
F = csc_matrix(np.random.rand(dimension, psd_rank))
B = F @ F.T
Q = csc_matrix(np.random.rand(dimension, dimension))
S = Q @ Q.T + B
Construct the preconditioner
Here we use a randomised SVD, other options include truncated SVD, the Nyström approximation. There is support for oversampling and power iteration schemes.
rank_approx = 15
pc = compute_preconditioner(
Q,
B,
algorithm="randomized",
rank_approx=rank_approx,
n_oversamples=4,
n_power_iter=0,
)
Set up a right-hand side
rhs = np.random.rand(dimension)
counter = ConjugateGradientCounter()
Solve Sx=b with and without a preconditioner
_, info = linalg.cg(S, rhs, callback=counter)
print("No preconditioner:")
print(f"\t Converged: {info == 0}")
print(f"\t Iterations: {counter.n_iter}\n")
counter.reset()
_, info = linalg.cg(S, rhs, M=rsvd_pc, callback=counter)
print("Randomised SVD preconditioner:")
print(f"\t Converged: {info == 0}")
print(f"\t Iterations: {counter.n_iter}\n")
Metadata
Release files for scaled-preconditioners 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scaled_preconditioners-0.1.1.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scaled_preconditioners-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / scaled_preconditioners-0.1.1.tar.gz
| Download URL | scaled_preconditioners-0.1.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6f58f225eec199236169eb42fe7fbf8147afcf1a3dbf97e9d7289191d5e3942
|
|
BLAKE2b-256 checksum How to use checksums |
006e2e8c5b6d4117eb0018a297cf9385fc4ade9a99e83b5f014adeddcf686ad2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.16 Linux/5.15.0-1035-azure
|
Release files / scaled_preconditioners-0.1.1-py3-none-any.whl
| Download URL | scaled_preconditioners-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3eee8d927c3c0564577514af55abf0defea81d5406cbdb161b40ece835e20232
|
|
BLAKE2b-256 checksum How to use checksums |
2b9b38fb13aa90853a907785bc0237ba0ba2ba9f7801c3bc7a11e360b9e50c90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.16 Linux/5.15.0-1035-azure
|