This commit is contained in:
Martin Reinecke 2018-12-19 12:10:12 +01:00
parent c118c4fd61
commit b545c1cfe0
3 changed files with 49 additions and 60 deletions

View file

@ -69,7 +69,6 @@ void sharp_Ylmgen_init (sharp_Ylmgen_C *gen, int l_max, int m_max, int spin)
gen->m = -1;
if (spin==0)
{
gen->rf = RALLOC(sharp_ylmgen_dbl2,gen->lmax+2);
gen->mfac = RALLOC(double,gen->mmax+1);
gen->mfac[0] = inv_sqrt4pi;
for (int m=1; m<=gen->mmax; ++m)
@ -136,7 +135,6 @@ void sharp_Ylmgen_destroy (sharp_Ylmgen_C *gen)
DEALLOC(gen->powlimit);
if (gen->s==0)
{
DEALLOC(gen->rf);
DEALLOC(gen->mfac);
DEALLOC(gen->root);
DEALLOC(gen->iroot);
@ -163,20 +161,14 @@ void sharp_Ylmgen_prepare (sharp_Ylmgen_C *gen, int m)
if (gen->s==0)
{
gen->rf[m].f[0] = gen->root[2*m+3];
gen->rf[m].f[1] = 0.;
for (int l=m+1; l<=gen->lmax+1; ++l)
{
double tmp=gen->root[2*l+3]*gen->iroot[l+1+m]*gen->iroot[l+1-m];
gen->rf[l].f[0] = tmp*gen->root[2*l+1];
gen->rf[l].f[1] = tmp*gen->root[l+m]*gen->root[l-m]*gen->iroot[2*l-1];
}
for (int l=m; l<gen->lmax+10; ++l)
gen->eps[l] = sqrt((l*l-m*m)/(4.*l*l-1));
gen->eps[l] = gen->root[l+m]*gen->root[l-m]
*gen->iroot[2*l+1]*gen->iroot[2*l-1];
gen->alpha[0] = 1./gen->eps[m+1];
gen->alpha[1] = gen->eps[m+1]/(gen->eps[m+2]*gen->eps[m+3]);
for (int il=1, l=m+2; l<gen->lmax+5; ++il, l+=2)
gen->alpha[il+1]= ((il&1) ? -1 : 1)/(gen->eps[l+2]*gen->eps[l+3]*gen->alpha[il]);
gen->alpha[il+1]= ((il&1) ? -1 : 1)
/(gen->eps[l+2]*gen->eps[l+3]*gen->alpha[il]);
for (int il=0, l=m; l<gen->lmax+5; ++il, l+=2)
{
gen->ab[il].f[0] = ((il&1) ? -1 : 1)*gen->alpha[il]*gen->alpha[il];

View file

@ -55,10 +55,7 @@ typedef struct
int m;
/* used if s==0 */
double *mfac;
sharp_ylmgen_dbl2 *rf;
double *eps, *alpha;
double *mfac, *eps, *alpha;
sharp_ylmgen_dbl2 *ab;
/* used if s!=0 */