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

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

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.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 fastprox 0.2.0
File Size Uploaded
fastprox-0.2.0.tar.gz 673.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fastprox 0.2.0
File
fastprox-0.2.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
fastprox-0.2.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
fastprox-0.2.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
fastprox-0.2.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
fastprox-0.2.0-cp312-abi3-macosx_10_15_x86_64.whl CPython 3.12 abi3 macOS 10.15+ x86-64 Details

Total release size: 2.9 MB

Release files / fastprox-0.2.0.tar.gz

Download URL fastprox-0.2.0.tar.gz
Size 673.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4873883105abc930af71f0ca27ec3e33d33383c7dc8ad376f0f31895d6ae5bfd
BLAKE2b-256 checksum
How to use checksums
3373433d16eee6f8607d104c7ab79af082782ae1766b8b16d46b04fea354cafe
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 17, 2026.

Transparency log

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

Download URL fastprox-0.2.0-cp312-abi3-win_amd64.whl
Size 497.3 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c4494c9966f5f5e2e74b19723677342f4ac263c8e40479d19b1670fe077720a1
BLAKE2b-256 checksum
How to use checksums
648a8ad3f44d8bd5d2a3f09c82a9545e81152dee541b9be61b19fdba7e39765c
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 17, 2026.

Transparency log

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

Download URL fastprox-0.2.0-cp312-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 558.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
e03a7acbc71edd57adfd4dd06fd4658f60c70069951bc898e1c907c550a9ff40
BLAKE2b-256 checksum
How to use checksums
7fc95b2046885cdb6b59e4a731a4cf02ffa719fef0f4f6946b15381d36b92aaa
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 17, 2026.

Transparency log

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

Download URL fastprox-0.2.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 500.8 kB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
8710812105cd29a55fde51703fcedede8ab8e09aaeba68a203864568f1cd0ca2
BLAKE2b-256 checksum
How to use checksums
3ddefe7c802e2d56306cd7ee166ce2a827d93df9cdb155ebdaf556c280411f65
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 17, 2026.

Transparency log

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

Download URL fastprox-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Size 280.4 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3300bb64bcda9193a9c937c3d10411989fd7b8fb1d9ccd19ec022a0ffb11b0bb
BLAKE2b-256 checksum
How to use checksums
a23456bad360cca5b7e5da54cf69b64a8980f18040b2f5de3b4ddf8bfa5df06b
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 17, 2026.

Transparency log

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

Download URL fastprox-0.2.0-cp312-abi3-macosx_10_15_x86_64.whl
Size 364.1 kB
Tags CPython 3.12 abi3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
44e83fe9abad89982b21f4611cad138f35a2818d77e101842a8f4c51592ab170
BLAKE2b-256 checksum
How to use checksums
5b5be976c2b942ec6ad110c097a48e0b176db34af9265b9ee5d033bd43ed6d3c
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 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files

0.1.0

6 release files

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