I think there's a bug for the SHRotate.m, where the computation for R1 matrix is incorrect. Need to recheck the first order spherical harmonic bases for this algorithm. I think some minus signs should be put in front of these matrix coefficients. Because the 1st order bases are actually (m from -1 to 1): -sin(theta)sin(phi), cos(theta), sin(theta)cos(phi).
However, it is a good code:)

4

25 Sep 2014

Spherical Harmonics
This function generates the Spherical Harmonics basis functions of degree L and order M.

Nice function.
An interesting improvement would be to use the Schmidt semi-normalised Legendre functions as to avoid the use of factorials, which would make the output much more accurate for high L values.

Comment only