| 2079 | } cfft_plan_i; |
| 2080 | |
| 2081 | static cfft_plan make_cfft_plan (size_t length) |
| 2082 | { |
| 2083 | if (length==0) return NULL; |
| 2084 | cfft_plan plan = RALLOC(cfft_plan_i,1); |
| 2085 | if (!plan) return NULL; |
| 2086 | plan->blueplan=0; |
| 2087 | plan->packplan=0; |
| 2088 | if ((length<50) || (largest_prime_factor(length)<=sqrt(length))) |
| 2089 | { |
| 2090 | plan->packplan=make_cfftp_plan(length); |
| 2091 | if (!plan->packplan) { DEALLOC(plan); return NULL; } |
| 2092 | return plan; |
| 2093 | } |
| 2094 | double comp1 = cost_guess(length); |
| 2095 | double comp2 = 2*cost_guess(good_size(2*length-1)); |
| 2096 | comp2*=1.5; /* fudge factor that appears to give good overall performance */ |
| 2097 | if (comp2<comp1) // use Bluestein |
| 2098 | { |
| 2099 | plan->blueplan=make_fftblue_plan(length); |
| 2100 | if (!plan->blueplan) { DEALLOC(plan); return NULL; } |
| 2101 | } |
| 2102 | else |
| 2103 | { |
| 2104 | plan->packplan=make_cfftp_plan(length); |
| 2105 | if (!plan->packplan) { DEALLOC(plan); return NULL; } |
| 2106 | } |
| 2107 | return plan; |
| 2108 | } |
| 2109 | |
| 2110 | static void destroy_cfft_plan (cfft_plan plan) |
| 2111 | { |
no test coverage detected