NumCpp  2.16.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
nc::fft Namespace Reference

Namespaces

namespace  detail
 

Functions

template<typename dtype >
NdArray< std::complex< double > > fft (const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > fft (const NdArray< dtype > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > fft (const NdArray< std::complex< dtype > > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > fft (const NdArray< std::complex< dtype > > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > fft2 (const NdArray< dtype > &inArray)
 
template<typename dtype >
NdArray< std::complex< double > > fft2 (const NdArray< dtype > &inArray, const Shape &inShape)
 
template<typename dtype >
NdArray< std::complex< double > > fft2 (const NdArray< std::complex< dtype > > &inArray)
 
template<typename dtype >
NdArray< std::complex< double > > fft2 (const NdArray< std::complex< dtype > > &inArray, const Shape &inShape)
 
NdArray< doublefftfreq (uint32 inN, double inD=1.)
 
template<typename dtype >
NdArray< dtypefftshift (const NdArray< dtype > &inX, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > ifft (const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > ifft (const NdArray< dtype > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > ifft (const NdArray< std::complex< dtype > > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > ifft (const NdArray< std::complex< dtype > > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > ifft2 (const NdArray< dtype > &inArray)
 
template<typename dtype >
NdArray< std::complex< double > > ifft2 (const NdArray< dtype > &inArray, const Shape &inShape)
 
template<typename dtype >
NdArray< std::complex< double > > ifft2 (const NdArray< std::complex< dtype > > &inArray)
 
template<typename dtype >
NdArray< std::complex< double > > ifft2 (const NdArray< std::complex< dtype > > &inArray, const Shape &inShape)
 
template<typename dtype >
NdArray< dtypeifftshift (const NdArray< dtype > &inX, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< doubleirfft (const NdArray< std::complex< dtype > > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< doubleirfft (const NdArray< std::complex< dtype > > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< doubleirfft2 (const NdArray< std::complex< dtype > > &inArray)
 
template<typename dtype >
NdArray< doubleirfft2 (const NdArray< std::complex< dtype > > &inArray, const Shape &inShape)
 
template<typename dtype >
NdArray< std::complex< double > > rfft (const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > rfft (const NdArray< dtype > &inArray, uint32 inN, Axis inAxis=Axis::NONE)
 
template<typename dtype >
NdArray< std::complex< double > > rfft2 (const NdArray< dtype > &inArray)
 
template<typename dtype >
NdArray< std::complex< double > > rfft2 (const NdArray< dtype > &inArray, const Shape &inShape)
 
NdArray< doublerfftfreq (uint32 inN, double inD=1.)
 

Function Documentation

◆ fft() [1/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft ( const NdArray< dtype > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft.html#numpy.fft.fft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ fft() [2/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft ( const NdArray< dtype > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft.html#numpy.fft.fft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ fft() [3/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft ( const NdArray< std::complex< dtype > > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft.html#numpy.fft.fft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ fft() [4/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft ( const NdArray< std::complex< dtype > > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft.html#numpy.fft.fft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ fft2() [1/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft2 ( const NdArray< dtype > &  inArray)

Compute the 2-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2

Parameters
inArray
Returns
NdArray

◆ fft2() [2/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft2 ( const NdArray< dtype > &  inArray,
const Shape inShape 
)

Compute the 2-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ fft2() [3/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft2 ( const NdArray< std::complex< dtype > > &  inArray)

Compute the 2-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2

Parameters
inArray
Returns
NdArray

◆ fft2() [4/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::fft2 ( const NdArray< std::complex< dtype > > &  inArray,
const Shape inShape 
)

Compute the 2-dimensional discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ fftfreq()

NdArray< double > nc::fft::fftfreq ( uint32  inN,
double  inD = 1. 
)
inline

Return the Discrete Fourier Transform sample frequencies. The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.fftfreq.html#

Parameters
inNWindow Length
inD(Optional) Sample spacing (inverse of the sampling rate). Must be positive non-zero. Defaults to 1.
Returns
NdArray

◆ fftshift()

template<typename dtype >
NdArray< dtype > nc::fft::fftshift ( const NdArray< dtype > &  inX,
Axis  inAxis = Axis::NONE 
)

Shift the zero-frequency component to the center of the spectrum. This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component only if len(x) is even.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html

Parameters
inXinput array
inAxis(Optional) Axes over which to shift. Default is None, which shifts all axes.
Returns
NdArray

◆ ifft() [1/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft ( const NdArray< dtype > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ ifft() [2/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft ( const NdArray< dtype > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ ifft() [3/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft ( const NdArray< std::complex< dtype > > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ ifft() [4/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft ( const NdArray< std::complex< dtype > > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ ifft2() [1/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft2 ( const NdArray< dtype > &  inArray)

Compute the 2-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2

Parameters
inArray
Returns
NdArray

◆ ifft2() [2/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft2 ( const NdArray< dtype > &  inArray,
const Shape inShape 
)

Compute the 2-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ ifft2() [3/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft2 ( const NdArray< std::complex< dtype > > &  inArray)

Compute the 2-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2

Parameters
inArray
Returns
NdArray

◆ ifft2() [4/4]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::ifft2 ( const NdArray< std::complex< dtype > > &  inArray,
const Shape inShape 
)

Compute the 2-dimensional inverse discrete Fourier Transform.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ ifftshift()

template<typename dtype >
NdArray< dtype > nc::fft::ifftshift ( const NdArray< dtype > &  inX,
Axis  inAxis = Axis::NONE 
)

The inverse of fftshift. Although identical for even-length x, the functions differ by one sample for odd-length x.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.ifftshift.html

Parameters
inXinput array
inAxis(Optional) Axes over which to shift. Default is None, which shifts all axes.
Returns
NdArray

◆ irfft() [1/2]

template<typename dtype >
NdArray< double > nc::fft::irfft ( const NdArray< std::complex< dtype > > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform for real inputs.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.irfft.html#numpy.fft.irfft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ irfft() [2/2]

template<typename dtype >
NdArray< double > nc::fft::irfft ( const NdArray< std::complex< dtype > > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional inverse discrete Fourier Transform for real inputs.

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.irfft.html#numpy.fft.irfft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ irfft2() [1/2]

template<typename dtype >
NdArray< double > nc::fft::irfft2 ( const NdArray< std::complex< dtype > > &  inArray)

Computes the inverse of rfft2.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft2.html

Parameters
inArray
Returns
NdArray

◆ irfft2() [2/2]

template<typename dtype >
NdArray< double > nc::fft::irfft2 ( const NdArray< std::complex< dtype > > &  inArray,
const Shape inShape 
)

Computes the inverse of rfft2.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.irfft2.html

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ rfft() [1/2]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::rfft ( const NdArray< dtype > &  inArray,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform for real input

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.rfft.html#numpy.fft.rfft

Parameters
inArray
inAxis(Optional, default NONE)
Returns
NdArray

◆ rfft() [2/2]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::rfft ( const NdArray< dtype > &  inArray,
uint32  inN,
Axis  inAxis = Axis::NONE 
)

Compute the one-dimensional discrete Fourier Transform for real input

NumPy Reference: https://numpy.org/doc/2.3/reference/generated/numpy.fft.rfft.html#numpy.fft.rfft

Parameters
inArray
inNLength of the transformed axis of the output.
inAxis(Optional, default NONE)
Returns
NdArray

◆ rfft2() [1/2]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::rfft2 ( const NdArray< dtype > &  inArray)

Compute the 2-dimensional FFT of a real array.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html

Parameters
inArray
Returns
NdArray

◆ rfft2() [2/2]

template<typename dtype >
NdArray< std::complex< double > > nc::fft::rfft2 ( const NdArray< dtype > &  inArray,
const Shape inShape 
)

Compute the 2-dimensional FFT of a real array.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html

Parameters
inArray
inShapeShape (length of each transformed axis) of the output
Returns
NdArray

◆ rfftfreq()

NdArray< double > nc::fft::rfftfreq ( uint32  inN,
double  inD = 1. 
)
inline

Return the Discrete Fourier Transform sample frequencies (for usage with rfft, irfft). The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second.

NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftfreq.html

Parameters
inNWindow Length
inD(Optional) Sample spacing (inverse of the sampling rate). Defaults to 1.
Returns
NdArray