SHTns
3.4.6

Rotation around axis other than Z should be considered of beta quality (they have been tested but may still contain bugs). More...
Functions  
void  SH_Zrotate (shtns_cfg shtns, cplx *Qlm, double alpha, cplx *Rlm) 
Rotate a SH representation Qlm around the zaxis by angle alpha (in radians), which is the same as rotating the reference frame by angle alpha. More...  
void  SH_Xrotate90 (shtns_cfg shtns, cplx *Qlm, cplx *Rlm) 
rotate Qlm by 90 degrees around X axis and store the result in Rlm. More...  
void  SH_Yrotate90 (shtns_cfg shtns, cplx *Qlm, cplx *Rlm) 
rotate Qlm by 90 degrees around Y axis and store the result in Rlm. More...  
void  SH_Yrotate (shtns_cfg shtns, cplx *Qlm, double alpha, cplx *Rlm) 
rotate Qlm around Y axis by arbitrary angle, using composition of rotations. Store the result in Rlm. More...  
Rotation functions  
Rotate a SH representation Qlm around the zaxis by angle alpha (in radians), which is the same as rotating the reference frame by angle alpha. Result is stored in Rlm (which can be the same array as Qlm).  
shtns_rot  shtns_rotation_create (const int lmax, const int mmax) 
Allocate memory and precompute some recurrence coefficients for rotation (independent of angle). More...  
void  shtns_rotation_destroy (shtns_rot r) 
void  shtns_rotation_set_angles_ZYZ (shtns_rot r, double alpha, double beta, double gamma) 
Set the rotation angle, and compute associated Legendre functions.  
void  shtns_rotation_set_angles_ZXZ (shtns_rot r, double alpha, double beta, double gamma) 
void  shtns_rotation_set_angle_axis (shtns_rot r, double theta, double Vx, double Vy, double Vz) 
void  shtns_rotation_wigner_d_matrix (shtns_rot r, const int l, double *mx) 
Generate sphericalharmonic rotation matrix for given degree l (Wignerd matrix), using GUMEROV's algorithm see https://arxiv.org/abs/1403.7698 or https://doi.org/10.1007/9783319132303_5 Thanks to Alex J. More...  
void  shtns_rotation_apply_cplx (shtns_rot r, cplx *Zlm, cplx *Rlm) 
rotate Zlm, store the result in Rlm, without ever storing the wignerd matrices (onthefly operation)  
void  shtns_rotation_apply_real (shtns_rot r, cplx *Qlm, cplx *Rlm) 
Rotation around axis other than Z should be considered of beta quality (they have been tested but may still contain bugs).
They also require mmax
= lmax
. They use an Algorithm inspired by the pseudospectral rotation described in Gimbutas Z. and Greengard L. 2009 "A fast and stable method for rotating spherical harmonic expansions" Journal of Computational Physics. doi:10.1016/j.jcp.2009.05.014
These functions do only require a call to shtns_create, but not to shtns_set_grid.
rotate Qlm by 90 degrees around X axis and store the result in Rlm.
Rotate SH representation around X axis by 90 degrees.
shtns>mres MUST be 1, and lmax=mmax.
rotate Qlm around Y axis by arbitrary angle, using composition of rotations. Store the result in Rlm.
Rotate SH representation around Y axis by alpha (in radians).
rotate Qlm by 90 degrees around Y axis and store the result in Rlm.
Rotate SH representation around Y axis by 90 degrees.
shtns>mres MUST be 1, and lmax=mmax.
Rotate a SH representation Qlm around the zaxis by angle alpha (in radians), which is the same as rotating the reference frame by angle alpha.
Result is stored in Rlm (which can be the same array as Qlm).
shtns_rot shtns_rotation_create  (  const int  lmax, 
const int  mmax  
) 
Allocate memory and precompute some recurrence coefficients for rotation (independent of angle).
Setting mmax < lmax will result in approximate rotations if not aligned with the zaxis, while mmax=lmax leads to exact rotations.
void shtns_rotation_wigner_d_matrix  (  shtns_rot  r, 
const int  l,  
double *  mx  
) 
Generate sphericalharmonic rotation matrix for given degree l (Wignerd matrix), using GUMEROV's algorithm see https://arxiv.org/abs/1403.7698 or https://doi.org/10.1007/9783319132303_5 Thanks to Alex J.
Yuffa, ayuff for his suggestions and help. a@gm ail.c om
[out]  mx  is an (2*l+1)*(2*l+1) array that will be filled with the Wignerd matrix elements. 