MCPcopy Create free account
hub / github.com/numpy/numpy / make_cfft_plan

Function make_cfft_plan

numpy/fft/_pocketfft.c:2081–2108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2079 } cfft_plan_i;
2080
2081static 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
2110static void destroy_cfft_plan (cfft_plan plan)
2111 {

Callers 1

execute_complexFunction · 0.85

Calls 6

largest_prime_factorFunction · 0.85
make_cfftp_planFunction · 0.85
cost_guessFunction · 0.85
good_sizeFunction · 0.85
make_fftblue_planFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected