From 8b5c07f8055d6888459fd662c85f706ef84e0471 Mon Sep 17 00:00:00 2001 From: Franz Zotter Date: Sun, 11 Oct 2009 21:22:05 +0000 Subject: added [mtx_spherical_radial], the radial functions of the spherical base-solutions svn path=/trunk/externals/iem/iemmatrix/; revision=12577 --- src/mtx_spherical_harmonics/sph_radial.c | 82 ++++++++++++++++++++++++++++++++ src/mtx_spherical_harmonics/sph_radial.h | 26 ++++++++++ 2 files changed, 108 insertions(+) create mode 100644 src/mtx_spherical_harmonics/sph_radial.c create mode 100644 src/mtx_spherical_harmonics/sph_radial.h (limited to 'src/mtx_spherical_harmonics') diff --git a/src/mtx_spherical_harmonics/sph_radial.c b/src/mtx_spherical_harmonics/sph_radial.c new file mode 100644 index 0000000..ec3536e --- /dev/null +++ b/src/mtx_spherical_harmonics/sph_radial.c @@ -0,0 +1,82 @@ +/* + * Recursive computation of (arbitrary degree) spherical Bessel/Neumann/Hankel functions, + * according to Gumerov and Duraiswami, + * "The Fast Multipole Methods for the Helmholtz Equation in Three Dimensions", + * Elsevier, 2005. + * + * Implementation by Franz Zotter, Institute of Electronic Music and Acoustics + * (IEM), University of Music and Dramatic Arts (KUG), Graz, Austria + * http://iem.at/Members/zotter, 2007. + * + * This code is published under the Gnu General Public License, see + * "LICENSE.txt" + */ + +#include + +#include "sph_radial.h" + +#define EPS 1e-10 + +static void radialRecurrence (double x, double *y, int n); + +// the two recurrences for higher n: +// by now no numeric stabilization for the bessel function is performed + +static void radialRecurrence (double x, double *y, int n) { + int k; + for (k=1;k=0) + y[0] = (x=1) + y[1] = -cos(x)/x + y[0]/x; + post("before %f %f %f",y[0],y[1],y[2]); + radialRecurrence (x,y,n); + post("after %f %f %f",y[0],y[1],y[2]); +} + +void sphNeumann (double x, double *y, int n) { + if (y==0) + return; + if (n>=0) + y[0] = -cos(x)/x; + if (n>=1) + y[1] = ((x