Added sharp_make_mmajor_real_packed_alm_info

This commit is contained in:
Dag Sverre Seljebotn 2015-03-29 22:41:37 +02:00
parent e36488996f
commit c50c0fe27a
4 changed files with 53 additions and 15 deletions

View file

@ -68,3 +68,27 @@ void sharp_make_rectangular_alm_info (int lmax, int mmax, int stride,
}
*alm_info = info;
}
void sharp_make_mmajor_real_packed_alm_info (int lmax, int stride,
int nm, const int *ms, sharp_alm_info **alm_info)
{
ptrdiff_t idx;
int f;
sharp_alm_info *info = RALLOC(sharp_alm_info,1);
info->lmax = lmax;
info->nm = nm;
info->mval = RALLOC(int,nm);
info->mvstart = RALLOC(ptrdiff_t,nm);
info->stride = stride;
info->flags = SHARP_PACKED | SHARP_REAL_HARMONICS;
idx = 0; /* tracks the number of 'consumed' elements so far; need to correct by m */
for (int im=0; im!=nm; ++im)
{
int m=(ms==NULL)?im:ms[im];
f = (m==0) ? 1 : 2;
info->mval[im] = m;
info->mvstart[im] = stride * (idx - f * m);
idx += f * (lmax + 1 - m);
}
*alm_info = info;
}