Class FourierModule
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
The numpy.fft module surface, reachable as fft. Holds the 18 public
transforms/helpers (standard fft/ifft/fft2/ifft2/fftn/ifftn, real
rfft/irfft/rfft2/irfft2/rfftn/irfftn, hermitian hfft/ihfft, and helpers
fftfreq/rfftfreq/fftshift/ifftshift).
The transforms and fftfreq/rfftfreq are members of the Fft
sub-engine (FftEngine): each method here keeps its signature and its documentation and makes one
call into the sub-engine of its operand's engine (hfft on the plain view its np.conjugate needs),
so an engine assigned to Fft computes every function of this module. The default,
DefaultFftEngine, validates and resolves everything NumPy's Python layer does —
n/axis/norm/shape/dtype and the N-D→1-D decomposition — then computes through
PocketFFTDriver.Execute, the managed port of pocketfft's 1-D engine (bit-identical to NumPy 2.4.2 on the
double/complex128 path). fftshift/ifftshift roll the array object and stay compositions over
np.roll here.
[ModuleName("np.fft")]
public class FourierModule
- Inheritance
-
FourierModule
- Inherited Members
Remarks
Methods
fft(NDArray, int?, int, string, NDArray)
Compute the one-dimensional discrete Fourier Transform.
public NDArray fft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
nint?Length of the transformed axis of the output. Cropped/zero-padded from the input; defaults to
a.shape[axis].axisintAxis over which to compute the FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output of the appropriate shape.
Returns
- NDArray
The transform, complex128 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Fft(NumSharp.NDArray%2cSystem.Nullable%7bSystem.Int32%7d%2cSystem.Int32%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
nbelow 1, an unknownnorm, or anoutof the wrong shape or read-only.- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- DTypePromotionError
A text input.
- TypeError
An
outdtype complex128 cannot be cast to under same_kind.- ArgumentNullException
ais null.
fft2(NDArray, int[], int[], string, NDArray)
Compute the 2-dimensional discrete Fourier Transform (over the last two axes by default).
fft2 is fftn with a different default for axes.
public NDArray fft2(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
sint[]Shape (length of each transformed axis) of the output;
-1uses the full input length. Defaults to the input shape alongaxes.axesint[]Axes over which to compute the FFT. Default
(-2, -1).normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output.
Returns
- NDArray
The transform, complex128.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fft2.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Fft2(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range.
- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
fftfreq(long, double, string)
Return the Discrete Fourier Transform sample frequencies:
f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (dn) (n even);
f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (dn) (n odd).
public NDArray fftfreq(long n, double d = 1, string device = null)
Parameters
nlongWindow length: any C# integer converts (NumPy's Python int /
np.integer). A floating n does not compile, C#'s form of NumPy'sValueError: n should be an integer; aulongneeds a cast.ddoubleSample spacing (inverse of the sampling rate). Default 1.
devicestringArray-API device; must be
nullor"cpu".
Returns
- NDArray
A float64 array of length
n.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fftfreq.html
<p>One integer signature since API-parity batch 6 (the <code>int</code> form and the <code>double</code> form that only
threw NumPy's ValueError are gone). Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the default engine
(<xref href="NumSharp.FftEngine.Fftfreq(System.Int64%2cSystem.Double%2cSystem.String)" data-throw-if-not-resolved="false"></xref>): there is no operand to choose another.</p>
Exceptions
- ZeroDivisionError
n * dis zero (float division by zero, checked first).- ValueError
A device other than
"cpu"(Device not understood. ...), then a negativen(negative dimensions are not allowed).
fftn(NDArray, int[], int[], string, NDArray)
Compute the N-dimensional discrete Fourier Transform over the given axes (all axes by default). Composition of 1-D fft(NDArray, int?, int, string, NDArray) per axis.
public NDArray fftn(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
sint[]Per-axis output lengths;
-1uses the full input length. Defaults to the input shape alongaxes.axesint[]Axes over which to compute the FFT (default: all axes, or the last
len(s)when onlysis given).normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output.
Returns
- NDArray
The transform, complex128.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fftn.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Fftn(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range.
- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
fftshift(NDArray, int)
fftshift(NDArray, NDAxis?) with one int axis: the overload a C# integer binds, forwarding
to the NDAxis? form, so every answer and error is that one's.
public NDArray fftshift(NDArray x, int axes)
Parameters
Returns
- NDArray
The shifted array.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html. NumPy's statements:
axes is None → axes = tuple(range(ndim)), shift = [dim // 2 for dim in x.shape]; an int →
shift = x.shape[axes] // 2; a tuple → shift = [x.shape[ax] // 2 for ax in axes]; then
roll(x, shift, axes). One signature for NumPy's int-or-tuple axes since API-parity batch 6; the
int and int[] overloads forward here.
Exceptions
- IndexError
An axis outside
[-ndim, ndim): NumPy readsx.shape[ax]first, so it is Python'stuple index out of range, not an AxisError.- ValueError
A 0-d
xwithnullor()axes: NumPy's roll over no axis of a 0-d array ends in Python'snot enough values to unpack (expected 2, got 0).
fftshift(NDArray, int[])
fftshift(NDArray, NDAxis?) with the axes as an int[]: the overload an int[] and a
bare null bind, forwarding to the NDAxis? form (a null array is None, any other array NumPy's tuple).
public NDArray fftshift(NDArray x, int[] axes)
Parameters
Returns
- NDArray
The shifted array.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html. NumPy's statements:
axes is None → axes = tuple(range(ndim)), shift = [dim // 2 for dim in x.shape]; an int →
shift = x.shape[axes] // 2; a tuple → shift = [x.shape[ax] // 2 for ax in axes]; then
roll(x, shift, axes). One signature for NumPy's int-or-tuple axes since API-parity batch 6; the
int and int[] overloads forward here.
Exceptions
- IndexError
An axis outside
[-ndim, ndim): NumPy readsx.shape[ax]first, so it is Python'stuple index out of range, not an AxisError.- ValueError
A 0-d
xwithnullor()axes: NumPy's roll over no axis of a 0-d array ends in Python'snot enough values to unpack (expected 2, got 0).
fftshift(NDArray, NDAxis?)
Shift the zero-frequency component to the center of the spectrum: NumPy's fftshift, which rolls each
listed axis by shape[axis] // 2 in ONE roll(NDArray, NDArray, NDAxis?) call.
public NDArray fftshift(NDArray x, NDAxis? axes = null)
Parameters
xNDArrayInput array (a subclass operand gives a plain array: NumPy's
asarray).axesNDAxis?NumPy's
axes:null(every axis), one axis, or a tuple of axes (repeats roll that axis again;()rolls nothing and returns a copy).
Returns
- NDArray
A new array, the input's shape and dtype, NumPy's layout (roll's
empty_like).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html. NumPy's statements:
axes is None → axes = tuple(range(ndim)), shift = [dim // 2 for dim in x.shape]; an int →
shift = x.shape[axes] // 2; a tuple → shift = [x.shape[ax] // 2 for ax in axes]; then
roll(x, shift, axes). One signature for NumPy's int-or-tuple axes since API-parity batch 6; the
int and int[] overloads forward here.
Exceptions
- IndexError
An axis outside
[-ndim, ndim): NumPy readsx.shape[ax]first, so it is Python'stuple index out of range, not an AxisError.- ValueError
A 0-d
xwithnullor()axes: NumPy's roll over no axis of a 0-d array ends in Python'snot enough values to unpack (expected 2, got 0).
hfft(NDArray, int?, int, string, NDArray)
Compute the FFT of a signal that has Hermitian symmetry (a real spectrum). Defined as
irfft(conjugate(a), n, axis, norm=_swap_direction(norm)). The output is real; its
length along the axis is n, or 2*(m-1) when n is omitted.
public NDArray hfft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array.
nint?Length of the transformed axis of the output (default
2*(m-1)).axisintAxis over which to compute the FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayA pre-allocated real output that irfft writes and returns (NumPy 2.5; 2.4 ignored it), or null.
Returns
- NDArray
The real result, float64 (
outitself when given); a plain array for anumpy.matrixornumpy.char.chararrayoperand too.
Remarks
Exceptions
- ValueError
A length below 1, or an unknown
norm(the inverse transforms' text).- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- TypeError
A text input (np.conjugate has no string loop).
- ArgumentNullException
ais null.
ifft(NDArray, int?, int, string, NDArray)
Compute the one-dimensional inverse discrete Fourier Transform (ifft(fft(a)) == a).
public NDArray ifft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
nint?Length of the transformed axis of the output (default
a.shape[axis]).axisintAxis over which to compute the inverse FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output of the appropriate shape.
Returns
- NDArray
The inverse transform, complex128 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifft.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Ifft(NumSharp.NDArray%2cSystem.Nullable%7bSystem.Int32%7d%2cSystem.Int32%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
nbelow 1, an unknownnorm, or anoutof the wrong shape or read-only.- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- DTypePromotionError
A text input.
- TypeError
An
outdtype complex128 cannot be cast to under same_kind.- ArgumentNullException
ais null.
ifft2(NDArray, int[], int[], string, NDArray)
Compute the 2-dimensional inverse discrete Fourier Transform (over the last two axes by
default). ifft2 is ifftn with a different default for axes.
Like NumPy 2.5, the provided out is threaded through the composition (NumPy 2.4 ignored
it).
public NDArray ifft2(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
sint[]Per-axis output lengths;
-1uses the full input length.axesint[]Axes over which to compute the inverse FFT. Default
(-2, -1).normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayA pre-allocated complex output handed to every one-dimensional transform, or null.
Returns
- NDArray
The inverse transform, complex128 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifft2.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Ifft2(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, or an unknown norm.- IndexError
An axis out of range.
- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
ifftn(NDArray, int[], int[], string, NDArray)
Compute the N-dimensional inverse discrete Fourier Transform (ifftn(fftn(a)) == a).
Composition of 1-D ifft(NDArray, int?, int, string, NDArray) per axis.
public NDArray ifftn(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array, can be complex.
sint[]Per-axis output lengths;
-1uses the full input length.axesint[]Axes over which to compute the inverse FFT (default: all axes).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output.
Returns
- NDArray
The inverse transform, complex128.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftn.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Ifftn(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range.
- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
ifftshift(NDArray, int)
ifftshift(NDArray, NDAxis?) with one int axis: the overload a C# integer binds, forwarding
to the NDAxis? form.
public NDArray ifftshift(NDArray x, int axes)
Parameters
Returns
- NDArray
The shifted array.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshift.html: fftshift's statements with
-(dim // 2).
Exceptions
- IndexError
An axis outside
[-ndim, ndim)(tuple index out of range).- ValueError
A 0-d
xwithnullor()axes (not enough values to unpack (expected 2, got 0)).
ifftshift(NDArray, int[])
ifftshift(NDArray, NDAxis?) with the axes as an int[]: the overload an int[] and a
bare null bind, forwarding to the NDAxis? form (a null array is None).
public NDArray ifftshift(NDArray x, int[] axes)
Parameters
Returns
- NDArray
The shifted array.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshift.html: fftshift's statements with
-(dim // 2).
Exceptions
- IndexError
An axis outside
[-ndim, ndim)(tuple index out of range).- ValueError
A 0-d
xwithnullor()axes (not enough values to unpack (expected 2, got 0)).
ifftshift(NDArray, NDAxis?)
The inverse of fftshift(NDArray, NDAxis?): NumPy's ifftshift, which rolls each listed
axis by -(shape[axis] // 2) (the same as fftshift for an even length, one sample apart for an odd one).
public NDArray ifftshift(NDArray x, NDAxis? axes = null)
Parameters
xNDArrayInput array (a subclass operand gives a plain array: NumPy's
asarray).axesNDAxis?NumPy's
axes:null(every axis), one axis, or a tuple of axes.
Returns
- NDArray
A new array, the input's shape and dtype.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshift.html: fftshift's statements with
-(dim // 2).
Exceptions
- IndexError
An axis outside
[-ndim, ndim)(tuple index out of range).- ValueError
A 0-d
xwithnullor()axes (not enough values to unpack (expected 2, got 0)).
ihfft(NDArray, int?, int, string, NDArray)
Compute the inverse FFT of a signal that has Hermitian symmetry. Defined as
conjugate(rfft(a, n, axis, norm=_swap_direction(norm)), out=out). The output is
complex; its length along the axis is n//2 + 1.
public NDArray ihfft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array.
nint?Length of the inverse FFT along the transform axis (default
a.shape[axis]).axisintAxis over which to compute the inverse FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output (threaded into rfft and the conjugate).
Returns
- NDArray
The conjugated half spectrum, complex128 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.ihfft.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Ihfft(NumSharp.NDArray%2cSystem.Nullable%7bSystem.Int32%7d%2cSystem.Int32%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
A length below 1, an unknown
norm, or anoutof the wrong shape or read-only.- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- TypeError
A complex input (rfft's refusal).
- DTypePromotionError
A text input.
- TypeError
An
outdtype complex128 cannot be cast to under same_kind.- ArgumentNullException
ais null.
irfft(NDArray, int?, int, string, NDArray)
Compute the inverse of rfft(NDArray, int?, int, string, NDArray) — a real-valued output. For n output
points, n//2+1 input points are used; when n is omitted it defaults to
2*(m-1) where m is the input length along the axis.
public NDArray irfft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array (the non-negative-frequency half-spectrum).
nint?Length of the transformed (real) axis of the output. Default
2*(m-1).axisintAxis over which to compute the inverse FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated real (float64) output of length
non the axis.
Returns
- NDArray
The real signal, float64 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Irfft(NumSharp.NDArray%2cSystem.Nullable%7bSystem.Int32%7d%2cSystem.Int32%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
nbelow 1 (an input of length 1 withnomitted gives 0), an unknownnorm, or anoutof the wrong shape or read-only.- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- DTypePromotionError
A text input.
- TypeError
An
outdtype float64 cannot be cast to under same_kind.- ArgumentNullException
ais null.
irfft2(NDArray, int[], int[], string, NDArray)
Compute the inverse of rfft2(NDArray, int[], int[], string, NDArray). irfft2 is irfftn with the
default axes of (-2, -1). Like NumPy 2.5, the provided out is
handed to irfftn (NumPy 2.4 ignored it).
public NDArray irfft2(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array.
sint[]Per-axis output lengths;
-1uses the full input length.axesint[]Axes over which to compute the inverse FFT. Default
(-2, -1).normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayA pre-allocated real output for the final transform, or null.
Returns
- NDArray
The real result, float64 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft2.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Irfft2(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, or an unknown norm.- IndexError
An axis out of range, or no axis to transform.
- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
irfftn(NDArray, int[], int[], string, NDArray)
Compute the inverse of rfftn(NDArray, int[], int[], string, NDArray): ifft(NDArray, int?, int, string, NDArray) over all axes but the last,
then irfft(NDArray, int?, int, string, NDArray) over the last axis (real output). The last-axis default length is
2*(m-1).
public NDArray irfftn(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array.
sint[]Per-axis output lengths;
-1uses the full input length.axesint[]Axes over which to compute the inverse FFT (default: all axes).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated real (float64) output for the final transform.
Returns
- NDArray
The real result, float64.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.irfftn.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Irfftn(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range, or no axis to transform (
tuple/list index out of range).- AxisError
An axis out of range for a one-dimensional transform.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
rfft(NDArray, int?, int, string, NDArray)
Compute the one-dimensional discrete Fourier Transform for real input. The output length
along the axis is n//2 + 1 (the non-negative-frequency half).
public NDArray rfft(NDArray a, int? n = null, int axis = -1, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array (taken to be real).
nint?Number of points along the transform axis to use (default
a.shape[axis]).axisintAxis over which to compute the FFT (default the last axis).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output of shape
(..., n//2+1, ...).
Returns
- NDArray
The half spectrum, complex128 (
outitself when given).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Rfft(NumSharp.NDArray%2cSystem.Nullable%7bSystem.Int32%7d%2cSystem.Int32%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
nbelow 1, an unknownnorm, or anoutof the wrong shape or read-only.- IndexError
axisout of range withnomitted.- AxisError
axisout of range withngiven.- TypeError
A complex input (
ufunc 'rfft_n_even'/'rfft_n_odd' not supported for the input types, ...).- DTypePromotionError
A text input.
- TypeError
An
outdtype complex128 cannot be cast to under same_kind.- ArgumentNullException
ais null.
rfft2(NDArray, int[], int[], string, NDArray)
Compute the 2-dimensional FFT of a real array. rfft2 is rfftn with the
default axes of (-2, -1).
public NDArray rfft2(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array (taken to be real).
sint[]Per-axis output lengths;
-1uses the full input length.axesint[]Axes over which to compute the FFT. Default
(-2, -1).normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output.
Returns
- NDArray
The transform, complex128, the last transformed axis halved.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Rfft2(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range, or no axis to transform.
- AxisError
An axis out of range for a one-dimensional transform.
- TypeError
A complex input.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.
rfftfreq(long, double, string)
Return the Discrete Fourier Transform sample frequencies for use with rfft / irfft:
f = [0, 1, ..., n/2] / (d*n) (the Nyquist component is positive).
public NDArray rfftfreq(long n, double d = 1, string device = null)
Parameters
nlongWindow length: any C# integer converts; a floating n does not compile (NumPy's
ValueError: n should be an integer). A negative one gives an empty result, as NumPy'sarangedoes.ddoubleSample spacing (inverse of the sampling rate). Default 1.
devicestringArray-API device; must be
nullor"cpu".
Returns
- NDArray
A float64 array of length
n//2 + 1(empty when that is not positive).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftfreq.html
<p>One integer signature since API-parity batch 6. Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the default
engine (<xref href="NumSharp.FftEngine.Rfftfreq(System.Int64%2cSystem.Double%2cSystem.String)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ZeroDivisionError
n * dis zero (float division by zero, checked first).- ValueError
A device other than
"cpu".
rfftn(NDArray, int[], int[], string, NDArray)
Compute the N-dimensional discrete Fourier Transform for real input: rfft(NDArray, int?, int, string, NDArray) over the LAST transformed axis, then fft(NDArray, int?, int, string, NDArray) over the remaining axes.
public NDArray rfftn(NDArray a, int[] s = null, int[] axes = null, string norm = null, NDArray @out = null)
Parameters
aNDArrayInput array (taken to be real).
sint[]Per-axis output lengths; the final element is
nforrfft, the rest arenforfft.-1uses the full input length.axesint[]Axes over which to compute the FFT (default: all axes).
normstringNormalization mode:
null/"backward"/"ortho"/"forward".outNDArrayOptional pre-allocated complex output.
Returns
- NDArray
The transform, complex128, the last transformed axis halved.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftn.html
<p>Computed by <xref href="NumSharp.TensorEngine.Fft" data-throw-if-not-resolved="false"></xref> of the operand's engine (<xref href="NumSharp.FftEngine.Rfftn(NumSharp.NDArray%2cSystem.Int32%5b%5d%2cSystem.Int32%5b%5d%2cSystem.String%2cNumSharp.NDArray)" data-throw-if-not-resolved="false"></xref>).</p>
Exceptions
- ValueError
sandaxesof different lengths, a length below 1, an unknown norm, or an unfit out.- IndexError
An axis out of range, or no axis to transform (
list index out of range).- AxisError
An axis out of range for a one-dimensional transform.
- TypeError
A complex input.
- DTypePromotionError
A text input.
- ArgumentNullException
ais null.