ifft — Compute inverse discrete Fourier transforms in MATLAB and RunMat.
ifft(X) computes the inverse discrete Fourier transform of X. By default it operates along the first non-singleton dimension, with optional length, dimension, and symmetry forms following MATLAB semantics. Documented integer data through 32 bits produces double output. Host int64 and uint64 data and wide typed controls are exactness-checked RunMat extensions.
Syntax
Y = ifft(X)
Y = ifft(X, N)
Y = ifft(X, symflag)
Y = ifft(X, N, DIM)
Y = ifft(X, N, symflag)
Y = ifft(X, N, DIM, symflag)Inputs
X- Type
Any- Required
- Yes
- Description
- Input spectrum or signal.
N- Type
NumericScalar- Required
- No
- Default
[]- Description
- Transform length along selected dimension.
symflag- Type
StringScalar- Required
- No
- Default
"nonsymmetric"- Description
- Symmetry flag: "symmetric" or "nonsymmetric".
DIM- Type
NumericScalar- Required
- No
- Default
first non-singleton dimension- Description
- Dimension to transform along.
Returns
Y- Type
NumericArray- Description
- Inverse FFT result.
Errors
RunMat:ifft:ArgCount- When
- More than four input arguments are supplied.
- Message
ifft: invalid argument count
RunMat:ifft:InvalidLength- When
- Length argument N is invalid.
- Message
ifft: invalid length argument
RunMat:ifft:InvalidDimension- When
- Dimension argument DIM is invalid.
- Message
ifft: invalid dimension argument
Provider and fusion contract
The provider hook advertises f32 and f64 floating precision with MATLAB-style input shape semantics; integer and logical behavior follows the separate documented conversion or exact-reordering rules.
This operation is a fusion boundary, not an elementwise or reduction kernel. No fused FFT kernel is advertised, and provider launch details remain internal.
Behavior
ifft(X) transforms along the first dimension whose size is greater than 1.
ifft(X, N) zero-pads or truncates X to length N before applying the transform.
ifft(X, N, DIM) applies the transform along dimension DIM.
ifft(X, [], DIM) keeps the existing length and transforms along dimension DIM.
ifft(..., 'symmetric') forces the output to be real-valued, mirroring MATLAB's handling of conjugate-symmetric spectra.
ifft(..., 'nonsymmetric') keeps the default complex result; it is equivalent to omitting the symmetry flag but is accepted for MATLAB compatibility.
Documented integer data (int8 through int32 and uint8 through uint32) crosses once into the double transform domain and returns double numeric class; the symmetry flag changes complexity, not numeric class.
Host int64 and uint64 data is available only in RunMat extension mode and must be exactly representable as double. Resident wide-integer data rejects before gather because no exact provider transform is available.
Typed int64 and uint64 length or dimension controls are independently gated RunMat extensions and are parsed from exact integer storage.
Empty inputs and dimensions larger than the rank of X mirror MATLAB behaviour.
GPU execution
Uses the input handle's owning provider. A supported inverse-FFT hook returns a validated resident complex result. Symmetric output and unsupported-hook fallback may compute through an internal exact download; the result is restored to the owner only when that provider can preserve its numeric class.
GPU residency
RunMat resolves execution and fallback through the provider that owns the input handle. Internal downloads do not change the source handle's class metadata. Host fallback results return to the owner only when its physical precision preserves the required output class; documented integer and logical inputs therefore remain double host results on an F32-only owner.
GPU behavior
For floating input, RunMat asks the input owner for ifft_dim and accepts only a fresh, nonaliased output with the expected device, shape, complex storage, precision, and ownership. Provider execution or contract failures are terminal; only the exact unsupported-hook response selects host fallback.
The symmetric form safely downloads the validated inverse-FFT result, extracts the real component in its native class, and restores a fresh real handle when the owner preserves that class. This avoids relying on provider-specific physical complex-buffer shapes.
Zero-length, logical, and documented resident integer inputs use the exact host transform path. F32 floating inputs preserve single precision; integer and logical inputs produce double output and stay on the host when an F32-only provider cannot represent that class.
Examples
Reconstructing a time-domain signal from FFT bins
Y = [10 -2+2i -2 -2-2i];
x = ifft(Y)Expected output:
x =
Columns 1 through 4
1 2 3 4Computing ifft along a specific dimension
F = [10 14 18;
-3+3i -3+3i -3+3i];
X = ifft(F, [], 1)Zero-padding the inverse transform
F = [4 0 0 0];
x = ifft(F, 8)Enforcing a real result with 'symmetric'
F = fft([1 2 3 4]);
x = ifft(F, 'symmetric')Running ifft on gpuArray inputs
G = gpuArray(fft([1 0 0 0]));
X = ifft(G);
result = gather(X)Using ifft with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how ifft changes the result.
Run a small ifft example, explain the result, then change one input and compare the output.
FAQ
Does ifft always return complex values?⌄
By default, yes. The 'symmetric' flag converts the result to a real array when the spectrum is conjugate-symmetric. You can also pass 'nonsymmetric' to state this default explicitly while keeping the complex result.
How does ifft scale the result?⌄
RunMat divides by the transform length so that ifft(fft(x)) reproduces x, matching MATLAB.
Can I omit the length but specify a dimension?⌄
Yes. Use an empty array for the length: ifft(X, [], DIM).
What happens if I request a zero length?⌄
You receive an empty array along the selected dimension, mirroring MATLAB behaviour.
Does 'symmetric' validate conjugate symmetry?⌄
No. Like MATLAB, RunMat assumes the spectrum is conjugate-symmetric and simply discards imaginary components.
Will RunMat run the inverse FFT on the GPU automatically?⌄
When the input owner exposes a compatible ifft_dim kernel, nonsymmetric results remain resident after provider metadata and ownership validation. Unsupported hooks fall back through an internal owner download. RunMat restores the result to that owner when its physical precision matches the required output class; otherwise it returns the correctly typed host result instead of relabeling lower-precision storage.
How do I perform multi-dimensional inverse transforms?⌄
Apply ifft sequentially along each dimension (e.g., ifft(ifft(X, [], 1), [], 2)).
Related Math functions
Elementwise
abs · angle · besselj · bsxfun · complex · conj · double · eps · erf · erfcinv · exp · expm1 · flintmax · gamma · gammaln · heaviside · hypot · imag · int16 · int32 · int64 · int8 · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · times · typecast · uint16 · uint32 · uint64 · uint8
Optim
acceptancesa · annealingboltz · annealingfast · coneprog · crossoverarithmetic · crossoverheuristic · crossoverintermediate · crossoverlaplace · crossoverscattered · crossoversinglepoint · crossovertwopoint · eqnproblem · EquationProblem.solve · EquationProblem.subsasgn · EquationProblem.subsref · evaluate · fgoalattain · fitscalingprop · fitscalingrank · fitscalingshiftlinear · fitscalingtop · fminbnd · fmincon · fminimax · fminsearch · fminunc · fseminf · fsolve · fzero · ga · gacreationlinearfeasible · gacreationnonlinearfeasible · gacreationsobol · gacreationuniform · gacreationuniformint · gaplotbestf · gaplotbestindiv · gaplotdistance · gaplotexpectation · gaplotgenealogy · gaplotmaxconstr · gaplotrange · gaplotscorediversity · gaplotscores · gaplotselection · gaplotstopping · integerConstraint · integral · intlinprog · linprog · lsqcurvefit · lsqlin · LsqlinWarmStart.subsasgn · LsqlinWarmStart.subsref · lsqnonlin · lsqnonneg · mutationadaptfeasible · mutationgaussian · mutationpositivebasis · mutationpower · mutationuniform · optimexpr · optimget · OptimizationConstraint.evaluate · OptimizationConstraint.subsasgn · OptimizationConstraint.subsref · OptimizationExitflag.double · OptimizationExitflag.eq · OptimizationExitflag.ne · OptimizationExitflag.string · OptimizationExpression.acos · OptimizationExpression.acosh · OptimizationExpression.acot · OptimizationExpression.acoth · OptimizationExpression.acsc · OptimizationExpression.acsch · OptimizationExpression.asec · OptimizationExpression.asech · OptimizationExpression.asin · OptimizationExpression.asinh · OptimizationExpression.atan · OptimizationExpression.atanh · OptimizationExpression.cat · OptimizationExpression.cos · OptimizationExpression.cosh · OptimizationExpression.cot · OptimizationExpression.coth · OptimizationExpression.csc · OptimizationExpression.csch · OptimizationExpression.ctranspose · OptimizationExpression.cumprod · OptimizationExpression.cumsum · OptimizationExpression.diag · OptimizationExpression.diff · OptimizationExpression.dot · OptimizationExpression.eq · OptimizationExpression.evaluate · OptimizationExpression.exp · OptimizationExpression.ge · OptimizationExpression.horzcat · OptimizationExpression.ldivide · OptimizationExpression.le · OptimizationExpression.log · OptimizationExpression.mean · OptimizationExpression.minus · OptimizationExpression.mldivide · OptimizationExpression.mpower · OptimizationExpression.mrdivide · OptimizationExpression.mtimes · OptimizationExpression.norm · OptimizationExpression.plus · OptimizationExpression.power · OptimizationExpression.prod · OptimizationExpression.rdivide · OptimizationExpression.reshape · OptimizationExpression.sec · OptimizationExpression.sech · OptimizationExpression.sin · OptimizationExpression.sinh · OptimizationExpression.sqrt · OptimizationExpression.subsasgn · OptimizationExpression.subsref · OptimizationExpression.sum · OptimizationExpression.tan · OptimizationExpression.tanh · OptimizationExpression.times · OptimizationExpression.trace · OptimizationExpression.transpose · OptimizationExpression.uminus · OptimizationExpression.uplus · OptimizationExpression.vertcat · OptimizationExpression.zeros · OptimizationExpression.zerosLike · OptimizationProblem.solve · OptimizationProblem.subsasgn · OptimizationProblem.subsref · OptimizationVariable.subsasgn · OptimizationVariable.subsref · optimoptions · optimplotconstrviolation · optimplotfirstorderopt · optimplotfunccount · optimplotfval · optimplotfvalconstr · optimplotmilp · optimplotstepsize · optimplotx · optimproblem · optimset · optimvar · optimwarmstart · particleswarm · patternsearch · psplotbestf · psplotbestx · psplotfuncount · psplotmaxconstr · psplotmeshsize · pswcreationuniform · pswplotbestf · quad · quadprog · QuadprogWarmStart.subsasgn · QuadprogWarmStart.subsref · saplotbestf · saplotbestx · saplotf · saplotstopping · saplottemperature · saplotx · savemilpsolutions · secondordercone · selectionremainder · selectionroulette · selectionstochunif · selectiontournament · selectionuniform · simulannealbnd · solve · surrogateopt · surrogateoptplot · temperatureboltz · temperatureexp · temperaturefast
Trigonometry
acos · acosd · acosh · acotd · acscd · asecd · asin · asind · asinh · atan · atan2 · atan2d · atand · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh
Reduction
all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var
Structure
bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm
Signal
blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · hilbert · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane
Factor
chol · decomposition · decomposition.ctranspose · decomposition.mldivide · decomposition.mrdivide · decomposition.mtimes · decomposition.rdivide · decomposition.subsref · decomposition.times · decomposition.uminus · decomposition.uplus · eig · eigs · gmres · ichol · ilu · lu · ordeig · ordqz · ordschur · pcg · qr · qz · rsf2csf · schur · svd
Ops
cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose
Interpolation
griddedInterpolant · griddedInterpolant.subsref · interp1 · interp1q · interp2 · pchip · ppval · spline
Integer Division
Source you can read
Every RunMat function's source is public. Read exactly how ifft is executed, line by line, in Rust.
- View the source for ifft in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.