real_plan make_real_plan (int length) { real_plan plan = (real_plan) malloc(sizeof(real_plan_i)); int pfsum = prime_factor_sum(length); double comp1 = .5*length*pfsum; double comp2 = 2*3*length*log(3.*length); plan->length=length; plan->bluestein = (comp2<comp1); if (plan->bluestein) bluestein_i (length,&(plan->work)); else { plan->work=(double *)malloc((2*length+15)*sizeof(double)); rffti(length, plan->work); } return plan; }
real_plan make_real_plan (size_t length) { real_plan plan = RALLOC(real_plan_i,1); size_t pfsum = prime_factor_sum(length); double comp1 = .5*length*pfsum; double comp2 = 2*3*length*log(3.*length); comp2*=3; /* fudge factor that appears to give good overall performance */ plan->length=length; plan->bluestein = (comp2<comp1); if (plan->bluestein) bluestein_i (length,&(plan->work)); else { plan->work=RALLOC(double,2*length+15); rffti(length, plan->work); } return plan; }
complex_plan make_complex_plan (size_t length) { complex_plan plan = RALLOC(complex_plan_i,1); size_t pfsum = prime_factor_sum(length); double comp1 = (double)(length*pfsum); double comp2 = 2*3*length*log(3.*length); comp2*=3.; /* fudge factor that appears to give good overall performance */ plan->length=length; plan->bluestein = (comp2<comp1); if (plan->bluestein) bluestein_i (length,&(plan->work),&(plan->worksize)); else { plan->worksize=4*length+15; plan->work=RALLOC(double,4*length+15); cffti(length, plan->work); } return plan; }