| 2139 | } rfft_plan_i; |
| 2140 | |
| 2141 | static rfft_plan make_rfft_plan (size_t length) |
| 2142 | { |
| 2143 | if (length==0) return NULL; |
| 2144 | rfft_plan plan = RALLOC(rfft_plan_i,1); |
| 2145 | if (!plan) return NULL; |
| 2146 | plan->blueplan=0; |
| 2147 | plan->packplan=0; |
| 2148 | if ((length<50) || (largest_prime_factor(length)<=sqrt(length))) |
| 2149 | { |
| 2150 | plan->packplan=make_rfftp_plan(length); |
| 2151 | if (!plan->packplan) { DEALLOC(plan); return NULL; } |
| 2152 | return plan; |
| 2153 | } |
| 2154 | double comp1 = 0.5*cost_guess(length); |
| 2155 | double comp2 = 2*cost_guess(good_size(2*length-1)); |
| 2156 | comp2*=1.5; /* fudge factor that appears to give good overall performance */ |
| 2157 | if (comp2<comp1) // use Bluestein |
| 2158 | { |
| 2159 | plan->blueplan=make_fftblue_plan(length); |
| 2160 | if (!plan->blueplan) { DEALLOC(plan); return NULL; } |
| 2161 | } |
| 2162 | else |
| 2163 | { |
| 2164 | plan->packplan=make_rfftp_plan(length); |
| 2165 | if (!plan->packplan) { DEALLOC(plan); return NULL; } |
| 2166 | } |
| 2167 | return plan; |
| 2168 | } |
| 2169 | |
| 2170 | static void destroy_rfft_plan (rfft_plan plan) |
| 2171 | { |
no test coverage detected