/** * Benchmark kernels for digital signal processing. The four kernels are * sinc interpolation, recursive filtering, convolution, and fast Fourier * transform. *

* This program is self-contained. It depends on only standard Java class * libraries. * @author Dave Hale, Colorado School of Mines * @version 2005.10.06 */ public class DspBench { public static void main(String[] args) { for (int i=0; i<3; ++i) { benchConvolution(); benchRecursiveFilter(); benchFft(); benchSincInterpolation(); } } private static final double MAXTIME = 2.0; private static void benchSincInterpolation() { int nxin = 10000; float dxin = 1.0f+1.0f/(float)nxin; float fxin = -0.5f/(float)nxin; float[] yin = ramp(nxin); int nxout = 10000; float[] xout = ramp(nxout); float[] yout = ramp(nxout); Stopwatch sw = new Stopwatch(); int nloop = 0; int nflop = 2*LSINC*nxout; for (sw.start(); sw.time()