How do I call FastTransforms.jl to get a complex spherical harmonics

I am looking for a package that can calculate the spherical harmonic function, and I expect it to be able to directly give the value of the spherical harmonic function Y_{l,m}(\theta,\phi) , when given input l, m ,\theta , \phi .

Then I found that there was a function FastTransforms.sphevaluate) in JuliaApproximation/FastTransforms.jl that could compute the real orthonormal spherical harmonic, but I didn’t find how to compute the complex orthonormal spherical harmonic

SphericalHarmonics.jl seems to meet my needs, but it only has six stars, I’m not sure about its performance and stability.

Do you have any suggestions?

does FastSphericalHarmonics.jl do what you want?
Sure its star count is 9 >> 0 for a specialty package. note the version – it is stable.
The author is respected. I do not know about the other pkg.

Yeah, the number of stars is not a particularly reliable indicator. My heuristics : are there automatic tests, is there a commit in the last N months, is there any important PR unmerged, is there any scary issue without comment from the maintainers, have the committers authored other julia packages.

SphericalHarmonics.jl should give you what you want. I’m the person maintaining it, but I haven’t had time to get around to it recently. Nevertheless, it should give you what you want, although the API would change with the next breaking release. It should be performant as well.

In any case, the way to go from real to complex harmonics is to compute something like Complex(Ylm(l,m), Ylm(l,-m))/sqrt(2) for m > 0, and Ylm(l,m) for m==0.

julia> ylmFT(θ, ϕ, l, m) = Complex(FastTransforms.sphevaluate(θ, ϕ, l, m), FastTransforms.sphevaluate(θ, ϕ, l, -m))/√2
ylmFT (generic function with 1 method)

julia> ylmFT(pi/3, pi/6, 100, 20)
-0.06360367043855313 - 0.11016478874744044im

julia> SphericalHarmonics.sphericalharmonic(pi/3, pi/6, 100, 20)
-0.06360367043855136 - 0.11016478874743722im

julia> SphericalHarmonics.sphericalharmonic(pi/3, pi/4, 100, 0)

julia> FastTransforms.sphevaluate(pi/3, pi/4, 100, 0)

To be honest, I can’t quite understand how to use this package.

This is a nice idea, but I was curious that FastTransforms.jl could compute the real Orthonormal Harmonic, but there is no interface for complex spherical harmonics.

Yes, it can give me what I want, but I don’t know if it’s reliable

If you don’t know, then you shouldn’t care.

I think they have special algorithms that compute spherical harmonic transforms for real harmonics, so they also have a function to compute these harmonics. It can definitely be extended to complex harmonics, and this would be quite convenient. I guess no one has done it yet.