Skip to main content

fastprox

Exact proximal operators and projections with derivatives. A C++17 core behind a plain-C API, with Python bindings.

  • Exact or certified. Direct algorithms (Condat's 1D TV and simplex projection, the taut string, pool-adjacent-violators, closed forms) where they exist. The image TV solvers stop on a certified duality gap, and anisotropic TV is polished to the exact solution once its regions are found.
  • Differentiable. Jacobian-vector and vector-Jacobian products in the input, the step and the operator's parameters, for bilevel learning and implicit differentiation, also inside PyTorch and JAX programs (fastprox.torch, fastprox.jax, since 0.3).
  • Batched. Applied along any axis of a float32 or float64 array, with rows processed in parallel on fastprox's own threads (no OpenMP runtime to clash with PyTorch or others) and results bit-identical for any number of threads.
  • Permissive. MIT licensed; every kernel is written from the papers.

Install

pip install fastprox

Wheels are abi3 for CPython 3.12 and later on Linux (x86_64, aarch64), macOS (arm64 from 11.0, x86_64 from 10.15) and Windows (amd64), and depend on nothing but NumPy. The PyTorch and JAX wrappers and image TV on GPUs (since 0.3) use PyTorch and JAX when they are installed, and never require them.

Use

import numpy as np
import fastprox as fp

x = np.random.default_rng(0).normal(size=(64, 1000))

z = fp.tv1d(x, gamma=0.5)                 # 1D total variation along the last axis
p = fp.project_simplex(x, radius=1.0)     # each row onto the simplex
s = fp.soft_threshold(x, lam=0.1)

# Operators with derivatives
op = fp.TV1D(weights=0.8)
z, ctx = op.prox(x, 0.5, keep=True)
dz = op.jvp(ctx, dx=np.ones_like(x))      # Jacobian-vector product
gx, grads = op.vjp(ctx, g=x)              # vector-Jacobian product
print(grads.gamma, grads.weights)         # gradients in the step and the weights

Operators

  • Elementwise: soft thresholding (weighted), elastic net, Huber, box, nonnegative orthant, log barrier, ℓ1 over a box.
  • Nonconvex: ℓ0, ℓq (0 < q < 1), SCAD and MCP (weighted), log penalty, with an explicit tie rule.
  • Groups and trees: group ℓ2, group Huber, group SCAD and MCP, tree-structured group norms and the sparse group lasso.
  • Projections: ℓ2 ball, simplex, weighted ℓ1 ball, hyperplane or half-space intersected with a box, second-order cone. Also the ℓ∞ norm and the support functions max and the sum of the k largest entries.
  • Signals: isotonic regression, 1D total variation with per-edge weights, its ℓ2-of-differences variant, and the projection onto a 1D TV ball.
  • Images: anisotropic and isotropic total variation in 2D and 3D, with warm starts (since 0.2), also on GPUs through the PyTorch and JAX wrappers (since 0.3).
  • Graphs: total variation on any graph, exact, by parametric max-flow, and on trees and paths by dynamic programming (since 0.3).

Each one has a conjugate prox through the Moreau identity. The elementwise maps with kinks report which entries sit at a breakpoint, and their derivatives can be taken on either side of it.

Documentation

C library

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build && cmake --install build --prefix /usr/local

Then find_package(fastprox) and link fastprox::fastprox, or use pkg-config --cflags --libs fastprox. The header is include/fastprox.h.

License

MIT

Metadata

Release files for fastprox 0.3.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 fastprox 0.3.0
File Size Uploaded Provenance Actions
fastprox-0.3.0.tar.gz 970.0 kB With provenance Details for fastprox-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fastprox 0.3.0
File Actions
fastprox-0.3.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for fastprox-0.3.0-cp312-abi3-win_amd64.whl
fastprox-0.3.0-cp312-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details for fastprox-0.3.0-cp312-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
fastprox-0.3.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for fastprox-0.3.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
fastprox-0.3.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for fastprox-0.3.0-cp312-abi3-macosx_11_0_arm64.whl
fastprox-0.3.0-cp312-abi3-macosx_10_15_x86_64.whl CPython 3.12 abi3 macOS 10.15+ x86-64 Details for fastprox-0.3.0-cp312-abi3-macosx_10_15_x86_64.whl

Total release size: 3.5 MB

Release files / fastprox-0.3.0.tar.gz

Download URL fastprox-0.3.0.tar.gz
Size 970.0 kB
Tags Source
SHA-256 checksum
How to use checksums
95fff4da1d814a366f1f6398b23a8214f88608ea77116cca3da72ca2337be82b
BLAKE2b-256 checksum
How to use checksums
ad3fa8f1fb68b5890f362f235e56cbe4eb39c51a0773d98ae0df699c2e4fd963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fastprox-0.3.0-cp312-abi3-win_amd64.whl

Download URL fastprox-0.3.0-cp312-abi3-win_amd64.whl
Size 566.0 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0089cf9df11ee46adbf6e719a8a1cbe321e3db9bae3cedd1e714ffec0d385b2b
BLAKE2b-256 checksum
How to use checksums
8869ada6159f3de41713c36509cf44af45d75b1d90a5bdb49c9f4819ffc3e943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fastprox-0.3.0-cp312-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL fastprox-0.3.0-cp312-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 646.7 kB
Tags CPython 3.12 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
3f339d8a1ada8793702285933270d28588a1857fcf34301bc4ab28077405f19f
BLAKE2b-256 checksum
How to use checksums
e50688c48a7fb04cc7f6eece8ec5f6ba45079b2b4a091e6fc89800c5bd243d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fastprox-0.3.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL fastprox-0.3.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 579.7 kB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b8b163a0cd03a5412b863e6cfc43c83dfebae562fa989ea2eaf830a37b8ab0a3
BLAKE2b-256 checksum
How to use checksums
59e8ab62539a2322b356d64bd2440cfd4ead368b3db2d6790b261747f08e8ab6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fastprox-0.3.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL fastprox-0.3.0-cp312-abi3-macosx_11_0_arm64.whl
Size 343.9 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4d8f9e16608dea90107caa4f455979606fb0d97169a5a775a21444d24a897ed8
BLAKE2b-256 checksum
How to use checksums
a94f83b9bf9a9ed45a4cfe2292f5a0aa9f0c8dac26d69b9152de3602f0eb47bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fastprox-0.3.0-cp312-abi3-macosx_10_15_x86_64.whl

Download URL fastprox-0.3.0-cp312-abi3-macosx_10_15_x86_64.whl
Size 439.2 kB
Tags CPython 3.12 abi3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
4916286236f103b24cab044c82c31297b7a117c37d30eb9dcebd453319629893
BLAKE2b-256 checksum
How to use checksums
2d4cc48baff14008cd6e62ed5bcaf81cc9eefdf556d75714a9620b169476cf4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Security for fastprox 0.3.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

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for fastprox-0.3.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 18, 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