- marked as proposal
Complex scalar transforms for mmax<lmax
Hi Nathanael,
Does the fortran subroutine
shtns_sh_to_spat_cplx(alm,z) and shtns_spat_cplx_to_SH(z,alm)
work for the case when mmax < lmax? If it does work, how is the SH coefficient stored in the array alm? Thanks!
Comments (10)
-
reporter -
repo owner Hello,
That is a good question!
It turns out it works for mmax<lmax, but with the same storage convention as for mmax=lmax. This means that the storage for all coefficients up to m=lmax must be provided, but the coefficients for m>mmax are simply ignored. This is of course a huge waste of space when mmax << lmax. I never though about this issue, so I'm open to ideas for a better storage scheme.
-
reporter Hello,
It's good to know that it works for mmax<lmax. About storage scheme for the SH coefficients in fortran, I have the following suggetion:
for l =0, mmax SH_coef( m, l ) = alm( l(l+1) + m +1 ), for l = mmax+1, lmax SH_coef( m, l ) = alm( (mmax+1)^2 + (2*mmax+1)*(l-mmax-1) + m+mmax+1 )
Is it easy to make such a change in your code?
-
repo owner Hi,
Fairly easy. I just pushed a new commit with your storage scheme implemented.
sht_func.c
is the only file that has changed, and you can grab it here.Please check that it works as intended, any feedback appreciated.
Cheers,
-
reporter Hi,
Have you resolved this error message yet? This is the error message when I set mmax<lmax. I only need mres=1, which is not a problem for me. Thanks!
[SHTns] Run-time error : complex SH requires lmax=mmax and mres=1.
-
repo owner Yes, this error message is gone.
-
reporter By the way, are the subroutines and functions in your library thread-safe? I am thinking use them within a paralleled do loop.
-
repo owner Yes, all the full-transform (which means function that have inverse counterparts) routines are guaranteed thread-safe. The routines that are not thread-safe are
*_to_lat()
.If you do this, don't forget to disable the internal use of threads, with a call to
shtns_use_threads(1)
-
reporter Hello,
The updated version works fine as desired. Thank you very much!
-
reporter - changed status to resolved
- Log in to comment