RustFFT Documentation
Compute FFTs in Julia using RustFFT. Some parts of this documentation have been quoted from the RustFFT docs.
RustFFT is a high-performance, SIMD-accelerated FFT library written in pure Rust. It can compute FFTs of any size, including prime-number sizes, in O(nlogn) time.
Usage
RustFFT.jl implements the generic FFT interface of AbstractFFTs.jl but only supports one-dimensional, contiguous, complex-valued arrays: Vector{ComplexF64} and Vector{ComplexF32}.
Forward and inverse FFT:
using RustFFT
data = ones(ComplexF64, 1)
fft!(data)using RustFFT
data = ones(ComplexF64, 1)
ifft!(data)You can set several options by planning the FFT:
using RustFFT
planner = new_planner(ComplexF64)
data = ones(ComplexF64, 1)
plan = plan_fft!(data;
rustfft_checks=IgnoreArrayChecks(), # Don't track the array or check if its length is compatible
rustfft_gcsafe=GcSafe(), # Don't block the GC while an FFT is computed with this plan
rustfft_planner=planner) # Reuse an existing planner
plan * dataIt's currently not possible to choose the specific algorithm that will be used to compute the transform.
RustFFT-specific API
RustFFT.AllArrayChecks — TypeAllArrayChecks()Track the array and check if the length is compatible with the plan. This is the default.
RustFFT.ArrayChecks — TypeArrayChecksSafety checks that can be disabled.
RustFFT.Backward — TypeBackward()The plan computes a backward FFT.
RustFFT.Direction — TypeDirectionThe direction of the plan.
RustFFT.Forward — TypeForward()The plan computes a forward FFT.
RustFFT.GcSafe — TypeGcSafe()A GC-safe plan doesn't block the GC.
RustFFT.GcSafety — TypeGcSafetyWhether or not a planned FFT is executed in a GC-safe state.
RustFFT.GcUnsafe — TypeGcUnsafe()A GC-unsafe plan can block the GC. This is the default.
RustFFT.IgnoreArrayChecks — TypeIgnoreArrayChecks()Perform no safety checks.
RustFFT.IgnoreArrayTracking — TypeIgnoreArrayTracking()Only check if the length is compatible with the plan.
RustFFT.new_planner — Functionnew_planner(::Type{ComplexF32})
new_planner(::Type{ComplexF64})Returns a new planner. By default each plan creates a new planner but one can also be provided to the plan_*-functions as a keyword argument: rustfft_planner. By reusing the same planner, internal data is reused across different plans saving memory and setup time.
Internals
RustFFT.Internal.FftInstance — Type FftInstance{T}An instance of a plan to compute an FFT in some direction.
RustFFT.Internal.FftPlanner — Type FftPlanner{T}A planner for forward and inverse FFTs of Vector{T}, T must be ComplexF32 or ComplexF64. A new planner can be created by calling the zero-argument constructor. The aliases FftPlanner32 and FftPlanner64 are also available.
RustFFT.Internal.FftPlanner32 — Type FftPlanner32A planner for single-precision complex data.
RustFFT.Internal.FftPlanner64 — Type FftPlanner64A planner for double-precision complex data.
RustFFT.Internal.rustfft_fft! — Function rustfft_fft!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place. If the array is already tracked or the length is incompatible JlrsCore.JlrsError is thrown.
RustFFT.Internal.rustfft_fft_gcsafe! — Function rustfft_fft_gcsafe!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place. If buffer is already tracked or its length is incompatible JlrsCore.JlrsError is thrown. The GC is allowed to collect while this function is called.
RustFFT.Internal.rustfft_fft_unchecked! — Function rustfft_fft_unchecked!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place.
RustFFT.Internal.rustfft_fft_unchecked_gcsafe! — Function rustfft_fft_unchecked_gcsafe!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place. The GC is allowed to collect while this function is called.
RustFFT.Internal.rustfft_fft_untracked! — Function rustfft_fft_untracked!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place. If the length of buffer is incompatible JlrsCore.JlrsError is thrown.
RustFFT.Internal.rustfft_fft_untracked_gcsafe! — Function rustfft_fft_untracked_gcsafe!(instance::FftInstance{T}, buffer::Vector{T})Computes the planned FFT if buffer in-place. If the length of buffer is incompatible JlrsCore.JlrsError is thrown. The GC is allowed to collect while this function is called.
RustFFT.Internal.rustfft_plan_fft_forward! — Function rustfft_plan_fft_forward!(planner::FftPlanner{T}, len::UInt)Plan a forward FFT for Vector{T} data of length len. If the planner is already tracked JlrsCore.BorrowError is thrown.
RustFFT.Internal.rustfft_plan_fft_forward_untracked! — Function rustfft_plan_fft_forward_untracked!(planner::FftPlanner{T}, len::UInt)Plan a forward FFT for Vector{T} data of length len without tracking the planner.
RustFFT.Internal.rustfft_plan_fft_inverse! — Function rustfft_plan_fft_inverse!(planner::FftPlanner{T}, len::UInt)Plan an inverse FFT for Vector{T} data of length len. If the planner is already tracked JlrsCore.BorrowError is thrown.
RustFFT.Internal.rustfft_plan_fft_inverse_untracked! — Function rustfft_plan_fft_inverse_untracked!(planner::FftPlanner{T}, len::UInt)Plan an inverse FFT for Vector{T} data of length len without tracking the planner.
RustFFT.Internal.rustfft_plan_size — Function rustfft_plan_size(instance::FftInstance{T})The length of the vector that can be transformed with plan.