我要评分
获取效率
正确性
完整性
易理解

kml_ffth_plan_dft_scale_r2c_2d

Create a plan for the two-dimensional R2C transform of a single contiguous data array.

Interface Definition

C interface:

kml_ffth_plan kml_ffth_plan_dft_scale_r2c_2d(int n0, int n1, __fp16 *in, kml_ffth_float_complex *out, 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_r2c 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

n0

int

Inputs the size of the first dimension in the FFT array. The constraint is n0 ≥ 1.

Input

n1

int

Inputs the size of the second dimension in the FFT array. The constraint is n1 ≥ 1.

Input

in

  • __fp16*

Inputs the data to be transformed.

Input

out

  • kml_ffth_float_complex*

Outputs the data generated using FFT.

Output

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 n0 = 2; 
    int n1 = 4; 
    __fp16 init[8] = {1, 2, 3, 4, 5, 6, 7, 8}; 
    __fp16*in; 
    in = (__fp16*)kml_ffth_malloc(sizeof(__fp16) * n0 * n1); 
    for (int i = 0; i < n0 * n1; i++) { 
        in[i] = init[i]; 
    } 
    kml_ffth_float_complex *out; 
    out = (kml_ffth_float_complex*)kml_ffth_malloc(sizeof(kml_ffth_float_complex) * n0 * (n1 / 2 + 1)); 
    kml_ffth_plan plan; 
    plan = kml_ffth_plan_dft_scale_r2c_2d(n0, n1, in, out, KML_FFT_ESTIMATE); 
    kml_ffth_execute_dft_scale_r2c(plan, in, out); 
 
    kml_ffth_destroy_plan(plan); 
    kml_ffth_free(in); 
    kml_ffth_free(out); 
 
    /* 
     * out = {{3.600000e+01, 0.000000e+00}, {-4.000000e+00, 4.000000e+00}, 
     *        {-4.000000e+00, 0.000000e+00}, {-1.600000e+01, 0.000000e+00}, 
     *        {0.000000e+00, 0.000000e+00}, {0.000000e+00, 0.000000e+00}} 
     */