MCPcopy Create free account
hub / github.com/numpy/numpy / rfftn

Function rfftn

numpy/fft/_pocketfft.py:1111–1205  ·  view source on GitHub ↗

Compute the N-dimensional discrete Fourier Transform for real input. This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional real array by means of the Fast Fourier Transform (FFT). By default, all axes are transformed, with

(a, s=None, axes=None, norm=None)

Source from the content-addressed store, hash-verified

1109
1110@array_function_dispatch(_fftn_dispatcher)
1111def rfftn(a, s=None, axes=None, norm=None):
1112 """
1113 Compute the N-dimensional discrete Fourier Transform for real input.
1114
1115 This function computes the N-dimensional discrete Fourier Transform over
1116 any number of axes in an M-dimensional real array by means of the Fast
1117 Fourier Transform (FFT). By default, all axes are transformed, with the
1118 real transform performed over the last axis, while the remaining
1119 transforms are complex.
1120
1121 Parameters
1122 ----------
1123 a : array_like
1124 Input array, taken to be real.
1125 s : sequence of ints, optional
1126 Shape (length along each transformed axis) to use from the input.
1127 (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.).
1128 The final element of `s` corresponds to `n` for ``rfft(x, n)``, while
1129 for the remaining axes, it corresponds to `n` for ``fft(x, n)``.
1130 Along any axis, if the given shape is smaller than that of the input,
1131 the input is cropped. If it is larger, the input is padded with zeros.
1132 if `s` is not given, the shape of the input along the axes specified
1133 by `axes` is used.
1134 axes : sequence of ints, optional
1135 Axes over which to compute the FFT. If not given, the last ``len(s)``
1136 axes are used, or all axes if `s` is also not specified.
1137 norm : {"backward", "ortho", "forward"}, optional
1138 .. versionadded:: 1.10.0
1139
1140 Normalization mode (see `numpy.fft`). Default is "backward".
1141 Indicates which direction of the forward/backward pair of transforms
1142 is scaled and with what normalization factor.
1143
1144 .. versionadded:: 1.20.0
1145
1146 The "backward", "forward" values were added.
1147
1148 Returns
1149 -------
1150 out : complex ndarray
1151 The truncated or zero-padded input, transformed along the axes
1152 indicated by `axes`, or by a combination of `s` and `a`,
1153 as explained in the parameters section above.
1154 The length of the last axis transformed will be ``s[-1]//2+1``,
1155 while the remaining transformed axes will have lengths according to
1156 `s`, or unchanged from the input.
1157
1158 Raises
1159 ------
1160 ValueError
1161 If `s` and `axes` have different length.
1162 IndexError
1163 If an element of `axes` is larger than than the number of axes of `a`.
1164
1165 See Also
1166 --------
1167 irfftn : The inverse of `rfftn`, i.e. the inverse of the n-dimensional FFT
1168 of real input.

Callers 1

rfft2Function · 0.85

Calls 4

asarrayFunction · 0.90
_cook_nd_argsFunction · 0.85
rfftFunction · 0.85
fftFunction · 0.85

Tested by

no test coverage detected