indent
Former-commit-id: a56647c77be3363a71248e7ade21dd52b1d515a8
This commit is contained in:
parent
f943cc0cdb
commit
5e45afad38
|
@ -20,7 +20,8 @@
|
||||||
* error/inconsintency in Xu's paper or something else)
|
* error/inconsintency in Xu's paper or something else)
|
||||||
* Anyway, the zeroes give the correct _numerical_ values according to Xu's
|
* Anyway, the zeroes give the correct _numerical_ values according to Xu's
|
||||||
* paper tables (without Xu's typos, of course), while
|
* paper tables (without Xu's typos, of course), while
|
||||||
* the predefined macros give the correct translations of the VSWFs.
|
* the predefined macros give the correct translations of the VSWFs for the
|
||||||
|
* QPMS_NORMALIZATION_TAYLOR_CS norm.
|
||||||
*/
|
*/
|
||||||
#if !(defined AN0 || defined AN1 || defined AN2 || defined AN3)
|
#if !(defined AN0 || defined AN1 || defined AN2 || defined AN3)
|
||||||
#pragma message "using AN1 macro as default"
|
#pragma message "using AN1 macro as default"
|
||||||
|
@ -65,75 +66,7 @@ static const double sqrtpi = 1.7724538509055160272981674833411451827975494561223
|
||||||
|
|
||||||
// Associated Legendre polynomial at zero argument (DLMF 14.5.1)
|
// Associated Legendre polynomial at zero argument (DLMF 14.5.1)
|
||||||
double qpms_legendre0(int m, int n) {
|
double qpms_legendre0(int m, int n) {
|
||||||
return pow(2,m) * sqrtpi / tgamma(.5*n - .5*m + .5) / tgamma(.5*n-.5*m);
|
TAYLOR:
|
||||||
}
|
|
||||||
|
|
||||||
static inline int min1pow(int x) {
|
|
||||||
return (x % 2) ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline complex double ipow(int x) {
|
|
||||||
return cpow(I, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Derivative of associated Legendre polynomial at zero argument (DLMF 14.5.2)
|
|
||||||
double qpms_legendreD0(int m, int n) {
|
|
||||||
return -2 * qpms_legendre0(m, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline int imin(int x, int y) {
|
|
||||||
return x > y ? y : x;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The uppermost value of q index for the B coefficient terms from [Xu](60).
|
|
||||||
// N.B. this is different from [Xu_old](79) due to the n vs. n+1 difference.
|
|
||||||
// However, the trailing terms in [Xu_old] are analytically zero (although
|
|
||||||
// the numerical values will carry some non-zero rounding error).
|
|
||||||
static inline int gauntB_Q_max(int M, int n, int mu, int nu) {
|
|
||||||
return imin(n, imin(nu, (n+nu+1-abs(M+mu))/2));
|
|
||||||
}
|
|
||||||
|
|
||||||
int qpms_sph_bessel_fill(qpms_bessel_t typ, int lmax, double x, complex double *result_array) {
|
|
||||||
int retval;
|
|
||||||
double tmparr[lmax+1];
|
|
||||||
switch(typ) {
|
|
||||||
case QPMS_BESSEL_REGULAR:
|
|
||||||
retval = gsl_sf_bessel_jl_steed_array(lmax, x, tmparr);
|
|
||||||
for (int l = 0; l <= lmax; ++l) result_array[l] = tmparr[l];
|
|
||||||
return retval;
|
|
||||||
break;
|
|
||||||
case QPMS_BESSEL_SINGULAR: //FIXME: is this precise enough? Would it be better to do it one-by-one?
|
|
||||||
retval = gsl_sf_bessel_yl_array(lmax,x,tmparr);
|
|
||||||
for (int l = 0; l <= lmax; ++l) result_array[l] = tmparr[l];
|
|
||||||
return retval;
|
|
||||||
break;
|
|
||||||
case QPMS_HANKEL_PLUS:
|
|
||||||
case QPMS_HANKEL_MINUS:
|
|
||||||
retval = gsl_sf_bessel_jl_steed_array(lmax, x, tmparr);
|
|
||||||
for (int l = 0; l <= lmax; ++l) result_array[l] = tmparr[l];
|
|
||||||
if(retval) return retval;
|
|
||||||
retval = gsl_sf_bessel_yl_array(lmax, x, tmparr);
|
|
||||||
if (typ==QPMS_HANKEL_PLUS)
|
|
||||||
for (int l = 0; l <= lmax; ++l) result_array[l] += I * tmparr[l];
|
|
||||||
else
|
|
||||||
for (int l = 0; l <= lmax; ++l) result_array[l] +=-I * tmparr[l];
|
|
||||||
return retval;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
abort();
|
|
||||||
//return GSL_EDOM;
|
|
||||||
}
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline double qpms_trans_normlogfac(qpms_normalisation_t norm,
|
|
||||||
int m, int n, int mu, int nu) {
|
|
||||||
//int csphase = qpms_normalisation_t csphase(norm); // probably not needed here
|
|
||||||
norm = qpms_normalisation_t_normonly(norm);
|
|
||||||
switch(norm) {
|
|
||||||
case QPMS_NORMALISATION_KRISTENSSON:
|
|
||||||
case QPMS_NORMALISATION_TAYLOR:
|
|
||||||
return -0.5*(lgamma(n+m+1)-lgamma(n-m+1)+lgamma(nu-mu+1)-lgamma(nu+mu+1));
|
return -0.5*(lgamma(n+m+1)-lgamma(n-m+1)+lgamma(nu-mu+1)-lgamma(nu+mu+1));
|
||||||
break;
|
break;
|
||||||
case QPMS_NORMALISATION_XU:
|
case QPMS_NORMALISATION_XU:
|
||||||
|
@ -141,11 +74,11 @@ static inline double qpms_trans_normlogfac(qpms_normalisation_t norm,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double qpms_trans_normfac(qpms_normalisation_t norm,
|
static inline double qpms_trans_normfac(qpms_normalisation_t norm,
|
||||||
int m, int n, int mu, int nu) {
|
/*dest*/int m, int n, /*src*/int mu, int nu) {
|
||||||
int csphase = qpms_normalisation_t_csphase(norm); // FIXME USEME TODO
|
int csphase = qpms_normalisation_t_csphase(norm); // FIXME USEME TODO
|
||||||
norm = qpms_normalisation_t_normonly(norm);
|
norm = qpms_normalisation_t_normonly(norm);
|
||||||
double normfac = 1.;
|
double normfac = 1.;
|
||||||
|
@ -1182,13 +1115,13 @@ int qpms_cython_trans_calculator_get_AB_arrays_loop(
|
||||||
|
|
||||||
int errval = 0;
|
int errval = 0;
|
||||||
// TODO here start parallelisation
|
// TODO here start parallelisation
|
||||||
//#pragma omp parallel
|
//#pragma omp parallel
|
||||||
{
|
{
|
||||||
npy_intp local_indices[resnd];
|
npy_intp local_indices[resnd];
|
||||||
memset(local_indices, 0, sizeof(local_indices));
|
memset(local_indices, 0, sizeof(local_indices));
|
||||||
int errval_local = 0;
|
int errval_local = 0;
|
||||||
size_t longi;
|
size_t longi;
|
||||||
//#pragma omp for
|
//#pragma omp for
|
||||||
for(longi = 0; longi < longlen; ++longi) {
|
for(longi = 0; longi < longlen; ++longi) {
|
||||||
// this might be done also in the inverse order, but this is more
|
// this might be done also in the inverse order, but this is more
|
||||||
// 'c-contiguous' way of incrementing the indices
|
// 'c-contiguous' way of incrementing the indices
|
||||||
|
|
Loading…
Reference in New Issue