kml_ffth_plan_dft_scale
建立单个连续数据序列n维C2C变换的plan。
接口定义
C interface:
kml_ffth_plan kml_ffth_plan_dft_scale(int rank, const int *n, kml_ffth_complex *in, kml_ffth_float_complex *out, int sign, unsigned flags);
返回值
函数返回一个kml_ffth_plan类型的结构体指针。将该对象作为参数传入kml_fft(f/h)_execute函数中使用,将对当前提供的输入in和输出out执行FFT变换;另外,也可以通过将该对象作为参数传入kml_ffth_plan_dft_scale函数中以对新的输入in和输出out执行FFT变换。
如果函数返回非空指针,则表示plan执行成功,否则表示执行失败。
参数
| 参数名 | 数据类型 | 描述 | 输入/输出 | 
|---|---|---|---|
| rank | int | FFT变换的维度是rank,约束:1≤rank≤3。 | 输入 | 
| n | const int* | n是维度为rank的数组,包含FFT序列每一维度的大小,约束:n[i]≥1, for i in 0 to rank - 1。 | 输入 | 
| in | 
 | 输入待变换的数据。 | 输入 | 
| out | 
 | 输出快速傅里叶变换后的数据。 | 输出 | 
| sign | int | 描述正向变换或反向变换。 
 | 输入 | 
| flags | unsigned int | planning选项,描述ESTIMATE模式或PATIENT模式。 KML_FFT_ESTIMATE:ESTIMATE模式 KML_FFT_PATIENT:PATIENT模式 | 输入 | 
依赖
C: "kfft.h"
示例
C interface:
    int rank = 2; 
    int *n; 
    n = (int*)kml_ffth_malloc(sizeof(int) * rank); 
    n[0] = 2; 
    n[1] = 3; 
    __fp16 init[6][2] = {{120, 0}, {8, 8}, {0, 0}, {0, 16}, {0, 16}, {-8, 8}}; 
    kml_ffth_complex *in; 
    in = (kml_ffth_complex*)kml_ffth_malloc(sizeof(kml_ffth_complex) * n[0] * n[1]); 
    for (int i = 0; i < n[0] * n[1]; i++) { 
        in[i][0] = init[i][0]; 
        in[i][1] = init[i][1]; 
    } 
    
    kml_ffth_float_complex  *out; 
    out = (kml_ffth_float_complex *)kml_ffth_malloc(sizeof(
kml_ffth_float_complex) * n[0] * n[1]); 
    kml_ffth_plan plan; 
    plan = kml_ffth_plan_dft_scale(rank, n, in, out, KML_FFT_FORWARD, KML_FFT_ESTIMATE); 
    kml_ffth_dft_execute_scale(plan, in, out); 
 
    kml_ffth_destroy_plan(plan); 
    kml_ffth_free(n); 
    kml_ffth_free(in); 
    kml_ffth_free(out); 
 
    /* 
     * out = {{1.200000e+02, 4.800000e+01}, {1.338564e+02, -1.385641e+01}, 
     *        {1.061436e+02, 1.385641e+01}, {1.360000e+02, -3.200000e+01}, 
     *        {1.120000e+02, -8.000000e+00}, {1.120000e+02, -8.000000e+00}} 
     */
父主题: C2C变换