aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mtx_sh/legendre_a.c11
-rw-r--r--src/mtx_sh/sharmonics.c10
2 files changed, 11 insertions, 10 deletions
diff --git a/src/mtx_sh/legendre_a.c b/src/mtx_sh/legendre_a.c
index 687cb41..d4e53f4 100644
--- a/src/mtx_sh/legendre_a.c
+++ b/src/mtx_sh/legendre_a.c
@@ -25,15 +25,8 @@ static void legendre_first_recurrence (double *sintheta, LegendreWorkSpace *wl)
// computes the legendre functions P_n^m(costheta) for m=n
// from P_0^0
for (n=1; n<=wl->nmax; n++) {
- if ((n%2)==1) {
- for (l=0,l0=0; l<wl->l; l++,l0+=incr) {
- wl->p[l0+n0+n] = -(2*n-1) * wl->p[l0+nmo0+n-1] * sintheta[l];
- }
- }
- else {
- for (l=0,l0=0; l<wl->l; l++,l0+=incr) {
- wl->p[l0+n0+n] = -(2*n-1) * wl->p[l0+nmo0+n-1];
- }
+ for (l=0,l0=0; l<wl->l; l++,l0+=incr) {
+ wl->p[l0+n0+n] = -(2*n-1) * wl->p[l0+nmo0+n-1] * sintheta[l];
}
nmo0=n0;
n0+=n+1;
diff --git a/src/mtx_sh/sharmonics.c b/src/mtx_sh/sharmonics.c
index 57f7367..8593182 100644
--- a/src/mtx_sh/sharmonics.c
+++ b/src/mtx_sh/sharmonics.c
@@ -56,7 +56,15 @@ static void sharmonics_multcheby12(SHWorkSpace *ws) {
const int yincr=(ws->nmax+1)*(ws->nmax+1);
for (n=0,ny0=0; n<=ws->nmax; n++) {
- for (m=0; m<=n; m++) {
+ m=0;
+ ly0=0;
+ lt0=nt0;
+ for (l=0; l<ws->l; l++) {
+ ws->y[ly0+ny0+m]*= ws->wc->t[lt0+m];
+ ly0+=yincr;
+ lt0+=tincr;
+ }
+ for (m=1; m<=n; m++) {
ly0=0;
lt0=nt0;
for (l=0; l<ws->l; l++) {