kml_fft(f/h)_set_timelimit

设置FFT PATIENT模式超时时间

接口定义

void kml_fft_set_timelimit(double tlim)

void kml_fftf_set_timelimit(double tlim)

void kml_ffth_set_timelimit(double tlim)

参数

参数名

描述

取值范围

输入/输出

tlim

设置FFT PATIENT模式超时时间,单位为秒。若不调用改接口,表现为无时间限制。

double

负数、0表现为无时间限制,plan接口将进行完整的PATIENT模式搜索

正数值将设定指定秒数的超时时间,内部搜索循环会在每次评估后进行超时判断,若超时,则输出已评估列表中的最优解。

输入

依赖

C: "kfft.h"

示例

C interface:
    int N = 16; 
    kml_fft_complex *in; 
    kml_fft_complex *out; 
    kml_fft_plan plan; 
    in = (kml_fft_complex*)kml_fft_malloc(sizeof(kml_fft_complex) * N); 
    out = (kml_fft_complex*)kml_fft_malloc(sizeof(kml_fft_complex) * N); 
    for (int i = 0; i < N; i++){ 
        in[i][0] = (double)i; 
        in[i][1] = (double)i; 
    } 
    kml_fft_set_timelimit(10);    
    plan = kml_fft_plan_dft_1d(N, in , out, KML_FFT_FORWARD, KML_FFT_PATIENT); 
    kml_fft_execute_dft(plan, in, out); 
 
    kml_fft_destroy_plan(plan); 
    kml_fft_free(in); 
    kml_fft_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}} 
     */