FFT R2R

Immersa.fft_r2r.plan_r2r!Function
plan_r2r!(A, args...; kw...)

Create a plan for a real-to-real (R2R) FFT on array A.

This function:

  • Chooses the appropriate backend (CPU/GPU) automatically.
  • Delegates to _plan_r2r! for backend-specific planning.

Arguments

  • A: the array to transform.
  • args...: FFTW-compatible transform arguments (e.g., type of R2R transform).
  • kw...: optional keyword arguments.

Returns

A plan object that can be used with mul!(y, plan, x) to apply the transform efficiently.

Notes

  • On CPU, uses FFTW.plan_r2r! with multithreading.
  • If the requested transform is not natively supported, a fallback plan (e.g., RODFT00, REDFT10) is created automatically.
source
Immersa.fft_r2r._plan_r2r!Function
_plan_r2r!(::CPU, args...; kw...)

CPU backend: delegates to FFTW.plan_r2r! with multithreading enabled.

source
_plan_r2r!(dev, A, kind, args...; kw...)

Non-CPU fallback: builds an emulated R2R plan via bad_plan_r2r! using per-dimension Val-wrapped transform kinds.

source
Immersa.fft_r2r.R2RType
R2R{P<:Tuple}

Container holding a tuple of 1-D R2R FFT plans, one per spatial dimension. Used as the return type of bad_plan_r2r! for multi-dimensional transforms.

Fields

  • p::P : Tuple of per-dimension FFT plans.
source
Immersa.fft_r2r.bad_plan_r2r!Function
bad_plan_r2r(A, args...; kw...)

Internal helper to create multi-dimensional R2R FFT plans.

Returns

Returns a container (R2R) holding 1D FFT plans for each dimension.

source
bad_plan_r2r!(A, ::Val{FFTW.RODFT00}, dims; kw...)

Creates a plan for a type-I sine transform (RODFT00) along dimension dims of array A. Internally, it allocates staging arrays and builds an RFFT plan that emulates the desired R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.RODFT00}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_rfft

Returns

  • RODFT00 object containing the plan and internal arrays
source
bad_plan_r2r!(A, ::Val{FFTW.REDFT10}, dims; kw...)

Creates a plan for a type-II cosine transform (REDFT10) along dimension dims of array A. Internally, it allocates staging arrays and builds an RFFT plan that emulates the R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.REDFT10}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_rfft

Returns

  • REDFT10 object containing the plan and internal arrays
source
bad_plan_r2r!(A, ::Val{FFTW.REDFT01}, dims; kw...)

Creates a plan for a type-III cosine transform (REDFT01) along dimension dims of array A. Internally, it allocates staging arrays and builds an FFT plan that emulates the R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.REDFT01}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_fft

Returns

  • REDFT01 object containing the plan and internal arrays
source
LinearAlgebra.mul!Method
LinearAlgebra.mul!(y, (; p), x)

Applies a multi-dimensional R2R FFT plan to an array x and stores the result in y. This overload of LinearAlgebra.mul! runs each 1D plan sequentially.

source
Immersa.fft_r2r.RODFT00Type
RODFT00{P,A,B}

Represents a type-I sine transform (FFTW's RODFT00) along a specific dimension.

Fields

  • dims: dimension of the transform,
  • p: the FFT plan,
  • a, b: internal arrays for staging data.
source
Immersa.fft_r2r.bad_plan_r2r!Method
bad_plan_r2r!(A, ::Val{FFTW.RODFT00}, dims; kw...)

Creates a plan for a type-I sine transform (RODFT00) along dimension dims of array A. Internally, it allocates staging arrays and builds an RFFT plan that emulates the desired R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.RODFT00}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_rfft

Returns

  • RODFT00 object containing the plan and internal arrays
source
LinearAlgebra.mul!Method
LinearAlgebra.mul!(y, (; dims, p, a, b)::RODFT00, x)

Applies a type-I sine transform (RODFT00) along the specified dimension dims. Stages x into internal array a, applies the FFT plan p to get b, and writes the processed result into y.

source
Immersa.fft_r2r.REDFT10Type
REDFT10{P,A,B}

Represents a type-II cosine transform (FFTW's REDFT10) along a specific dimension.

Fields

  • dims: dimension of the transform,
  • p: the FFT plan,
  • a, b: internal arrays for staging data.
source
Immersa.fft_r2r.bad_plan_r2r!Method
bad_plan_r2r!(A, ::Val{FFTW.REDFT10}, dims; kw...)

Creates a plan for a type-II cosine transform (REDFT10) along dimension dims of array A. Internally, it allocates staging arrays and builds an RFFT plan that emulates the R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.REDFT10}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_rfft

Returns

  • REDFT10 object containing the plan and internal arrays
source
LinearAlgebra.mul!Method
LinearAlgebra.mul!(y, (; dims, p, a, b)::REDFT10, x)

Applies a type-II cosine transform (REDFT10) along dimension dims. Mirrors x, applies FFT plan p, then multiplies by a phase factor to match the transform formula.

source
Immersa.fft_r2r.REDFT01Type
REDFT01{P,A,B}

Represents a type-III cosine transform (FFTW's REDFT01) along a specific dimension.

Fields

  • dims: dimension of the transform,
  • p: the FFT plan,
  • a, b: internal arrays for staging data.
source
Immersa.fft_r2r.bad_plan_r2r!Method
bad_plan_r2r!(A, ::Val{FFTW.REDFT01}, dims; kw...)

Creates a plan for a type-III cosine transform (REDFT01) along dimension dims of array A. Internally, it allocates staging arrays and builds an FFT plan that emulates the R2R transform.

Arguments

  • A: input array
  • ::Val{FFTW.REDFT01}: indicates the transform type
  • dims: the dimension along which to apply the transform
  • kw...: keyword arguments forwarded to plan_fft

Returns

  • REDFT01 object containing the plan and internal arrays
source
LinearAlgebra.mul!Method
LinearAlgebra.mul!(y, (; dims, p, a, b)::REDFT01, x)

Applies a type-III cosine transform (REDFT01) along dimension dims. Pre-multiplies x by a phase factor, applies FFT plan p, and extracts the processed result into y.

source