dft#
- ivy.dft(x, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', out=None)[source]#
Compute the discrete Fourier transform of input.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Input volume […,d_in,…], where d_in indicates the dimension that needs FFT.axis (
int
) – The axis on which to perform the DFT. By default this (default:1
) value is set to 1, which corresponds to the first dimension after the batch index.inverse (
bool
) – Whether to perform the inverse discrete fourier transform. (default:False
) By default this value is set to False.onesided (
bool
) – If onesided is True, only values for w in [0, 1, 2, …, floor(n_fft/2) + 1] (default:False
) are returned because the real-to-complex Fourier transform satisfies the conjugate symmetry, i.e., X[m, w] = X[m,w]=X[m,n_fft-w]*. Note if the input or window tensors are complex, then onesided output is not possible. Enabling onesided with real inputs performs a Real-valued fast Fourier transform (RFFT). When invoked with real or complex valued input, the default value is False. Values can be True or False.dft_length (
Optional
[Union
[int
,Tuple
[int
]]]) – The length of the signal.If greater than the axis dimension, (default:None
) the signal will be zero-padded up to dft_length. If less than the axis dimension, only the first dft_length values will be used as the signal. It’s an optional value.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.out (
Optional
[Array
]) – Optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
- Returns:
ret – The Fourier Transform of the input vector.If onesided is False, the following shape is expected: [batch_idx][signal_dim1][signal_dim2] …[signal_dimN][2]. If axis=0 and onesided is True, the following shape is expected: [batch_idx][floor(signal_dim1/2)+1][signal_dim2]…[signal_dimN][2]. If axis=1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][floor(signal_dim2/2)+1]…[signal_dimN][2]. If axis=N-1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][signal_dim2]…[floor(signal_dimN/2)+1][2]. The signal_dim at the specified axis is equal to the dft_length.
- Array.dft(self, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', out=None)#
Compute the discrete Fourier transform of input.
- Parameters:
self – Input volume […,d_in,…], where d_in indicates the dimension that needs FFT.
axis (
int
) – The axis on which to perform the DFT. By default this (default:1
) value is set to 1, which corresponds to the first dimension after the batch index.inverse (
bool
) – Whether to perform the inverse discrete fourier transform. (default:False
) By default this value is set to False.onesided (
bool
) – If onesided is True, only values for w in [0, 1, 2, …, floor(n_fft/2) + 1] (default:False
) are returned because the real-to-complex Fourier transform satisfies the conjugate symmetry, i.e., X[m, w] = X[m,w]=X[m,n_fft-w]*. Note if the input or window tensors are complex, then onesided output is not possible. Enabling onesided with real inputs performs a Real-valued fast Fourier transform (RFFT). When invoked with real or complex valued input, the default value is False. Values can be True or False.dft_length (
Optional
[Union
[int
,Tuple
[int
]]]) – The length of the signal.If greater than the axis dimension, (default:None
) the signal will be zero-padded up to dft_length. If less than the axis dimension, only the first dft_length values will be used as the signal. It’s an optional value.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.out (
Optional
[Array
]) – Optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Array
- Returns:
ret – The Fourier Transform of the input vector.If onesided is False, the following shape is expected: [batch_idx][signal_dim1][signal_dim2] …[signal_dimN][2]. If axis=0 and onesided is True, the following shape is expected: [batch_idx][floor(signal_dim1/2)+1][signal_dim2] …[signal_dimN][2]. If axis=1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1] [floor(signal_dim2/2)+1] …[signal_dimN][2]. If axis=N-1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][signal_dim2]… [floor(signal_dimN/2)+1][2]. The signal_dim at the specified axis is equal to the dft_length.
- Container.dft(self, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
- Parameters:
axis (
int
) – (default:1
)inverse (
bool
) – (default:False
)onesided (
bool
) – (default:False
)dft_length (
Optional
[Union
[int
,Tuple
[int
]]]) – (default:None
)norm (
str
) – (default:'backward'
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – (default:None
)to_apply (
bool
) – (default:True
)prune_unapplied (
bool
) – (default:False
)map_sequences (
bool
) – (default:False
)out (
Optional
[Array
]) – (default:None
)
- Return type:
Container