Skip to main content

Pure JAX implementation of Non-Uniform FFT

Project description

nufftax logo

nufftax

Pure JAX implementation of the Non-Uniform Fast Fourier Transform (NUFFT)

CI Documentation Python 3.12+ License: MIT


MRI reconstruction example

Why nufftax?

A JAX package for NUFFT already exists: jax-finufft. However, it wraps the C++ FINUFFT library via Foreign Function Interface (FFI), exposing it through custom XLA calls. This approach can lead to:

  • Kernel fusion issues on GPU — custom XLA calls act as optimization barriers, preventing XLA from fusing operations
  • CUDA version matching — GPU support requires matching CUDA versions between JAX and the library

nufftax takes a different approach — pure JAX implementation:

  • Fully differentiable — gradients w.r.t. both values and sample locations
  • Pure JAX — works with jit, grad, vmap, jvp, vjp with no FFI barriers
  • GPU ready — runs on CPU/GPU without code changes, benefits from XLA fusion
  • All NUFFT types — Type 1, 2, 3 in 1D, 2D, 3D

JAX Transformation Support

Transform jit grad/vjp jvp vmap
Type 1 (1D/2D/3D)
Type 2 (1D/2D/3D)
Type 3 (1D/2D/3D) ⚠️ ⚠️

✅ = Fully supported | ⚠️ = Work in progress

Differentiable inputs:

  • Type 1: grad w.r.t. c (strengths) and x, y, z (coordinates)
  • Type 2: grad w.r.t. f (Fourier modes) and x, y, z (coordinates)
  • Type 3: grad w.r.t. c and coordinates (in development)

Installation

uv pip install nufftax

Quick Example

import jax
import jax.numpy as jnp
from nufftax import nufft1d1

# Irregular sample locations in [-pi, pi)
x = jnp.array([0.1, 0.7, 1.3, 2.1, -0.5])
c = jnp.array([1.0+0.5j, 0.3-0.2j, 0.8+0.1j, 0.2+0.4j, 0.5-0.3j])

# Compute Fourier modes
f = nufft1d1(x, c, n_modes=32, eps=1e-6)

# Differentiate through the transform
grad_c = jax.grad(lambda c: jnp.sum(jnp.abs(nufft1d1(x, c, n_modes=32)) ** 2))(c)

Documentation

Read the full documentation →

License

MIT. Algorithm based on FINUFFT by the Flatiron Institute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nufftax-0.2.0.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nufftax-0.2.0-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file nufftax-0.2.0.tar.gz.

File metadata

  • Download URL: nufftax-0.2.0.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nufftax-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c2938764422a2043ca9787b341c56adf5b98815f1b1466f08dd30a5b3021ece3
MD5 7b54f91acb30a0e6f8aa5634532f7226
BLAKE2b-256 191a9a6e861ac8b5e7071097bdcff7b6d02ae99cf2f3b4f7166d6fe6b5e26f3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for nufftax-0.2.0.tar.gz:

Publisher: release.yml on geoffroyO/nufftax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nufftax-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nufftax-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nufftax-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07b9fad2a8b9614acff46ef52b65c470fa28197e2c02ae84883a87592a2e2755
MD5 ae6617dd7b4d5284bbd6062fee8f78b4
BLAKE2b-256 733764a0f348156f43b82998ffec0013d73aec198f6fb3c1d249f8db17ba7cb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for nufftax-0.2.0-py3-none-any.whl:

Publisher: release.yml on geoffroyO/nufftax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page