Dudom. Implementace besselových fcí v chodu.

Former-commit-id: 63827799543f410dfb1a83cab7ca10287d76f7c2
This commit is contained in:
Marek Nečada 2018-03-14 17:17:52 +02:00
parent fb9bbff4b8
commit e06cdd3171
2 changed files with 30 additions and 0 deletions

View File

@ -1,8 +1,11 @@
#include <assert.h> #include <assert.h>
#include "qpms_specfunc.h" #include "qpms_specfunc.h"
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h>
#include <kahansum.h>
#include <gsl/gsl_sf_bessel.h> #include <gsl/gsl_sf_bessel.h>
// There is a big issue with gsl's precision of spherical bessel function; these have to be implemented differently
qpms_errno_t qpms_sph_bessel_fill(qpms_bessel_t typ, qpms_l_t lmax, double x, complex double *result_array) { qpms_errno_t qpms_sph_bessel_fill(qpms_bessel_t typ, qpms_l_t lmax, double x, complex double *result_array) {
int retval; int retval;
double tmparr[lmax+1]; double tmparr[lmax+1];
@ -36,3 +39,16 @@ qpms_errno_t qpms_sph_bessel_fill(qpms_bessel_t typ, qpms_l_t lmax, double x, co
assert(0); assert(0);
} }
static inline ptrdiff_t akn_index(qpms_l_t n, qpms_l_t k) {
assert(k <= n);
return ((ptrdiff_t) n + 1) * n / 2 + k;
}
static inline ptrdiff_t bkn_index(qpms_l_t n, qpms_l_t k) {
assert(k <= n+1);
return ((ptrdiff_t) n + 2) * (n + 1) / 2 - 1 + k;
}
qpms_bessel_calculator_t *qpms_bessel_calculator_init(...){
TODO dudom;
}

View File

@ -11,6 +11,20 @@
qpms_errno_t qpms_sph_bessel_fill(qpms_bessel_t typ, qpms_l_t lmax, double x, complex double *result_array); qpms_errno_t qpms_sph_bessel_fill(qpms_bessel_t typ, qpms_l_t lmax, double x, complex double *result_array);
typedef struct qpms_bessel_calculator_t {
qpms_l_t lMax;
double *akn; // coefficients as in DLMF 10.49.1
complex double *bkn; // coefficients of the derivatives
};
qpms_bessel_calculator_t *qpms_bessel_calculator_init(qpms_l_t lMax);
void qpms_bessel_calculator_free(qpms_bessel_calculator_t *c);
qpms_errno_t qpms_sph_bessel_calc_fill(qpms_bessel_calculator_t *c, qpms_bessel_t typ, qpms_l_t lmax,
double x, complex double *result_array);
/****************************************************************************** /******************************************************************************
* Legendre functions and their "angular derivatives" * * Legendre functions and their "angular derivatives" *
******************************************************************************/ ******************************************************************************/