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]), 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]), 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. The executable examples explain each step and check their results against dense calculations:

  • Basic factor operations: add, replace and remove observations, then solve a system and calculate a Gaussian log likelihood.
  • Streaming Gaussian process: maintain a fixed-size observation window with PermutedCholesky and differentiate through the replacement sequence with respect to a kernel parameter.
  • Online least squares: update a regression fit with rank1_positive as 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 one covariance row and column.
chol_delete Delete one covariance row and column, preserving survivor order.
chol_replace Replace one covariance row and column at the same index.
chol_delete_append Delete one variable and append its replacement last.
chol_replace_last Replace a trailing block of variables.
chol_diag_update Add a signed value to one covariance diagonal entry.
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 15.7× / 21.3× 22.7× / 30.3×
float64 10.2× / 16.1× 15.6× / 22.9×

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.1.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.1.0
File Size Uploaded Provenance Actions
cholops-0.1.0.tar.gz 141.0 kB With provenance Details for cholops-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 163.9 kB

Release files / cholops-0.1.0.tar.gz

Download URL cholops-0.1.0.tar.gz
Size 141.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e45f69948de7ac0c01e0b05f88f4d44b0f792bb22e719abd95152edecb77730
BLAKE2b-256 checksum
How to use checksums
244973f687e5d6c4255da74403bfb32699a82014964aea4b1ddbf5ebde716014
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 Oct 27, 2026.

Transparency log

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

Download URL cholops-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83b533c130dd15603b4e3eecb306f31425edd6e3058601e6467ca882f88f21ec
BLAKE2b-256 checksum
How to use checksums
add565a951b7cb21c6b316874a57d563d8eca540f647fce5aa5027237b01cf86
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 Oct 27, 2026.

Transparency log

Security for cholops 0.1.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.1.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 Oct 27, 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