Ssht
1.3.3
Fast and exact spin spherical harmonic transforms
|
#include <stdlib.h>
#include <math.h>
#include "ssht/ssht_types.h"
#include "ssht/ssht_error.h"
#include "ssht/ssht_dl.h"
Functions | |
double | logfact (int n) |
double * | ssht_dl_calloc (int L, ssht_dl_size_t dl_size) |
int | ssht_dl_get_offset (int L, ssht_dl_size_t dl_size) |
int | ssht_dl_get_stride (int L, ssht_dl_size_t dl_size) |
void | ssht_dl_beta_risbo_full_table (double *dl, double beta, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl) |
void | ssht_dl_beta_risbo_half_table (double *dl, double beta, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl, double *signs) |
void | ssht_dl_beta_risbo_eighth_table (double *dl, double beta, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl, double *signs) |
void | ssht_dl_beta_risbo_fill_eighth2quarter_table (double *dl, double *dl8, int L, ssht_dl_size_t dl_size, ssht_dl_size_t dl8_size, int el, double *signs) |
void | ssht_dl_beta_kostelec_full_table (double *dlm1p1, double *dl, double beta, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl, double *signs) |
void | ssht_dl_beta_kostelec_line_table (double *dlm1p1_line, double *dl_line, double beta, int L, int mm, int el, double *sqrt_tbl, double *signs) |
void | ssht_dl_beta_kostelec_halfline_table (double *dlm1p1_line, double *dl_line, double beta, int L, int mm, int el, double *sqrt_tbl, double *signs) |
void | ssht_dl_halfpi_trapani_eighth_table (double *dl, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl) |
void | ssht_dl_halfpi_trapani_quarter_table (double *dl, int L, ssht_dl_size_t dl_size, int el, double *sqrt_tbl) |
void | ssht_dl_halfpi_trapani_fill_eighth2righthalf_table (double *dl, int L, ssht_dl_size_t dl_size, int el, double *signs) |
void | ssht_dl_halfpi_trapani_fill_eighth2quarter_table (double *dl, int L, ssht_dl_size_t dl_size, int el, double *signs) |
Functionality to compute Wigner plane and manage its storage.
double logfact | ( | int | n | ) |
Computes the natural logarithm of an (integer) factorial.
[in] | n | Integer to compute factorial of. |
logfactn | Natural logarithm of factorial value computed. |
void ssht_dl_beta_kostelec_full_table | ( | double * | dlm1p1, |
double * | dl, | ||
double | beta, | ||
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl, | ||
double * | signs | ||
) |
Calculates (for m = -l:l and mm = -l:l) lth plane of a d-matrix for argument beta using the recursion method given in Kostelec and Rockmore (2010) (see equations (4.5)-(4.9)). For l>1, require the dl plane to be computed already with values for l-1 and l-2. Also takes a table of precomputed square roots of integers and signs to avoid recomputing them.
[in,out] | dlm1p1 | Wigner plane. On input this should be initialised to the plane computed for el-2. On output this will be replaced with the computed plane for el. |
[in] | dl | Wigner plane already computed for el-1. |
[in] | beta | Angle to compute Wigner plan for. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_beta_kostelec_halfline_table | ( | double * | dlm1p1_line, |
double * | dl_line, | ||
double | beta, | ||
int | L, | ||
int | mm, | ||
int | el, | ||
double * | sqrt_tbl, | ||
double * | signs | ||
) |
Calculates half line of d-matrix for all m = 0:l and given mm = -l:l for argument beta using the recursion method given in Kostelec and Rockmore (2010) (see equations (4.5)-(4.9)). For l>abs(mm), require the dl plane to be computed already with values for l-1 and l-2. Also takes a table of precomputed square roots of integers and signs to avoid recomputing them.
[in,out] | dlm1p1_line | Wigner line. On input this should be initialised to the line computed for el-2. On output this will be replaced with the computed line for el. |
[in] | dl | Wigner plane already computed for el-1. |
[in] | beta | Angle to compute Wigner line for. |
[in] | L | Harmonic band-limit. |
[in] | mm | Azimuthal harmonic index to compute Wigner line for. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_beta_kostelec_line_table | ( | double * | dlm1p1_line, |
double * | dl_line, | ||
double | beta, | ||
int | L, | ||
int | mm, | ||
int | el, | ||
double * | sqrt_tbl, | ||
double * | signs | ||
) |
Calculates line of d-matrix for all m = -l:l and given mm = -l:l for argument beta using the recursion method given in Kostelec and Rockmore (2010) (see equations (4.5)-(4.9)). For l>abs(mm), require the dl plane to be computed already with values for l-1 and l-2. Also takes a table of precomputed square roots of integers and signs to avoid recomputing them.
[in,out] | dlm1p1_line | Wigner line. On input this should be initialised to the line computed for el-2. On output this will be replaced with the computed line for el. |
[in] | dl | Wigner plane already computed for el-1. |
[in] | beta | Angle to compute Wigner line for. |
[in] | L | Harmonic band-limit. |
[in] | mm | Azimuthal harmonic index to compute Wigner line for. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_beta_risbo_eighth_table | ( | double * | dl, |
double | beta, | ||
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl, | ||
double * | signs | ||
) |
Calculates (for m = -l:0 and mm = -l:m) lth plane of a d-matrix for argument beta using Risbo's recursion method. For l>0, require the dl plane to be computed already with values for l-1. Also takes a table of precomputed square roots of integers and signs to avoid recomputing them.
[in,out] | dl | Wigner plane. On input this should be initialised to the plane computed for el-1. On output this will be replaced with the computed plane for el. |
[in] | beta | Angle to compute Wigner line for. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_beta_risbo_fill_eighth2quarter_table | ( | double * | dl, |
double * | dl8, | ||
int | L, | ||
ssht_dl_size_t | dl_size, | ||
ssht_dl_size_t | dl8_size, | ||
int | el, | ||
double * | signs | ||
) |
Fill in quarter Wigner plane for m = 0:l and mm = 0:l from the eighth m = -l:0 and mm = -l:m. Takes a table of precomputed signs to avoid recomputing them.
[out] | dl | Quarter Wigner plane, computed by copying dl8 and extending with symmetries. |
[in] | dl8 | Eighth Wigner plane. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the dl memory. |
[in] | dl8_size | Size type of the dl8 memory. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_beta_risbo_full_table | ( | double * | dl, |
double | beta, | ||
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl | ||
) |
Calculates (for m = -l:l and mm = -l:l) lth plane of a d-matrix for argument beta using Risbo's recursion method. For l>0, require the dl plane to be computed already with values for l-1. Also takes a table of precomputed square roots of integers to avoid recomputing them.
[in,out] | dl | Wigner plane. On input this should be initialised to the plane computed for el-1. On output this will be replaced with the computed plane for el. |
[in] | beta | Angle to compute Wigner line for. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
none |
void ssht_dl_beta_risbo_half_table | ( | double * | dl, |
double | beta, | ||
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl, | ||
double * | signs | ||
) |
Calculates (for m = -l:l and mm = -l:l) lth plane of a d-matrix for argument beta using Risbo's recursion method. Only half of the plane is computed by recusion and symmetry is used to fill the remaining plane. For l>0, require the dl plane to be computed already with values for l-1. Also takes a table of precomputed square roots of integers and signs to avoid recomputing them.
[in,out] | dl | Wigner plane. On input this should be initialised to the plane computed for el-1. On output this will be replaced with the computed plane for el. |
[in] | beta | Angle to compute Wigner line for. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el must be precomputed (i.e. sqrt_tbl should contian 2*el+1 elements). |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
double* ssht_dl_calloc | ( | int | L, |
ssht_dl_size_t | dl_size | ||
) |
Allocate memory to store dl plane.
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate (specifying whether will need half or quarted dl plane, for example). |
dl | Pointer to dl array with memory allocated. |
int ssht_dl_get_offset | ( | int | L, |
ssht_dl_size_t | dl_size | ||
) |
Compute the offset used for accessing dl memory.
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate (specifying whether will need half or quarted dl plane, for example). |
offset | The offset to be used to access dl memory. |
int ssht_dl_get_stride | ( | int | L, |
ssht_dl_size_t | dl_size | ||
) |
Compute the stride used for accessing dl memory.
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate (specifying whether will need half or quarted dl plane, for example). |
stride | The stride to be used to access dl memory. |
void ssht_dl_halfpi_trapani_eighth_table | ( | double * | dl, |
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl | ||
) |
Calculates eighth (for m = 0:l and mm = 0:m) of lth plane of a d-matrix for PI/2 using Trapani & Navaza's recursion method. For l>0, require the dl plane to be computed already with values for l-1. Also takes a table of precomputed square roots of integers to avoid recomputing them.
[in,out] | dl | Wigner plane. On input this should be initialised to the plane computed for el-1. On output this will be replaced with the computed plane for el. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el+1 must be precomputed (i.e. sqrt_tbl should contian 2*el+2 elements). |
none |
void ssht_dl_halfpi_trapani_fill_eighth2quarter_table | ( | double * | dl, |
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | signs | ||
) |
Fill in quarter Wigner plane for m = 0:l and mm = 0:l from the eighth m = 0:l and mm = 0:m. Takes a table of precomputed signs to avoid recomputing them.
[in,out] | dl | Wigner plane. On input should contain values computed for one eighth of plane. On output will contain values computed for quarter of plane, using symmetries to fill in these values. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_halfpi_trapani_fill_eighth2righthalf_table | ( | double * | dl, |
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | signs | ||
) |
Fill in half Wigner plane for m = 0:l and mm = -l:l from the eighth m = 0:l and mm = 0:m. Takes a table of precomputed signs to avoid recomputing them.
[in,out] | dl | Wigner plane. On input should contain values computed for one eighth of plane. On output will contain values computed for right half of plane, using symmetries to fill in these values. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | signs | Precomputed array of signs. The array element at index i should contain the value (-1)^i. Values from 0 to el must be precomputed (i.e. signs should contian el+1 elements). |
none |
void ssht_dl_halfpi_trapani_quarter_table | ( | double * | dl, |
int | L, | ||
ssht_dl_size_t | dl_size, | ||
int | el, | ||
double * | sqrt_tbl | ||
) |
Calculates quarter (for m = 0:l and mm = 0:l) of lth plane of a d-matrix for PI/2 using Trapani & Navaza's recursion method. For l>0, require the dl plane to be computed already with values for l-1. Also takes a table of precomputed square roots of integers to avoid recomputing them.
[in,out] | dl | Wigner plane. On input this should be initialised to the plane computed for el-1. On output this will be replaced with the computed plane for el. |
[in] | L | Harmonic band-limit. |
[in] | dl_size | Size type of the memory to allocate. |
[in] | el | Harmonic index to compute Wigner plane for. |
[in] | sqrt_tbl | Precomputed array of square roots. The table element at index i should contain the value sqrt(i). Values from 0 to 2*el+1 must be precomputed (i.e. sqrt_tbl should contian 2*el+2 elements). |
none |