Rate This Document
Findability
Accuracy
Completeness
Readability

kml_ffth_plan_dft_scale_r2c

Create a plan for the n-dimensional R2C transform of a single contiguous data sequence.

Interface Definition

C interface:

kml_ffth_plan kml_ffth_plan_dft_scale_r2c(int rank, const int *n, __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

rank

int

Dimension of FFT. The constraint is 1 ≤ rank ≤ 4.

Input

n

const int*

Indicates an array whose dimension is rank, including the size of each dimension in the FFT sequence. The constraint is n[i] ≥ 1, for i in 0 to rank - 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 rank = 2; 
    int *n; 
    n = (int*)kml_ffth_malloc(sizeof(int) * rank); 
    n[0] = 2; 
    n[1] = 4; 
    double init[8] = {1, 2, 3, 4, 5, 6, 7, 8}; 
    double *in; 
    in = (__fp16*)kml_ffth_malloc(sizeof(__fp16) * n[0] * n[1]); 
    for (int i = 0; i < n[0] * n[1]; i++) { 
        in[i] = init[i]; 
    } 
    kml_ffth_float_complex *out; 
    out = (kml_ffth_float_complex*)kml_ffth_malloc(sizeof(kml_ffth_float_complex) * n[0] * (n[1] / 2 + 1)); 
    kml_ffth_plan plan; 
    plan = kml_ffth_plan_dft_scale_r2c(rank, n, in, out, KML_FFT_ESTIMATE); 
    kml_ffth_execute_dft_scale_r2c(plan, in, out); 
 
    kml_ffth_destroy_plan(plan); 
    kml_ffth_free(n); 
    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}} 
     */