static inline double window_function(double index) { return besseli0(SINC_WINDOW_KAISER_BETA * sqrt(1 - index * index)); }
/************************************************************************* Modified Bessel function, second kind, order zero Returns modified Bessel function of the second kind of order zero of the argument. The range is partitioned into the two intervals [0,8] and (8, infinity). Chebyshev polynomial expansions are employed in each interval. ACCURACY: Tested at 2000 random points between 0 and 8. Peak absolute error (relative when K0 > 1) was 1.46e-14; rms, 4.26e-15. Relative error: arithmetic domain # trials peak rms IEEE 0, 30 30000 1.2e-15 1.6e-16 Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 2000 by Stephen L. Moshier *************************************************************************/ double besselk0(double x) { double result; double y; double z; double v; double b0; double b1; double b2; ap::ap_error::make_assertion(ap::fp_greater(x,0), "Domain error in BesselK0: x<=0"); if( ap::fp_less_eq(x,2) ) { y = x*x-2.0; besselmfirstcheb(1.37446543561352307156E-16, b0, b1, b2); besselmnextcheb(y, 4.25981614279661018399E-14, b0, b1, b2); besselmnextcheb(y, 1.03496952576338420167E-11, b0, b1, b2); besselmnextcheb(y, 1.90451637722020886025E-9, b0, b1, b2); besselmnextcheb(y, 2.53479107902614945675E-7, b0, b1, b2); besselmnextcheb(y, 2.28621210311945178607E-5, b0, b1, b2); besselmnextcheb(y, 1.26461541144692592338E-3, b0, b1, b2); besselmnextcheb(y, 3.59799365153615016266E-2, b0, b1, b2); besselmnextcheb(y, 3.44289899924628486886E-1, b0, b1, b2); besselmnextcheb(y, -5.35327393233902768720E-1, b0, b1, b2); v = 0.5*(b0-b2); v = v-log(0.5*x)*besseli0(x); } else { z = 8.0/x-2.0; besselmfirstcheb(5.30043377268626276149E-18, b0, b1, b2); besselmnextcheb(z, -1.64758043015242134646E-17, b0, b1, b2); besselmnextcheb(z, 5.21039150503902756861E-17, b0, b1, b2); besselmnextcheb(z, -1.67823109680541210385E-16, b0, b1, b2); besselmnextcheb(z, 5.51205597852431940784E-16, b0, b1, b2); besselmnextcheb(z, -1.84859337734377901440E-15, b0, b1, b2); besselmnextcheb(z, 6.34007647740507060557E-15, b0, b1, b2); besselmnextcheb(z, -2.22751332699166985548E-14, b0, b1, b2); besselmnextcheb(z, 8.03289077536357521100E-14, b0, b1, b2); besselmnextcheb(z, -2.98009692317273043925E-13, b0, b1, b2); besselmnextcheb(z, 1.14034058820847496303E-12, b0, b1, b2); besselmnextcheb(z, -4.51459788337394416547E-12, b0, b1, b2); besselmnextcheb(z, 1.85594911495471785253E-11, b0, b1, b2); besselmnextcheb(z, -7.95748924447710747776E-11, b0, b1, b2); besselmnextcheb(z, 3.57739728140030116597E-10, b0, b1, b2); besselmnextcheb(z, -1.69753450938905987466E-9, b0, b1, b2); besselmnextcheb(z, 8.57403401741422608519E-9, b0, b1, b2); besselmnextcheb(z, -4.66048989768794782956E-8, b0, b1, b2); besselmnextcheb(z, 2.76681363944501510342E-7, b0, b1, b2); besselmnextcheb(z, -1.83175552271911948767E-6, b0, b1, b2); besselmnextcheb(z, 1.39498137188764993662E-5, b0, b1, b2); besselmnextcheb(z, -1.28495495816278026384E-4, b0, b1, b2); besselmnextcheb(z, 1.56988388573005337491E-3, b0, b1, b2); besselmnextcheb(z, -3.14481013119645005427E-2, b0, b1, b2); besselmnextcheb(z, 2.44030308206595545468E0, b0, b1, b2); v = 0.5*(b0-b2); v = v*exp(-x)/sqrt(x); } result = v; return result; }