bundles / scipy latest / scipy / fftpack / _basic / rfft
function
scipy.fftpack._basic:rfft
source: /scipy/fftpack/_basic.py :147
Signature
def rfft ( x , n = None , axis = -1 , overwrite_x = False ) Summary
Discrete Fourier transform of a real sequence.
Parameters
x: array_like, real-valuedThe data to transform.
n: int, optionalDefines the length of the Fourier transform. If
nis not specified (the default) thenn = x.shape[axis]. Ifn < x.shape[axis],xis truncated, ifn > x.shape[axis],xis zero-padded.axis: int, optionalThe axis along which the transform is applied. The default is the last axis.
overwrite_x: bool, optionalIf set to true, the contents of
xcan be overwritten. Default is False.
Returns
z: real ndarrayThe returned real array contains
[y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2))] if n is even [y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2)),Im(y(n/2))] if n is odd
where
y(j) = sum[k=0..n-1] x[k] * exp(-sqrt(-1)*j*k*2*pi/n) j = 0..n-1
Notes
Within numerical accuracy, y == rfft(irfft(y)).
Both single and double precision routines are implemented. Half precision inputs will be converted to single precision. Non-floating-point inputs will be converted to double precision. Long-double precision inputs are not supported.
To get an output with a complex datatype, consider using the newer function scipy.fft.rfft.
Examples
from scipy.fftpack import fft, rfft a = [9, -9, 1, 3]✓
fft(a) rfft(a)✗
See also
- fft
- irfft
- scipy.fft.rfft
Aliases
-
scipy.fftpack.rfft