Skip to main content

cholops logo: an eye with three diagonal squares

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:

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.

Single index-preserving replacement: absolute milliseconds on H100

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.4× / 21.8× 25.3× / 33.4×
float64 11.1× / 16.3× 17.6× / 25.4×

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cholops 0.2.0
File Size Uploaded Provenance Actions
cholops-0.2.0.tar.gz 166.5 kB With provenance Details for cholops-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cholops 0.2.0
File Interpreter ABI Platform Actions
cholops-0.2.0-py3-none-any.whl Python 3 none any Details for cholops-0.2.0-py3-none-any.whl

Total release size: 200.2 kB

Release files / cholops-0.2.0.tar.gz

Download URL cholops-0.2.0.tar.gz
Size 166.5 kB
Tags Source
SHA-256 checksum
How to use checksums
75c94ad6f2bbc16c17b7f7b299db7a29b632c1933e315481799c976bd69c8fb6
BLAKE2b-256 checksum
How to use checksums
c35f76e05dec5cf687455bed40a1931420a6812a47cf67569b0ddf8264f5b3b7
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 4, 2026.

Transparency log

Release files / cholops-0.2.0-py3-none-any.whl

Download URL cholops-0.2.0-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3db7d58b2166c910cad5e0d4576712e1625165181575f3f1728d19c9dfdd6bf2
BLAKE2b-256 checksum
How to use checksums
88fb69c48e7887a0e24a8b6479edcb231a09d243d7797c96683187a273f60420
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 4, 2026.

Transparency log

Security for cholops 0.2.0

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.

Select from 2 files

Attestation for cholops-0.2.0.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 4, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page