This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / fftpack / _basic / irfft

function

scipy.fftpack._basic:irfft

source: build-install/usr/lib/python3.14/site-packages/scipy/fftpack/_basic.py:208

Signature

def irfft(x, n = None, axis = -1, overwrite_x = False)

Summary

Return inverse discrete Fourier transform of real sequence x.

Extended Summary

The contents of x are interpreted as the output of the rfft function.

Parameters

x : array_like

Transformed data to invert.

n : int, optional

Length of the inverse Fourier transform. If n < x.shape[axis], x is truncated. If n > x.shape[axis], x is zero-padded. The default results in n = x.shape[axis].

axis : int, optional

Axis along which the ifft's are computed; the default is over the last axis (i.e., axis=-1).

overwrite_x : bool, optional

If True, the contents of x can be destroyed; the default is False.

Returns

irfft : ndarray of floats

The inverse discrete Fourier transform.

Notes

The returned real array contains

[y(0),y(1),...,y(n-1)]

where for n is even

y(j) = 1/n (sum[k=1..n/2-1] (x[2*k-1]+sqrt(-1)*x[2*k])
                             * exp(sqrt(-1)*j*k* 2*pi/n)
            + c.c. + x[0] + (-1)**(j) x[n-1])

and for n is odd

y(j) = 1/n (sum[k=1..(n-1)/2] (x[2*k-1]+sqrt(-1)*x[2*k])
                             * exp(sqrt(-1)*j*k* 2*pi/n)
            + c.c. + x[0])

c.c. denotes complex conjugate of preceding expression.

For details on input parameters, see rfft.

To process (conjugate-symmetric) frequency-domain data with a complex datatype, consider using the newer function scipy.fft.irfft.

Examples

from scipy.fftpack import rfft, irfft
a = [1.0, 2.0, 3.0, 4.0, 5.0]
✓
irfft(a)
✗
array([ 2.6 , -3.16,  1.24, -1.15,  1.47])
irfft(rfft(a))
✓
array([1., 2., 3., 4., 5.])

See also

ifft
rfft
scipy.fft.irfft

Aliases

  • scipy.fftpack.irfft