LibCapy - fft

Class and structure implementing DFT and FFT.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyDFTCoeffs :

Struct CapyDFTCoeffs's properties:

Inherits CapyMathFun

Number of coefficients

Original input range of the transformed function (default: [0,1])

Values of the Fourier series coefficients, these are the amplitudes of the cosine (real part) and sine (imaginary part) for each "frequency bin". The k-th frequency bin corresponds to the sine and cosine of frequency k. The original function is then approximated by f(t)=a_0/2+sum_{k=0..(N-1)}(a_k*cos(2pi*kt)+b_k*sin(2pi*kt))

Struct CapyDFTCoeffs's methods:

Destructor

Get the vector of amplitude (magnitude of the complex number) per frequency bin (aka spectrum plot). Inputs: fold: if true, fold the symetric frequency and return only half of the bins.

Output and side effect(s):

Return the amplitude per frequency bins as a vector. It is symetric relative to that->nb/2. One can get the single sided Fourier coeficients by taking only the first half values multiplied by two.

Struct CapyDFT :

Struct CapyDFT's properties:

None.

Struct CapyDFT's methods:

Destructor

Transform a 1D polynomial from coefficients representation to values representation. The polynomial must have a power-of-2 number of coefficients.

Input argument(s):

poly: the polynomial

Output and side effect(s):

Return the value representation of the polynomial as a CapyDFTCoeffs

Transform a 1D polynomial from values representation to coefficients representation. The number of values must be a power-of-2.

Input argument(s):

values: the values representation of the polynomial

Output and side effect(s):

Return the polynomial corresponding to the value representation

Calculate the Discrete Fourier Transform for an input range of a given function

Input argument(s):

fun: the function (must have one input and one output)
range: range of the input of the function for which the DFT is calculated
nbSample: the number of samples taken from the function, equally spaced in 'range' (bounds included)

Output and side effect(s):

Return the DFT coefficients as a CapyDFTCoeffs

Calculate the Discrete Fourier Transform for a given set of samples

Input argument(s):

samples: the samples value

Output and side effect(s):

Return the DFT coefficients as a CapyDFTCoeffs

Struct CapyDFT2DCoeffs :

Struct CapyDFT2DCoeffs's properties:

Inherits CapyMathFun

Number of coefficients

Original input range of the transformed function (default: [0,1])

Values of the Fourier series coefficients, stored by rows

Struct CapyDFT2DCoeffs's methods:

Destructor

Convert the coefficients into a visualisation of the amplitude Inputs: center: if true, center the null frequency logScale: if true, apply logarithmic scaling

Output and side effect(s):

Return a normalised greyscale image.

Convert the coefficients into a visualisation of the phase Inputs: center: if true, center the null frequency

Output and side effect(s):

Return a normalised greyscale image.

Convert the coefficients into a periodogram Inputs: center: if true, center the null frequency logScale: if true, apply logarithmic scaling

Output and side effect(s):

Return a normalised greyscale image.

Struct CapyDFT2D :

Struct CapyDFT2D's properties:

None.

Struct CapyDFT2D's methods:

Destructor

Calculate the 2D Discrete Fourier Transform for a given image

Input argument(s):

img: the img to transform

Output and side effect(s):

Return the DFT coefficients as a CapyDFT2DCoeffs

Functions:

Create a CapyDFTCoeffs

Input argument(s):

nb: the number of coefficients

Output and side effect(s):

Return a CapyDFTCoeffs

Allocate memory for a new CapyDFTCoeffs and create it

Input argument(s):

nb: the number of coefficients

Output and side effect(s):

Return a CapyDFTCoeffs

Free the memory used by a CapyDFTCoeffs* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyDFTCoeffs to free

Create a CapyDFT

Output and side effect(s):

Return a CapyDFT

Allocate memory for a new CapyDFT and create it

Output and side effect(s):

Return a CapyDFT

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyDFT* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyDFT to free

Create a CapyDFT2DCoeffs

Input argument(s):

nb: the number of coefficients

Output and side effect(s):

Return a CapyDFT2DCoeffs

Allocate memory for a new CapyDFT2DCoeffs and create it

Input argument(s):

nb: the number of coefficients

Output and side effect(s):

Return a CapyDFT2DCoeffs

Free the memory used by a CapyDFT2DCoeffs* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyDFT2DCoeffs to free

Create a CapyDFT2D

Output and side effect(s):

Return a CapyDFT2D

Allocate memory for a new CapyDFT2D and create it

Output and side effect(s):

Return a CapyDFT2D

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyDFT2D* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyDFT2D to free

2023-03-26
in LibCapy,
12 views