% Test neqfft.m on random data. % Determine optimal parameters for given accuracy. % Accuracy eps. eps = 1.0d-5; % Loop over ten cases of varying sizes. p = [ 1:10 ]; % Initialize timing and parameter arrays --- same size as p. tcpu = 1.0d+6*p; scpu = 1.0d+6*p; kmin = 1.0d+6*p; qmin = 1.0d+6*p; % Loop through cases. for i = p n = floor( 20*2^(0.5*i) ) m = floor( 20*2^(0.5*i) ) % Random coeffs on [0,1] and points on [0,2pi]. c = rand( 1, n ); x = 2*pi*rand( 1, m ); % Try a large range of degrees 2k-1 and oversamplings q. for k = 2:2:30 for q = 2:10 % Test only if error bound is smaller than eps but not too much smaller. errbd = (pi/q)^(2*k); if errbd < eps if errbd > eps^2 % Carry out nonequidistant FFT, fast (t) and slow (t), and record times and errors. [ t, s, errbd, err, tc, sc ] = neqfft( n, c, m, x, k, q ); % Record only runs which satisfied accuracy requirement. if err < eps kmin(i) = k; qmin(i) = q; tcpu(i) = min( tcpu(i), tc ); scpu(i) = min( scpu(i), sc ); end end end end end end hold on; plot( 20*2.^(0.5*p), tcpu ); plot( 20*2.^(0.5*p), scpu ); p scpu tcpu eps kmin qmin