Discrete Fourier Transform
dftn
- udft.dftn(inarray, ndim=None)
ND unitary discrete Fourier transform.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.ndim (
int|None) – The ndim last axes along which to compute the transform. All axes by default.
- Returns:
outarray – The DFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
idftn
- udft.idftn(inarray, ndim=None)
ND unitary inverse discrete Fourier transform.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.ndim (
int|None) – The ndim last axes along wich to compute the transform. All axes by default.
- Returns:
outarray – The IDFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
dft
- udft.dft(inarray)
1D unitary discrete Fourier transform.
Compute the unitary DFT on the last axis.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The DFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
idft
- udft.idft(inarray)
1D unitary inverse discrete Fourier transform.
Compute the unitary inverse DFT transform on the last axis.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The IDFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
dft2
- udft.dft2(inarray)
2D unitary discrete Fourier transform.
Compute the unitary DFT on the last 2 axes.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The DFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
idft2
- udft.idft2(inarray)
2D unitary inverse discrete Fourier transform.
Compute the unitary IDFT on the last 2 axes.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The IDFT of inarray with same shape.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
Real Discrete Fourier Transform
The transforms here suppose input of real values. In direct transform, the last
transformed axis has length N // 2 + 1.
Note
The exact output shape for real transform can’t be guessed from input shape.
Therefor, only one inverse transform irdftn() is provided and that
function ask for the output shape. The dimension ndim corresponds to the
length of shape.
rdftn
- udft.rdftn(inarray, ndim=None)
ND real unitary discrete Fourier transform.
Consider the Hermitian property of output with input having real values.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array of real values to transform.ndim (
int|None) – The ndim last axes along which to compute the transform. All axes by default.
- Returns:
outarray – The real DFT of inarray (the last axe as N // 2 + 1 length).
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
irdftn
- udft.irdftn(inarray, shape)
ND real unitary inverse discrete Fourier transform.
Consider the Hermitian property of input and return real values.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array of complex values to transform.shape (
tuple[int,...]) – The output shape of the len(shape) last axes. The transform is applied on the n=len(shape) axes.
- Returns:
outarray – The real IDFT of inarray.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
rdft
- udft.rdft(inarray)
1D real unitary discrete Fourier transform.
Compute the unitary real DFT on the last axis. Consider the Hermitian property of output with input having real values.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The real DFT of inarray, where the last dim has length N//2+1.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
rdft2
- udft.rdft2(inarray)
2D real unitary discrete Fourier transform.
Compute the unitary real DFT on the last 2 axes. Consider the Hermitian property of output when input has real values.
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The array to transform.- Returns:
outarray – The real DFT of inarray, where the last dim has length N//2+1.
- Return type:
TypeVar(Array, bound=ArrayLike)
Notes
For NumPy arrays, scipy.fft is used when available (enabling multithreading); for other array types, the FFT is dispatched through the array library’s namespace.
Other
hnorm
- udft.hnorm(inarray, inshape)
Hermitian l2-norm of array in discrete Fourier space.
Compute the l2-norm of complex array
\[\|x\|_2 = \sqrt{\sum_{n=1}^{N} |x_n|^2}\]considering the Hermitian property. Must be used with rdftn. Equivalent of np.linalg.norm for array applied on full Fourier space array (those obtained with dftn).
- Parameters:
inarray (
TypeVar(Array, bound=ArrayLike)) – The input array with half of the Fourier plan.inshape (
tuple[int,...]) – The shape of the original array oarr where inarray=rdft(oarr).
- Returns:
norm
- Return type:
TypeVar(Array, bound=ArrayLike)
crandn
- udft.crandn(shape, like=None)
Draw from white complex Normal.
Draw unitary DFT of real white Gaussian field of zero mean and unit variance. Does not consider hermitian property, shape is implicity supposed to be half of the frequency plane already or the full plane if the hermitian property is not present.
- Return type:
TypeVar(Array, bound=ArrayLike)