Spherical harmonics functions


I’m looking at using spherical harmonic coefficients in a Stan model. For now, they wouldn’t depend on parameters, so I could precalculate them and load them via data but it’d be nice to compute them in a transformed data section. I noticed Boost has an implementation with real and imaginary parts separated. Would this be a useful thing to contribute to Stan?


This is on my list as part of plan to support PDE solution. It’d be great if someone is also ineterested and can contribute, so we can more or less cross special-domain Laplace equation from the list.


We’re interested in SHT of neural field equations involving delays. I’m not an expert in PDEs but happy to help.

Looking into SH definitions, it seems prudent to implement in Stan instead of reusing Boost as we’d get AD for free.

What else is on your list? Sparse linear solvers? I’ve noticed PDEs are a numerical analysis rabbit hole so I’m wary of going too deep.


You’re absolutely right. It’s not realistic to reinvent the wheel by putting a PDE solver inside Stan. So my plan is to link a library with adjoint equation capability. In general this would be a mostly a FEM solver. But for special treatment like Laplace equation and wave-like equation we can certainly use SH or any other solutions for better accuracy.