Complex scalar transforms
Hi Nathanael,
You make a note in the following page that "SHTns only deals with real spatial data", but you do have two subroutines SH_to_spat_cplx and spat_cplx_to_SH which deal with complex scalar synthesis and analysis. I guess your note about dealing with only real spatial data is outdated, am I right? https://users.isterre.fr/nschaeff/SHTns/spec.html
My second question is about the input and output variables z and alm of the subroutines SH_to_spat_cplx and spat_cplx_to_SH. How do I call them from fortran code? I didn't find the corresponding subroutines in the fortran API. All my following questions are within the context of fortran. You indicate that alm[l*(l+1)+m] is the SH coefficient of order l and degree m (with -l <= m <= l). Do you imply that the indices of alm start at 0? Because for l=0 and m=0, the coefficient is alm(0). Also it is unclear to me what kind of arrary is z? Is it a two dimension array or one dimension? Do the indices start at 0 or 1?
Any help will be greatly appreciated!
Comments (3)
-
repo owner -
reporter Thanks again!
You have clarified all the questions I have so far. I also successfully called the two subroutines SH_to_spat_cplx and spat_cplx_to_SH. You may already know that your work is very valuable to atomic physics, because in many cases one needs to expand the electron wave function in spherical harmonics.
-
reporter - changed status to resolved
- Log in to comment
Hello,
1) Indeed, this part of the doc is outdated.
2) The Fortran interface is included, but was not documented. From Fortran, you should have access to subroutines
shtns_sh_to_spat_cplx(alm, z)
andshtns_spat_cplx_to_sh(z, alm)
.3) Usage: the doc is for C, which has arrays starting from 0. Simply add 1 to the indices to have Fortran-base indexing: in a Fortran code, you would use
alm( l*(l+1)+m+1 )
to access complex coeficient of degree l and order m.Assuming you use
layout = SHT_PHI_CONTIGUOUS
(see Fortran example),z
is a 2D array defined byz(1:nphi, 1:nlat)
Note that both
alm
andz
are complex-valued arrays. I hope this clarifies the situation, do not hesitate to ask further questions.