FFT & Transforms (vDSP)
AppleAccelerate wraps Apple's vDSP transform functions for FFT, real FFT, DFT, and DCT.
FFT
The FFT API wraps Apple's vDSP FFT functions and follows the same naming conventions as AbstractFFTs.jl. Both 1D vectors and 2D matrices are supported with ComplexF64 and ComplexF32 inputs. A 1D fft/ifft/bfft/rfft/irfft (called without an explicit plan_fft setup) accepts any power-of-two length, plus non-power-of-two lengths of the form f * 2^k with f ∈ {3, 5, 15} — for complex transforms k ≥ 3 (so the smallest such lengths are 24, 40, 120), and for real transforms k ≥ 4. Powers of two use vDSP's fast FFT path, while the mixed-radix lengths transparently use Apple's DFT (see is_supported_fft_length). 2D transforms remain power-of-2 only. Unsupported lengths throw an ArgumentError.
AppleAccelerate's FFT is a direct vDSP binding: 1-D transforms support powers of two plus f * 2^k lengths (f ∈ {3, 5, 15}, with k ≥ 3 for complex and k ≥ 4 for real transforms), while 2-D transforms are power-of-2 only. Only 1-D vectors and 2-D matrices are supported, and it is reached exclusively through the AppleAccelerate. prefix. It does not plug into the AbstractFFTs.jl interface — loading AppleAccelerate never changes what fft/plan_fft do in your session, and will never override FFTW.jl.
For general sizes, 3-D and higher arrays, dimension-selective (region) transforms, or the standard Julia FFT interface, use FFTW.jl. vDSP is mainly competitive at small transform sizes; FFTW is typically faster at larger ones.
Real FFT (rfft, irfft, brfft) is likewise available only through the AppleAccelerate. prefix.
x = randn(ComplexF64, 1024)
# Forward FFT (auto-creates plan)
X = AppleAccelerate.fft(x)
# Normalized inverse FFT
x_recovered = AppleAccelerate.ifft(X)
# Unnormalized inverse (backward) FFT
X_back = AppleAccelerate.bfft(X)
# Reusable plan for repeated transforms of the same size
setup = AppleAccelerate.plan_fft(x)
X = AppleAccelerate.fft(x, setup)
x_recovered = AppleAccelerate.ifft(X, setup)2D FFT works the same way — fft dispatches on the input shape:
x2 = randn(ComplexF64, 16, 32)
X2 = AppleAccelerate.fft(x2)
x2_recovered = AppleAccelerate.ifft(X2)Batched 1D FFT
Passing a dims argument (1 = each column, 2 = each row) computes a batch of independent 1D transforms over a matrix in a single call, like FFTW's fft(A, dims). This wraps vDSP_fftm_zop. The transform length (size(A, dims)) must be a power of 2:
A = randn(ComplexF64, 16, 8)
F = AppleAccelerate.fft(A, 1) # FFT of each column
A1 = AppleAccelerate.ifft(F, 1) # normalized inverse
@assert A1 ≈ AIn-place FFT
In-place variants avoid allocating the output array:
x = randn(ComplexF64, 1024)
y = copy(x)
AppleAccelerate.fft!(y) # forward, modifies y in-place
AppleAccelerate.ifft!(y) # inverse, modifies y in-place
@assert y ≈ xTemp-buffer variants
For repeated transforms of the same size, an FFTWorkspace supplies vDSP with a reusable scratch buffer (the *t vDSP variants), avoiding its internal per-call allocation. Pass it as the last argument to fft/fft!/bfft/ifft (1D, 2D, or batched) and to the real transforms. Results are identical to the non-workspace calls.
x = randn(ComplexF64, 1024)
setup = AppleAccelerate.plan_fft(x)
ws = AppleAccelerate.FFTWorkspace(x)
X = AppleAccelerate.fft(x, setup, ws)
@assert AppleAccelerate.ifft(X, setup, ws) ≈ xAppleAccelerate.plan_fft — Function
plan_fft(x::VecOrMat{Complex{T}}) where T <: Union{Float32, Float64}
plan_fft(n::Integer, [T=Float64], [radix=2])Create a reusable FFT setup object for repeated transforms of the same size. Wraps vDSP_create_fftsetup / vDSP_create_fftsetupD. The setup is automatically destroyed when garbage collected.
AppleAccelerate.fft — Function
fft(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the forward FFT of x via Apple vDSP. Supports 1D vectors and 2D matrices with ComplexF32 or ComplexF64 elements.
For a 1D vector with no explicit setup, non-power-of-2 lengths of the form f * 2^k with f ∈ {3, 5, 15} and k ≥ 3 are also supported and transparently use Apple's mixed-radix DFT (see is_supported_fft_length); an unsupported length throws an ArgumentError. When a setup::FFTSetup is supplied, or for 2D inputs, all dimensions must be powers of 2. If setup is omitted, a temporary plan is created automatically. Wraps vDSP_fft_zop (1D) / vDSP_fft2d_zop (2D).
fft(x::Matrix{Complex{T}}, dims::Integer, [setup::FFTSetup{T}])Batched 1D forward FFT: transform each column (dims = 1) or each row (dims = 2) of x independently, like FFTW's fft(x, dims). The transform length (size(x, dims)) must be a power of 2. Wraps vDSP_fftm_zop.
fft(x, setup::FFTSetup, ws::FFTWorkspace)
fft!(x, setup::FFTSetup, ws::FFTWorkspace)Temp-buffer forward FFT: same as fft/fft! but uses the caller-supplied FFTWorkspace ws as scratch, avoiding vDSP's internal buffer allocation on each call. Applies to 1D vectors and 2D matrices; all dimensions must be powers of 2. Wraps vDSP_fft_zopt / vDSP_fft_zipt (1D) and vDSP_fft2d_zopt / vDSP_fft2d_zipt (2D).
fft(x::Matrix, dims, setup, ws) ; fft!(x::Matrix, dims, setup[, ws])Batched 1D FFT along dims (1 = columns, 2 = rows) with a preallocated FFTWorkspace ws (temp-buffer form) and/or in-place (fft!) operation. See fft. Wraps vDSP_fftm_zip / vDSP_fftm_zipt / vDSP_fftm_zopt.
AppleAccelerate.ifft — Function
ifft(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the normalized inverse FFT of x via Apple vDSP. Equivalent to bfft(x) / length(x). Satisfies ifft(fft(x)) ≈ x.
For a 1D vector with no explicit setup, non-power-of-2 lengths of the form f * 2^k with f ∈ {3, 5, 15} and k ≥ 3 are also supported (via Apple's mixed-radix DFT); an unsupported length throws an ArgumentError. With an explicit setup::FFTSetup, or for 2D inputs, all dimensions must be powers of 2. Wraps vDSP_fft_zop (1D) / vDSP_fft2d_zop (2D).
ifft(x::Matrix{Complex{T}}, dims::Integer, [setup::FFTSetup{T}])Batched 1D normalized inverse FFT along dimension dims (1 = columns, 2 = rows). Satisfies ifft(fft(x, dims), dims) ≈ x. Wraps vDSP_fftm_zop.
ifft(x, setup::FFTSetup, ws::FFTWorkspace)
ifft!(x, setup::FFTSetup, ws::FFTWorkspace)Temp-buffer normalized inverse FFT (see ifft/ifft!), using ws as scratch.
ifft(x::Matrix, dims, setup, ws) ; ifft!(x::Matrix, dims, setup[, ws])Batched normalized inverse FFT along dims, temp-buffer and/or in-place. See ifft.
AppleAccelerate.bfft — Function
bfft(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the unnormalized inverse (backward) FFT of x via Apple vDSP. The result is not divided by length(x); use ifft for the normalized version.
For a 1D vector with no explicit setup, non-power-of-2 lengths of the form f * 2^k with f ∈ {3, 5, 15} and k ≥ 3 are also supported (via Apple's mixed-radix DFT); an unsupported length throws an ArgumentError. With an explicit setup::FFTSetup, or for 2D inputs, all dimensions must be powers of 2. Wraps vDSP_fft_zop (1D) / vDSP_fft2d_zop (2D).
bfft(x::Matrix{Complex{T}}, dims::Integer, [setup::FFTSetup{T}])Batched 1D unnormalized inverse (backward) FFT along dimension dims (1 = columns, 2 = rows). Use ifft for the normalized version. Wraps vDSP_fftm_zop.
bfft(x, setup::FFTSetup, ws::FFTWorkspace)
bfft!(x, setup::FFTSetup, ws::FFTWorkspace)Temp-buffer unnormalized inverse FFT (see bfft/bfft!), using ws as scratch. Wraps the zopt/zipt vDSP variants.
bfft(x::Matrix, dims, setup, ws) ; bfft!(x::Matrix, dims, setup[, ws])Batched unnormalized inverse FFT along dims, temp-buffer and/or in-place. See bfft.
AppleAccelerate.fft! — Function
fft!(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the forward FFT of x in-place via Apple vDSP, overwriting x with the result. Wraps vDSP_fft_zip (1D) / vDSP_fft2d_zip (2D).
AppleAccelerate.ifft! — Function
ifft!(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the normalized inverse FFT of x in-place via Apple vDSP. Satisfies ifft!(fft!(copy(x))) ≈ x. Wraps vDSP_fft_zip (1D) / vDSP_fft2d_zip (2D).
AppleAccelerate.bfft! — Function
bfft!(x::VecOrMat{Complex{T}}, [setup::FFTSetup{T}])Compute the unnormalized inverse FFT of x in-place via Apple vDSP. Wraps vDSP_fft_zip (1D) / vDSP_fft2d_zip (2D).
AppleAccelerate.FFTWorkspace — Type
FFTWorkspace{T}(n::Integer)
FFTWorkspace(x::AbstractArray)Preallocated split-complex scratch buffer for the temp-buffer FFT variants (fft(x, setup, ws), fft!(x, setup, ws), rfft(x, setup, ws), …). Holds two Vector{T} (real/imag parts) of length n. Construct from an array to size it automatically (length(x) elements, which is always sufficient). Reusable across transforms of the same or smaller size.
AppleAccelerate.is_supported_fft_length — Function
is_supported_fft_length(n::Integer) -> BoolReturn true if a 1D complex FFT of length n is supported by Apple vDSP via the idiomatic fft/ifft/bfft API. Supported lengths are any power of two, plus f * 2^k with f ∈ {3, 5, 15} and k ≥ 3 (the smallest such non-power-of-two lengths are 24, 40, and 120).
Real FFT
rfft computes the FFT of real input, returning only the non-redundant complex coefficients (length N÷2+1). irfft inverts it back to real output.
x = randn(Float64, 1024)
X = AppleAccelerate.rfft(x) # Complex vector of length 513
x_recovered = AppleAccelerate.irfft(X, 1024) # Back to real, length 1024
@assert x_recovered ≈ x1D real transforms called without an explicit setup also accept non-power-of-2 lengths of the form f * 2^k with f ∈ {3, 5, 15} and k ≥ 4 (e.g. 48, 160, 240), via Apple's real-input mixed-radix DFT (vDSP_DFT_zrop_CreateSetup).
2D real FFT is supported for power-of-2 dimensions and matches FFTW's rfft layout — an n1×n2 real matrix transforms to an (n1÷2+1)×n2 complex matrix:
x2 = randn(Float64, 16, 32)
X2 = AppleAccelerate.rfft(x2) # 9×32 complex matrix
x2_recovered = AppleAccelerate.irfft(X2, 16) # back to real, 16×32
@assert x2_recovered ≈ x2Batched real FFT (rfft(x, dims) / irfft(X, n, dims)) transforms each column (dims = 1) or row (dims = 2) of a real matrix independently, like FFTW's rfft(x, dims). In-place real variants (rfft!) reuse the input buffer as vDSP's scratch (overwriting it), and workspace variants accept an FFTWorkspace.
AppleAccelerate.plan_rfft — Function
plan_rfft(x::VecOrMat{T}) where T <: Union{Float32, Float64}Create a reusable FFT setup for real-input forward transforms of the same size as x. For a matrix, the setup covers both dimensions (and can also be reused for the matching inverse transforms). Wraps vDSP_create_fftsetup.
AppleAccelerate.rfft — Function
rfft(x::VecOrMat{T}, [setup::FFTSetup{T}])Compute the forward FFT of a real-valued vector or matrix x via Apple vDSP. Returns the non-redundant complex coefficients: length N÷2+1 for a vector of length N, and size (n1÷2+1)×n2 for an n1×n2 matrix (matching FFTW's rfft).
For a 1D vector with no explicit setup, non-power-of-2 lengths supported by Apple's real-input mixed-radix DFT (f * 2^k, f ∈ {3, 5, 15}, k ≥ 4) are also accepted; an unsupported length throws an ArgumentError. With an explicit setup::FFTSetup, or for 2D inputs, all dimensions must be powers of 2. Wraps vDSP_fft_zrop (1D) / vDSP_fft2d_zrop (2D) / vDSP_DFT_zrop_CreateSetup (1D mixed-radix).
rfft(x, setup::FFTSetup, ws::FFTWorkspace)
brfft(X, n, setup::FFTSetup, ws::FFTWorkspace)
irfft(X, n, setup::FFTSetup, ws::FFTWorkspace)Temp-buffer real FFT variants (see rfft/brfft/irfft), using the FFTWorkspace ws as scratch. Available for 1D vectors and 2D matrices; all dimensions must be powers of 2. Wraps vDSP_fft_zropt (1D) / vDSP_fft2d_zropt (2D).
rfft(x::Matrix{T}, dims::Integer, [setup, ws])
rfft!(x::Matrix{T}, dims::Integer, [setup, ws])Batched real forward FFT: transform each column (dims = 1) or row (dims = 2) of the real matrix x independently, like FFTW's rfft(x, dims). Returns the non-redundant complex coefficients ((n÷2+1) along dims). The transform length size(x, dims) must be a power of 2. rfft! operates in-place (overwriting x) using vDSP's in-place real FFT. Passing a FFTWorkspace selects the temp-buffer form. Wraps vDSP_fftm_zrop / vDSP_fftm_zropt / vDSP_fftm_zrip / vDSP_fftm_zript.
AppleAccelerate.rfft! — Function
rfft!(x::Vector{T}, [setup::FFTSetup{T}, [ws::FFTWorkspace{T}]])
rfft!(x::Matrix{T}, setup::FFTSetup{T}, ws::FFTWorkspace{T})In-place real forward FFT: vDSP transforms the packed real data within its own split-complex buffer instead of a separate output buffer, reducing internal buffer use. Returns the non-redundant complex spectrum (length n÷2+1 for a vector, size (n1÷2+1)×n2 for a matrix). The input x is overwritten (used as FFT scratch). Passing a FFTWorkspace selects the temp-buffer form. All dimensions must be powers of 2. Wraps vDSP_fft_zrip / vDSP_fft_zript (1D) / vDSP_fft2d_zript (2D).
AppleAccelerate.irfft — Function
irfft(X::Vector{Complex{T}}, n::Int, [setup::FFTSetup{T}])
irfft(X::Matrix{Complex{T}}, n1::Int, [setup::FFTSetup{T}])Compute the normalized inverse real FFT, returning a real vector of length n or a real matrix of size n1×n2 where n2 = size(X, 2). Satisfies irfft(rfft(x), size(x, 1)) ≈ x.
For a 1D input with no explicit setup, non-power-of-2 lengths supported by Apple's real-input mixed-radix DFT are also accepted (see rfft). Wraps vDSP_fft_zrop (1D) / vDSP_fft2d_zrop (2D).
AppleAccelerate.brfft — Function
brfft(X::Vector{Complex{T}}, n::Int, [setup::FFTSetup{T}])
brfft(X::Matrix{Complex{T}}, n1::Int, [setup::FFTSetup{T}])Compute the unnormalized inverse real FFT, returning a real vector of length n (X must have length n÷2+1) or a real matrix of size n1×n2 where n2 = size(X, 2) (X must have size (n1÷2+1)×n2). The result is not divided by the output length; use irfft for the normalized version.
For a 1D input with no explicit setup, non-power-of-2 lengths supported by Apple's real-input mixed-radix DFT are also accepted (see rfft). Wraps vDSP_fft_zrop (1D) / vDSP_fft2d_zrop (2D).
brfft(X::Matrix{Complex{T}}, n::Integer, dims::Integer, [setup, ws])
irfft(X::Matrix{Complex{T}}, n::Integer, dims::Integer, [setup, ws])Batched inverse real FFT along dims, the inverse of rfft(x, dims). n is the transformed (real) length along dims. brfft is unnormalized; irfft divides by n. X must have n÷2+1 entries along dims. Wraps vDSP_fftm_zrop / vDSP_fftm_zropt.
Small-radix, fixed-size, and interleaved transforms
Beyond the general FFT/DFT paths, vDSP provides specialized complex-transform kernels:
- Radix-3 / radix-5 FFTs (
fftradix3,fftradix5, and their unnormalized inversesbfftradix3/bfftradix5) handle lengths3·2^kand5·2^k— including12,20,24,40, which the mixed-radixfft/dftpath cannot. - Fixed-size 16-/32-point FFTs (
fft16,fft32, inversesbfft16/bfft32) are dedicatedFloat32kernels that need no setup. - Interleaved-complex DFT (
dft_interleaved/idft_interleaved, planned withplan_dft_interleaved) operates directly onVector{Complex}buffers rather than the split-complex layout ofdft.
x = randn(ComplexF64, 12) # 12 = 3·2^2, not an fft() length
@assert AppleAccelerate.bfftradix3(AppleAccelerate.fftradix3(x)) ≈ 12 .* x
y = randn(ComplexF32, 16)
@assert AppleAccelerate.bfft16(AppleAccelerate.fft16(y)) ≈ 16 .* y
z = randn(ComplexF64, 24)
@assert AppleAccelerate.idft_interleaved(AppleAccelerate.dft_interleaved(z)) ≈ zAppleAccelerate.fftradix3 — Function
fftradix3(x::Vector{Complex{T}}) ; bfftradix3(x)
fftradix5(x::Vector{Complex{T}}) ; bfftradix5(x)Radix-3 (length 3·2^k) or radix-5 (length 5·2^k) out-of-place complex FFT. fftradix* is the forward transform; bfftradix* is the unnormalized inverse (so bfftradix3(fftradix3(x)) ≈ length(x) .* x). These cover lengths the mixed-radix DFT path cannot (e.g. 12, 20). Wraps vDSP_fft3_zop / vDSP_fft5_zop.
AppleAccelerate.fftradix5 — Function
fftradix3(x::Vector{Complex{T}}) ; bfftradix3(x)
fftradix5(x::Vector{Complex{T}}) ; bfftradix5(x)Radix-3 (length 3·2^k) or radix-5 (length 5·2^k) out-of-place complex FFT. fftradix* is the forward transform; bfftradix* is the unnormalized inverse (so bfftradix3(fftradix3(x)) ≈ length(x) .* x). These cover lengths the mixed-radix DFT path cannot (e.g. 12, 20). Wraps vDSP_fft3_zop / vDSP_fft5_zop.
AppleAccelerate.fft16 — Function
fft16(x::Vector{ComplexF32}) ; bfft16(x)
fft32(x::Vector{ComplexF32}) ; bfft32(x)Dedicated fixed-size 16-point / 32-point complex FFT (Float32 only, no setup required). fft* is the forward transform, bfft* the unnormalized inverse (bfft16(fft16(x)) ≈ 16 .* x). Wraps vDSP_FFT16_zopv / vDSP_FFT32_zopv.
AppleAccelerate.fft32 — Function
fft16(x::Vector{ComplexF32}) ; bfft16(x)
fft32(x::Vector{ComplexF32}) ; bfft32(x)Dedicated fixed-size 16-point / 32-point complex FFT (Float32 only, no setup required). fft* is the forward transform, bfft* the unnormalized inverse (bfft16(fft16(x)) ≈ 16 .* x). Wraps vDSP_FFT16_zopv / vDSP_FFT32_zopv.
AppleAccelerate.plan_dft_interleaved — Function
plan_dft_interleaved(n::Integer, direction::Integer, ::Type{T}=Float32)Create a reusable interleaved-complex DFT setup of length n and direction (DFT_FORWARD or DFT_INVERSE), for use with dft_interleaved. Throws an ArgumentError for an unsupported length. The setup is freed automatically when garbage-collected. Wraps vDSP_DFT_Interleaved_CreateSetup.
AppleAccelerate.dft_interleaved — Function
dft_interleaved(x::Vector{Complex{T}}, setup::InterleavedDFTSetup{T})
dft_interleaved(x::Vector{Complex{T}}, [direction=DFT_FORWARD])Execute an interleaved-complex DFT on x. With no setup, one is created (and cached) for the length/direction of x. Wraps vDSP_DFT_Interleaved_Execute.
AppleAccelerate.idft_interleaved — Function
idft_interleaved(x::Vector{Complex{T}})Normalized inverse interleaved-complex DFT: dft_interleaved(x, DFT_INVERSE) ./ length(x).
DFT (Complex Discrete Fourier Transform)
Wraps Apple's vDSP_DFT_zop for complex-to-complex DFT. Unlike the FFT functions, DFT supports non-power-of-2 lengths of the form f * 2^n where f ∈ {1, 3, 5, 15} and n ≥ 3. Both Float32 and Float64 are supported.
x = randn(ComplexF64, 120) # 120 = 15 * 2^3, non-power-of-2
# Forward DFT (auto-creates setup)
X = AppleAccelerate.dft(x)
# Normalized inverse DFT
x_recovered = AppleAccelerate.idft(X)
@assert x_recovered ≈ x
# Reusable setup for repeated transforms
setup_fwd = AppleAccelerate.plan_dft(120, AppleAccelerate.DFT_FORWARD, Float64)
setup_inv = AppleAccelerate.plan_dft(120, AppleAccelerate.DFT_INVERSE, Float64)
X = AppleAccelerate.dft(x, setup_fwd)
x_recovered = AppleAccelerate.idft(X, setup_inv)AppleAccelerate.plan_dft — Function
plan_dft(length::Int, direction::Int, ::Type{T}=Float32; previous=C_NULL) where TCreate a DFT setup for complex-to-complex DFT of the given length and direction (DFT_FORWARD or DFT_INVERSE). Length must be f * 2^k where f ∈ {3, 5, 15} and k ≥ 3 (a power of two is also accepted). Optionally pass a previous setup to share underlying data. Wraps vDSP_DFT_zop_CreateSetup.
Returns: DFTSetup{T}
AppleAccelerate.dft — Function
dft(Ir::Vector{T}, Ii::Vector{T}, setup::DFTSetup{T})Execute the complex DFT defined by setup on split-complex input (Ir, Ii). Wraps vDSP_DFT_Execute.
Returns: (Or, Oi) — real and imaginary parts of the output.
dft(X::Vector{Complex{T}}, setup::DFTSetup{T})Execute the complex DFT on an interleaved complex vector. Wraps vDSP_DFT_Execute.
Returns: Vector{Complex{T}}
dft(X::Vector{Complex{T}}, direction::Int) where T
dft(X::Vector{Complex{T}}) where TCompute the DFT of X, auto-creating a setup. Default direction is forward. Wraps vDSP_DFT_Execute.
Returns: Vector{Complex{T}}
AppleAccelerate.idft — Function
idft(X::Vector{Complex{T}}, setup::DFTSetup{T})
idft(X::Vector{Complex{T}})Compute the normalized inverse DFT of X. The setup must have been created with DFT_INVERSE direction. Returns dft(X, setup) ./ length(X). Wraps vDSP_DFT_Execute.
Returns: Vector{Complex{T}}
DCT (Discrete Cosine Transform)
Wraps Apple's vDSP DCT functions. Float32 only. Supports DCT types II, III, and IV.
| Function | Description |
|---|---|
plan_dct | Create a DCT setup object |
dct | Compute the Discrete Cosine Transform |
idct | Compute the inverse Discrete Cosine Transform |
plan_destroy | Destroy a DCT setup object |
AppleAccelerate.plan_dct — Function
plan_dct(length, dct_type, [previous])Create a DCT setup object. dct_type must be 2, 3, or 4 (Type II, III, IV). Length must be f * 2^n where f ∈ {1,3,5,15} and n ≥ 4. Wraps vDSP_DCT_CreateSetup.
AppleAccelerate.dct — Function
dct(X::Vector{Float32}, setup::DFTSetup)
dct(X::Vector{Float32}, [dct_type=2])Compute the Discrete Cosine Transform of X. Wraps vDSP_DCT_Execute.
Apple's Accelerate framework provides only a single-precision DCT (vDSP_DCT_CreateSetup/vDSP_DCT_Execute); there is no Float64 variant (no vDSP_DCT_CreateSetupD/vDSP_DCT_ExecuteD exists in vDSP). Calling dct or idct with a Vector{Float64} therefore throws an ArgumentError. Convert the input to Float32, or use FFTW.jl for a double-precision DCT.
AppleAccelerate.idct — Function
idct(X::Vector{Float32})Compute the inverse of the (unnormalized) DCT-II computed by dct, so that idct(dct(x)) ≈ x. Uses the DCT-II/DCT-III duality: vDSP's DCT-III applied to a DCT-II spectrum reproduces the input scaled by N/2, so this returns dct(X, 3) .* (2/N). Wraps vDSP_DCT_Execute.
Not available for Float64 inputs: see the note in dct.
AppleAccelerate.plan_destroy — Function
plan_destroy(setup::DFTSetup)Destroy a DCT/DFT setup object, freeing its resources. Wraps vDSP_DFT_DestroySetup.