dudom
Former-commit-id: cffd4c06ee69fb27f3aacb25508bf1e0532cadc2
This commit is contained in:
parent
0df626a194
commit
37896ad022
13
qpms/vswf.c
13
qpms/vswf.c
|
@ -1,4 +1,5 @@
|
||||||
#include "vswf.h"
|
#include "vswf.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// Legendre functions also for negative m, see DLMF 14.9.3
|
// Legendre functions also for negative m, see DLMF 14.9.3
|
||||||
qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, double x, qpms_l_t lMax,
|
qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, double x, qpms_l_t lMax,
|
||||||
|
@ -25,12 +26,22 @@ qpms_errno_t qpms_legendre_deriv_y_fill(double *target, double *target_deriv, do
|
||||||
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
||||||
double factor = exp(lgamma(l-m+1)-lgamma(n+m+1))*((m%2)?-1:1);
|
double factor = exp(lgamma(l-m+1)-lgamma(n+m+1))*((m%2)?-1:1);
|
||||||
target[y] = factor * legendre_tmp[i];
|
target[y] = factor * legendre_tmp[i];
|
||||||
target_deriv[y] = factor * legendre_deriv_tmp;
|
target_deriv[y] = factor * legendre_deriv_tmp[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GSL_SF_LEGENDRE_SCHMIDT:
|
case GSL_SF_LEGENDRE_SCHMIDT:
|
||||||
case GSL_SF_LEGENDRE_SPHARM:
|
case GSL_SF_LEGENDRE_SPHARM:
|
||||||
case GSL_SF_LEGENDRE_FULL:
|
case GSL_SF_LEGENDRE_FULL:
|
||||||
|
for (qpms_l_t l = 0; l <= lMax; ++l)
|
||||||
|
for (qpms_m_t m = 1; m <= l; ++m) {
|
||||||
|
qpms_y_t y = gpms_mn2y(-m,l);
|
||||||
|
size_t i = gsl_sf_legenre_array_index(l,m);
|
||||||
|
// viz DLMF 14.9.3, čert ví, jak je to s cs fasí.
|
||||||
|
double factor = ((m%2)?-1:1); // this is the difference from the unnormalised case
|
||||||
|
target[y] = factor * legendre_tmp[i];
|
||||||
|
target_deriv[y] = factor * legendre_deriv_tmp[i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort(); //NI
|
abort(); //NI
|
||||||
break;
|
break;
|
||||||
|
|
12
qpms/vswf.h
12
qpms/vswf.h
|
@ -20,9 +20,15 @@ typedef struct {
|
||||||
} qpms_vswfset_sph_t;
|
} qpms_vswfset_sph_t;
|
||||||
|
|
||||||
|
|
||||||
double *qpms_legenre_deriv_y_get(double x, qpms_l_t lMax,
|
/*
|
||||||
gsle_sf_legendre_t lnorm, double csphase);
|
* N.B. for the norm definitions, see
|
||||||
qpms_errno_t qpms_legenre_deriv_y_fill(double *where, double x,
|
* https://www.gnu.org/software/gsl/manual/html_node/Associated-Legendre-Polynomials-and-Spherical-Harmonics.html
|
||||||
|
* ( gsl/specfunc/legendre_source.c and 7.24.2 of gsl docs
|
||||||
|
*
|
||||||
|
|
||||||
|
double *qpms_legendre_deriv_y_get(double x, qpms_l_t lMax,
|
||||||
|
gsle_sf_legendre_t lnorm, double csphase); //FIXME what about derivative?
|
||||||
|
qpms_errno_t qpms_legendre_deriv_y_fill(double *where, double *where_deriv, double x,
|
||||||
qpms_l_t lMax, gsl_sf_legendre_t lnorm, double csphase); //NI
|
qpms_l_t lMax, gsl_sf_legendre_t lnorm, double csphase); //NI
|
||||||
|
|
||||||
qpms_vswfset_sph_t *qpms_vswfset_make(qpms_l_t lMax, sph_t kdlj,
|
qpms_vswfset_sph_t *qpms_vswfset_make(qpms_l_t lMax, sph_t kdlj,
|
||||||
|
|
Loading…
Reference in New Issue