cholops
Cholesky modifications in JAX, with differentiable tensor operations and immutable factor objects. cholops provides fast appends, deletions and updates of a dense positive-definite matrix's factor, directly or through a factor object.
Install
Install with pip install cholops. On Linux with a compatible CUDA 13 driver,
use pip install "cholops[cuda13]". The initial release targets JAX 0.11.2 and
Python 3.12 or newer.
We recommend using float64; see JAX's precision settings.
Set the JAX_ENABLE_X64 shell environment variable before starting Python:
export JAX_ENABLE_X64=1
Alternatively, enable it in Python before creating arrays:
import jax
jax.config.update("jax_enable_x64", True)
Example
import jax
import jax.numpy as jnp
from cholops import Cholesky, PermutedCholesky
A = jnp.array([[2.0, 0.3, 0.1], [0.3, 1.5, 0.2], [0.1, 0.2, 1.2]])
b = jnp.array([1.0, -0.5, 0.2])
# Create a Cholesky factor from a positive-definite matrix.
factor = Cholesky.from_matrix(A)
factor = factor.append(jnp.array([[0.2], [0.1], [0.05]]), jnp.array([[1.3]]))
L = factor.factor
x = factor.solve(
jnp.append(b, 0.4)
) # One RHS entry per variable, including the new one.
# PermutedCholesky replaces by deletion and appending,
# while managing logical ordering transparently.
managed = PermutedCholesky.from_matrix(A)
updated = managed.replace(1, jnp.array([[0.2], [0.1]]), jnp.array([[1.3]]))
x_new = updated.solve(b) # Inputs and outputs remain in logical order.
# Zero-mean Gaussian log likelihood and its covariance/data gradients.
@jax.jit
def log_likelihood(A, b):
state = Cholesky.from_matrix(A)
return -0.5 * (state.logdet() + state.quadratic(b) + b.size * jnp.log(2 * jnp.pi))
logp, (grad_A, grad_b) = jax.value_and_grad(log_likelihood, argnums=(0, 1))(A, b)
See the factor guide for more information.
Here are a few examples of how to use cholops:
- Basic factor operations: add, replace and remove observations, then solve a system and calculate a Gaussian log likelihood.
- Gaussian-process regression: compute predictions and a log marginal likelihood.
- Adding observations: update a GP as new observations arrive.
- Streaming GP with a fixed-size factor:
use
PaddedCholeskyto reserve space for incoming observations and avoid recompilation during streaming. - GP with a sliding observation window:
replace old observations with new ones using
PermutedCholesky, and differentiate through the updates with respect to a kernel parameter. - Online least squares: update a regression
fit with
rank1_positiveas measurements arrive. - Direct tensor operations: compare replacement orderings and arrange the right-hand side for each returned factor.
Tensor operations
The factor objects use the following tensor operations, which can also be
imported directly from cholops:
| Operation | Description |
|---|---|
cholesky |
Factor a positive-definite matrix. |
chol_append |
Append a block of covariance rows and columns. |
chol_delete |
Delete selected variables, preserving survivor order. |
chol_delete_one |
Preferred path for deleting a single variable, using the specialized rank-one update. |
chol_delete_last |
Delete a trailing block by slicing the factor. |
chol_replace |
Replace a consecutive block of variables at the same positions. |
chol_delete_append |
Delete selected variables and append a new block last. |
chol_replace_last |
Replace a trailing block of variables. |
chol_diag_update |
Add a signed value to one covariance diagonal entry. |
chol_update |
Apply a positive update U @ U.T, with one or more columns in U. |
chol_rank1 |
Apply a rank-one update with a signed weight. |
chol_rank1_positive |
Apply a positive rank-one update using the optimized path. |
See the tensor guide for shapes, ordering and preconditions.
All operations support jit, vmap and first-order forward and reverse
differentiation. Higher-order derivatives have not been validated for general use.
Performance
We benchmark a single index-preserving chol_replace call against a naive JAX
implementation and full matrix refactorization on an NVIDIA H100. All methods
receive the existing factor and replacement covariances.
Replacing the first index of a 16,384 × 16,384 matrix gives the following speedups after compilation:
| Precision | Forward: vs recompute / naive replacement | Value + gradient: vs recompute / naive replacement |
|---|---|---|
| float32 | 16.6× / 23.1× | 25.8× / 34.0× |
| float64 | 11.2× / 18.0× | 17.8× / 26.6× |
Recomputation forms L @ L.T, changes its row/column
and calls native JAX Cholesky. The naive replacement
baseline uses two signed rank-one scans with standard JAX autodiff.
See the complete benchmark results for the measurement protocol, additional timings and memory usage.
Numerical limitations
Near-singular covariances can produce inaccurate factors and gradients. See numerical limits.
Metadata
Release files for cholops 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| cholops-0.2.1.tar.gz | 166.8 kB | With provenance | Details for cholops-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cholops-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for cholops-0.2.1-py3-none-any.whl |
Total release size: 200.7 kB
Release files / cholops-0.2.1.tar.gz
| Download URL | cholops-0.2.1.tar.gz |
|---|---|
| Size | 166.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbf9c3e258a2d670f78e457a65bad491225640d14580280c5f35971c99f02095
|
|
BLAKE2b-256 checksum How to use checksums |
2a4f102ae33e1d2a2faceda7faedce83b063b1640eec7902487662dcd9a727e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / cholops-0.2.1-py3-none-any.whl
| Download URL | cholops-0.2.1-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25e7f7815169f10f9d1d348f4ca83b432cbadecf7c9edb0fad355a24682a8205
|
|
BLAKE2b-256 checksum How to use checksums |
8d02b9e14253c75e75104e8352a0caadfe76437992cfc8a3672ba481622bf8dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for cholops 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cholops-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.