Rate This Document
Findability
Accuracy
Completeness
Readability

kml_ffth_plan_dft_scale_1d

Create a plan for the one-dimensional C2C transform of a single contiguous data array.

Interface Definition

C interface:

kml_ffth_plan kml_ffth_plan_dft_scale_1d(int n, kml_ffth_complex *in, kml_ffth_float_complex *out, int sign, unsigned flags);

Return Value

The function returns a structure pointer of the kml_ffth_plan type. This object can be passed to the kml_fft(f/h)_execute function as a parameter to perform FFT on the current input and output. This object can also be passed to the kml_ffth_execute_dft_scale function as a parameter to perform FFT on new input and output.

If this function returns a non-null pointer, the plan has been successfully created. Otherwise, the plan fails to be created.

Parameters

Parameter

Data Type

Description

Input/Output

n

int

Inputs the FFT array size. The constraint is n ≥ 1.

Input

in

  • kml_ffth_complex*

Inputs the data to be transformed.

Input

out

  • kml_ffth_float_complex*

Outputs the data generated using FFT.

Output

sign

int

Specifies forward or backward transform.

  • -1(KML_FFT_FORWARD): forward
  • +1(KML_FFT_BACKWARD): backward

Input

flags

unsigned int

Planning option, which describes the ESTIMATE or PATIENT mode.

KML_FFT_ESTIMATE: ESTIMATE mode

KML_FFT_PATIENT: PATIENT mode

Input

Dependencies

C: "kfft.h"

Examples

C interface:

    int N = 16; 
    kml_ffth_complex *in; 
    kml_ffth_complex *out; 
    kml_ffth_plan plan; 
    in = (kml_ffth_complex*)kml_ffth_malloc(sizeof(kml_ffth_complex) * N); 
    out = (kml_ffth_float_complex*)kml_ffth_malloc(sizeof(kml_ffth_float_complex) * N); 
    for (int i = 0; i < N; i++){ 
        in[i][0] = (__fp16)i; 
        in[i][1] = (__fp16)i; 
    } 
    plan = kml_ffth_plan_dft_scale_1d(N, in , out, KML_FFT_FORWARD, KML_FFT_ESTIMATE); 
    kml_ffth_execute_dft_scale(plan, in, out); 
 
    kml_ffth_destroy_plan(plan); 
    kml_ffth_free(in); 
    kml_ffth_free(out); 
 
    /* 
     * out = {{1.200000e+02, 1.200000e+02}, {-4.821872e+01, 3.221872e+01}, 
     *        {-2.731371e+01, 1.131371e+01}, {-1.997285e+01, 3.972846e+00}, 
     *        {-1.600000e+01, 0.000000e+00}, {-1.334543e+01, -2.654571e+00}, 
     *        {-1.131371e+01, -4.686292e+00}, {-9.591299e+00, -6.408701e+00}, 
     *        {-8.000000e+00, -8.000000e+00}, {-6.408701e+00, -9.591299e+00}, 
     *        {-4.686292e+00, -1.131371e+01}, {-2.654571e+00, -1.334543e+01}, 
     *        {0.000000e+00, -1.600000e+01}, {3.972846e+00, -1.997285e+01}, 
     *        {1.131371e+01, -2.731371e+01}, {3.221872e+01, -4.821872e+01}} 
     */