Rocket-FFT
Rocket-FFT makes Numba aware of numpy.fft and scipy.fft. It takes its name from the PocketFFT library that originally powered it, and Numba's goal of making your scientific Python code blazingly fast - like a rocket. Today, Rocket-FFT is powered by PocketFFT's successor DUCC0, the same library that runs scipy.fft.
Getting Started
The easiest way to get Rocket-FFT is to:
$ pip install rocket-fft
Alternatively, you can build it from source:
$ git clone https://github.com/styfenschaer/rocket-fft.git
$ cd rocket-fft
$ pip install .
The latter requires a C++17 compiler. Rocket-FFT requires Python 3.10 or newer, Numba 0.60 or newer and NumPy 2.0 or newer. SciPy is optional.
Once installed successfully, the following will work (no import required):
import numba as nb
import numpy as np
@nb.njit
def jit_fft(x):
return np.fft.fft(x)
a = np.array([1, 6, 1, 8, 0, 3, 3, 9])
jit_fft(a)
Supported Functions
Rocket-FFT supports all functions of numpy.fft and scipy.fft in jitted code, with all their arguments. The results match NumPy and SciPy, down to the data type and the memory layout of the returned arrays. The exceptions are:
- SciPy's backend functions (
set_backend,skip_backend,set_global_backendandregister_backend) and itsset_workersandget_workers. Use theworkersargument or Rocket-FFT's ownset_workers(see below) instead. - The
planargument must beNone,xpmust beNoneor NumPy, anddevicemust beNoneor"cpu". - An empty
axestuple is not allowed. - Half precision (
float16) and extended precision (longdouble) are not supported.
Rocket-FFT also extends Numba's numpy.roll to NumPy's full signature roll(a, shift, axis=None), and provides loggamma and poch (as in scipy.special) in rocket_fft.special. These are ufuncs that work in pure Python and in jitted code.
Performance Tips
Compiling a call takes well below 200 milliseconds, whichever arguments you pass. Compiled functions can be cached with @nb.njit(cache=True).
Multidimensional transforms can use several threads. Pass workers to the scipy.fft functions, or set the default for all transforms with set_workers, which also affects functions that were compiled before:
import rocket_fft
rocket_fft.set_workers(4)
rocket_fft.get_workers() # 4
FFTs are fastest for lengths with small prime factors. scipy.fft.next_fast_len and scipy.fft.prev_fast_len find such lengths, also in jitted code:
import scipy.fft
@nb.njit
def padded_fft(x):
n = scipy.fft.next_fast_len(x.size)
return np.fft.fft(x, n)
If SciPy is not installed, use rocket_fft.next_fast_len and rocket_fft.prev_fast_len instead. They work the same way.
On x86-64, Rocket-FFT contains two builds of its native library and picks the faster one your CPU supports: one that uses AVX2 instructions, and a generic one. You can force one of them by setting the environment variable ROCKET_FFT_SIMD to generic or avx2.
This must happen before Rocket-FFT is imported or any function using it is compiled:
import os
os.environ["ROCKET_FFT_SIMD"] = "generic"
NumPy and SciPy Semantics
NumPy and SciPy show a subtle difference in how they handle the axes argument: NumPy allows duplicate axes in its multidimensional transforms (as in fftn(x, axes=(0, 0))), whereas SciPy doesn't. Rocket-FFT follows each library: calls to numpy.fft behave like NumPy, calls to scipy.fft like SciPy.
Low-Level Interface
Rocket-FFT also provides a low-level interface to DUCC0. It has the least overhead, gives the most flexibility, and includes transforms that are not available through numpy.fft and scipy.fft. Its functions can only be called from jitted code. You can import them from the rocket_fft namespace:
from rocket_fft import c2c, dct, ...
The low-level interface includes the following functions:
def c2c(ain: NDArray[c8] | NDArray[c16], aout: NDArray[c8] | NDArray[c16], axes: NDArray[i8], forward: bool, fct: float, nthreads: int) -> None: ...
def r2c(ain: NDArray[f4] | NDArray[f8], aout: NDArray[c8] | NDArray[c16], axes: NDArray[i8], forward: bool, fct: float, nthreads: int) -> None: ...
def c2r(ain: NDArray[c8] | NDArray[c16], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], forward: bool, fct: float, nthreads: int) -> None: ...
def c2c_sym(ain: NDArray[f4] | NDArray[f8], aout: NDArray[c8] | NDArray[c16], axes: NDArray[i8], forward: bool, fct: float, nthreads: int) -> None: ...
def dct(ain: NDArray[f4] | NDArray[f8], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], type: int, fct: float, ortho: bool, nthreads: int) -> None: ...
def dst(ain: NDArray[f4] | NDArray[f8], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], type: int, fct: float, ortho: bool, nthreads: int) -> None: ...
def r2r_separable_hartley(ain: NDArray[f4] | NDArray[f8], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], fct: float, nthreads: int) -> None: ...
def r2r_genuine_hartley(ain: NDArray[f4] | NDArray[f8], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], fct: float, nthreads: int) -> None: ...
def r2r_fftpack(ain: NDArray[f4] | NDArray[f8], aout: NDArray[f4] | NDArray[f8], axes: NDArray[i8], real2hermitian: bool, forward: bool, fct: float, nthreads: int) -> None: ...
def good_size(target: int, real: bool = False) -> int: ...
def prev_good_size(target: int, real: bool = False) -> int: ...
The functions write their result into aout, whose shape determines the transform lengths: where ain and aout differ in size along an axis, the input is zero-padded or truncated. The scale factor fct is applied as is, without any normalization. For example:
from rocket_fft import c2c
@nb.njit
def unnormalized_fft(x):
out = np.empty_like(x)
c2c(x, out, np.array([0]), True, 1.0, 1)
return out
Note that the low-level interface provides less safety and convenience than numpy.fft and scipy.fft. You may want to consult the DUCC0 documentation before using it.
Contributing
Contributions are welcome. CONTRIBUTING.md explains how to set up a development environment, run the tests and benchmarks, and release; ARCHITECTURE.md explains how Rocket-FFT works internally.
License
Rocket-FFT is distributed under the BSD-3-Clause License. The bundled DUCC0 sources are dual-licensed under BSD-3-Clause or GPL-2.0-or-later and are used under the BSD-3-Clause terms. Parts of Rocket-FFT are adapted from SciPy, NumPy and pypocketfft, and its interface to Numba's runtime mirrors Numba's headers. All their licenses are in LICENSES.
Metadata
Release files for rocket-fft 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rocket_fft-0.4.1.tar.gz | 146.4 kB | With provenance | Details for rocket_fft-0.4.1.tar.gz |
Built distributions (wheels)
Total release size: 5.6 MB
Release files / rocket_fft-0.4.1.tar.gz
| Download URL | rocket_fft-0.4.1.tar.gz |
|---|---|
| Size | 146.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a421a391d779d57af188416ed803213bac6c18c06be8efbea8666f38924d150d
|
|
BLAKE2b-256 checksum How to use checksums |
00cb320eb75e878b0697198ba17e5b01062b1fbef0175a56039f4db943d09ffc
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-win_arm64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 620.7 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
210679232857f635ab6792aa8c0d558b476474590071528e0297a7ed3ef2a384
|
|
BLAKE2b-256 checksum How to use checksums |
39312ead1628501e5b758352b5a9d4f371e2c421a9c5886e6619768dfdbecab5
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-win_amd64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 731.5 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0001e8402a5379cecb30a4bd1958c6dad4a3526450bee458480715e2277c1c26
|
|
BLAKE2b-256 checksum How to use checksums |
3f808955a70ccd4800d77e80d5ef00461dfa500ba8f1430aeecd72a786a9e942
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
30ec1668b7cd9d7cb63d58b023533169367f6c973f7c5ef5c21b61feec446063
|
|
BLAKE2b-256 checksum How to use checksums |
b0d2f0d8bf07e064ae8a355a84f736a820481dfb66df7d688fccaad7ac65a921
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 706.2 kB |
| Tags | CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
06b8d2070861e78afdf5f0c4b487201acb1ec297ba7a538b9561d3d09e919f40
|
|
BLAKE2b-256 checksum How to use checksums |
0b8c8ae6b65bcd6308cf567fe6ce23b323aff99e52ca07ea3763df581e99480d
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 509.7 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ad068859cc9906c942db58c4a4bce158b1a41e1f9d63bb6722079c7f7759e5ea
|
|
BLAKE2b-256 checksum How to use checksums |
3aaadf71ef9803dbc4d7ca83ed3cfc165ef5cb616d84ae143c3cbc9876edccc9
|
| 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 logRelease files / rocket_fft-0.4.1-cp310-abi3-macosx_10_15_x86_64.whl
| Download URL | rocket_fft-0.4.1-cp310-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
285ca132dab8a5a5ba4522755a12163dbb9384f017b794fe220abd30bd2bc688
|
|
BLAKE2b-256 checksum How to use checksums |
525ebdded60394d5713d413fd3a03303c63457cceedcf8f942ab686e6b5c3403
|
| 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 logSecurity for rocket-fft 0.4.1
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 7 files in this release have been uploaded with provenance metadata.
Attestation for rocket_fft-0.4.1.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 17, 2026.
Transparency logA 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.