Fix legendre function indexing. Test pass for even m now.

Former-commit-id: 2bd5bfddc3eab30a0e1e7590d18f31bf5098d54e
This commit is contained in:
Marek Nečada 2018-09-07 20:11:50 +00:00
parent 1fca413cab
commit bad8105c9b
2 changed files with 2 additions and 2 deletions

View File

@ -317,7 +317,7 @@ int ewald32_sigma_short_shiftedpoints(
if((m+n) % 2 != 0) // odd coefficients are zero.
continue; // nothing needed, already done by memset
complex double e_imf = cexp(I*m*Rpq_shifted_arg);
double leg = c->legendre0[gsl_sf_legendre_array_index(n, m)];
double leg = c->legendre0[gsl_sf_legendre_array_index(n, abs(m))];
qpms_y_t y = qpms_mn2y_sc(m,n);
if(err)
kahanadd(err + y, err_c + y, cabs(leg * (prefacn / I) * R_pq_pown

View File

@ -175,7 +175,7 @@ ewaldtest_triang_results *ewaldtest_triang(const ewaldtest_triang_params p) {
complex double eimf = cexp(I*m*arg_pq);
results->regsigmas_416[y] +=
4*M_PI*ipow(n)/p.k/A
* eimf * legendres[gsl_sf_legendre_array_index(n,m)]
* eimf * legendres[gsl_sf_legendre_array_index(n,abs(m))]
/ denom;
}
}