simplify normalisation for derivatives

This commit is contained in:
Martin Reinecke 2012-07-06 11:30:53 +02:00
parent 82dc2a541f
commit 0d8c5eae3f
3 changed files with 20 additions and 3 deletions

View file

@ -405,8 +405,7 @@ static void alm2almtmp (sharp_job *job, int lmax, int mi)
for (int l=job->ainfo->mval[mi]; l<=lmax; ++l)
{
ptrdiff_t aidx = sharp_alm_index(job->ainfo,l,mi);
double fct = (job->type==ALM2MAP) ? job->norm_l[l] :
fabs(job->norm_l[l])*sqrt(l*(l+1.));
double fct = job->norm_l[l];
for (int i=0; i<job->ntrans*job->nalm; ++i)
if (job->fde==DOUBLE)
job->almtmp[job->ntrans*job->nalm*l+i]
@ -464,7 +463,9 @@ void sharp_execute_job (sharp_job *job)
int lmax = job->ainfo->lmax,
mmax=sharp_get_mmax(job->ainfo->mval, job->ainfo->nm);
job->norm_l = sharp_Ylmgen_get_norm (lmax, job->spin);
job->norm_l = (job->type==ALM2MAP_DERIV1) ?
sharp_Ylmgen_get_d1norm (lmax) :
sharp_Ylmgen_get_norm (lmax, job->spin);
/* clear output arrays if requested */
init_output (job);

View file

@ -205,3 +205,13 @@ double *sharp_Ylmgen_get_norm (int lmax, int spin)
res[l] = (l<spin) ? 0. : spinsign*0.5*sqrt((2*l+1)/(4*pi));
return res;
}
double *sharp_Ylmgen_get_d1norm (int lmax)
{
const double pi = 3.141592653589793238462643383279502884197;
double *res=RALLOC(double,lmax+1);
for (int l=0; l<=lmax; ++l)
res[l] = (l<1) ? 0. : 0.5*sqrt(l*(l+1.)*(2*l+1.)/(4*pi));
return res;
}

View file

@ -85,6 +85,12 @@ void sharp_Ylmgen_prepare (sharp_Ylmgen_C *gen, int m);
\a spin. The array must be deallocated (using free()) by the user. */
double *sharp_Ylmgen_get_norm (int lmax, int spin);
/*! Returns a pointer to an array with \a lmax+1 entries containing
normalisation factors that must be applied to Y_lm values computed for
first derivatives. The array must be deallocated (using free()) by the
user. */
double *sharp_Ylmgen_get_d1norm (int lmax);
#ifdef __cplusplus
}
#endif