My Project
Macros | Functions
ssht_sampling.c File Reference
#include <complex.h>
#include <math.h>
#include "ssht_types.h"

Go to the source code of this file.

Macros

#define ABS(x)   ((x) >= 0 ? (x) : -(x))
 

Functions

void gauleg (double x1, double x2, double *x, double *w, int n)
 
 SSHT_COMPLEX (double)
 
double ssht_sampling_weight_dh (double theta_t, int L)
 
void ssht_sampling_gl_thetas_weights (double *thetas, double *weights, int L)
 
int ssht_sampling_mw_ntheta (int L)
 
double ssht_sampling_mw_t2theta (int t, int L)
 
int ssht_sampling_mw_nphi (int L)
 
double ssht_sampling_mw_p2phi (int p, int L)
 
int ssht_sampling_mw_n (int L)
 
double ssht_sampling_mw_ss_t2theta (int t, int L)
 
int ssht_sampling_mw_ss_ntheta (int L)
 
double ssht_sampling_mw_ss_p2phi (int p, int L)
 
int ssht_sampling_mw_ss_nphi (int L)
 
int ssht_sampling_mw_ss_n (int L)
 
double ssht_sampling_dh_t2theta (int t, int L)
 
int ssht_sampling_dh_ntheta (int L)
 
double ssht_sampling_dh_p2phi (int p, int L)
 
int ssht_sampling_dh_nphi (int L)
 
int ssht_sampling_dh_n (int L)
 
int ssht_sampling_gl_ntheta (int L)
 
double ssht_sampling_gl_p2phi (int p, int L)
 
int ssht_sampling_gl_nphi (int L)
 
int ssht_sampling_gl_n (int L)
 

Detailed Description

Functionality to define sample positions for various algorithms, to compute weights and to convert 1D and 2D harmonic indices.

Author
Jason McEwen

Definition in file ssht_sampling.c.

Macro Definition Documentation

◆ ABS

#define ABS (   x)    ((x) >= 0 ? (x) : -(x))

Definition at line 18 of file ssht_sampling.c.

Function Documentation

◆ gauleg()

void gauleg ( double  x1,
double  x2,
double *  x,
double *  w,
int  n 
)

Given the lower and upper limits of integration x1 and x2, this routine returns arrays x[1..n] and w[1..n] of length n, containing the abscissas and weights of the Gauss-Legendre n-point quadrature formula.

Parameters
[in]x1Lower bound of range.
[in]x2Upper bound of range.
[out]xNode positions (i.e. roots of Legendre polynomials).
[out]wCorresponding weights.
[in]nNumber of points (note memory must already be allocated for x and w to store n terms).
Author
Numerical recipes.

Definition at line 129 of file ssht_sampling.c.

References ABS.

Referenced by ssht_sampling_gl_thetas_weights().

◆ SSHT_COMPLEX()

SSHT_COMPLEX ( double  )

Compute weights for toroidal extension.

Parameters
[in]pInteger index to compute weight for.
[out]wCorresponding weight.
Return values
Weightvalue computed.
Author
Jason McEwen

Definition at line 37 of file ssht_sampling.c.

References SSHT_PION2.

◆ ssht_sampling_dh_n()

int ssht_sampling_dh_n ( int  L)

Compute total number of samples for Driscoll and Healy sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nNumber of samples.
Author
Jason McEwen

Definition at line 425 of file ssht_sampling.c.

◆ ssht_sampling_dh_nphi()

int ssht_sampling_dh_nphi ( int  L)

Compute number of phi samples for Driscoll and Healy sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nphiNumber of phi samples.
Author
Jason McEwen

Definition at line 410 of file ssht_sampling.c.

◆ ssht_sampling_dh_ntheta()

int ssht_sampling_dh_ntheta ( int  L)

Compute number of theta samples for Driscoll and Healy sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nthetaNumber of theta samples.
Author
Jason McEwen

Definition at line 376 of file ssht_sampling.c.

◆ ssht_sampling_dh_p2phi()

double ssht_sampling_dh_p2phi ( int  p,
int  L 
)

Convert phi index to angle for Driscoll and Healy sampling.

Note
  • p ranges from [0 .. 2*L-2] => 2*L-1 points in [0,2*pi).
Parameters
[in]pPhi index.
[in]LHarmonic band-limit.
Return values
phiPhi angle.
Author
Jason McEwen

Definition at line 395 of file ssht_sampling.c.

References SSHT_PI.

◆ ssht_sampling_dh_t2theta()

double ssht_sampling_dh_t2theta ( int  t,
int  L 
)

Convert theta index to angle for Driscoll and Healy sampling.

Note
  • t ranges from [0 .. 2*L-1] => 2*L points in (0,pi).
Parameters
[in]tTheta index.
[in]LHarmonic band-limit.
Return values
thetaTheta angle.
Author
Jason McEwen

Definition at line 361 of file ssht_sampling.c.

References SSHT_PI.

Referenced by ssht_core_dh_inverse_sov(), and ssht_core_dh_inverse_sov_real().

◆ ssht_sampling_gl_n()

int ssht_sampling_gl_n ( int  L)

Compute total number of samples for Gauss-Legendre sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nNumber of samples.
Author
Jason McEwen

Definition at line 489 of file ssht_sampling.c.

◆ ssht_sampling_gl_nphi()

int ssht_sampling_gl_nphi ( int  L)

Compute number of phi samples for Gauss-Legendre sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nphiNumber of phi samples.
Author
Jason McEwen

Definition at line 474 of file ssht_sampling.c.

◆ ssht_sampling_gl_ntheta()

int ssht_sampling_gl_ntheta ( int  L)

Compute number of theta samples for Gauss-Legendre sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nthetaNumber of theta samples.
Author
Jason McEwen

Definition at line 440 of file ssht_sampling.c.

◆ ssht_sampling_gl_p2phi()

double ssht_sampling_gl_p2phi ( int  p,
int  L 
)

Convert phi index to angle for Gauss-Legendre sampling.

Note
  • p ranges from [0 .. 2*L-2] => 2*L-1 points in [0,2*pi).
Parameters
[in]pPhi index.
[in]LHarmonic band-limit.
Return values
phiPhi angle.
Author
Jason McEwen

Definition at line 459 of file ssht_sampling.c.

References SSHT_PI.

◆ ssht_sampling_gl_thetas_weights()

void ssht_sampling_gl_thetas_weights ( double *  thetas,
double *  weights,
int  L 
)

Compute Gauss-Legendre theta positions (roots of Legendre polynomials) and corresponding weights.

Parameters
[out]thetasL theta positions (memory must already be allocated to store the L theta positions).
[out]weightsCorresponding weights (memory must already be allocated to store the L weights corresponding to each theta position).
[in]LHarmonic band-limit.
Return values
none
Author
Jason McEwen

Definition at line 94 of file ssht_sampling.c.

References gauleg().

Referenced by ssht_core_gl_forward_sov(), ssht_core_gl_forward_sov_real(), ssht_core_gl_inverse_sov(), and ssht_core_gl_inverse_sov_real().

◆ ssht_sampling_mw_n()

int ssht_sampling_mw_n ( int  L)

Compute total number of samples for McEwen and Wiaux sampling.

/note Computes number of samples on sphere, not over extended domain.

Parameters
[in]LHarmonic band-limit.
Return values
nNumber of samples.
Author
Jason McEwen

Definition at line 249 of file ssht_sampling.c.

◆ ssht_sampling_mw_nphi()

int ssht_sampling_mw_nphi ( int  L)

Compute number of phi samples for McEwen and Wiaux sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nphiNumber of phi samples.
Author
Jason McEwen

Definition at line 212 of file ssht_sampling.c.

◆ ssht_sampling_mw_ntheta()

int ssht_sampling_mw_ntheta ( int  L)

Compute number of theta samples for McEwen and Wiaux sampling.

/note Computes number of samples in (0,pi], not over extended domain.

Parameters
[in]LHarmonic band-limit.
Return values
nthetaNumber of theta samples.
Author
Jason McEwen

Definition at line 178 of file ssht_sampling.c.

◆ ssht_sampling_mw_p2phi()

double ssht_sampling_mw_p2phi ( int  p,
int  L 
)

Convert phi index to angle for McEwen and Wiaux sampling.

Note
  • p ranges from [0 .. 2*L-2] => 2*L-1 points in [0,2*pi).
Parameters
[in]pPhi index.
[in]LHarmonic band-limit.
Return values
phiPhi angle.
Author
Jason McEwen

Definition at line 231 of file ssht_sampling.c.

References SSHT_PI.

Referenced by ssht_adjoint_mw_forward_sov_sym_pole(), ssht_adjoint_mw_inverse_sov_sym_pole(), ssht_core_mw_forward_sov_conv_sym_pole(), and ssht_core_mw_inverse_sov_sym_pole().

◆ ssht_sampling_mw_ss_n()

int ssht_sampling_mw_ss_n ( int  L)

Compute total number of samples for McEwen and Wiaux symmetric sampling.

/note Computes number of samples on sphere, not over extended domain.

Parameters
[in]LHarmonic band-limit.
Return values
nNumber of samples.
Author
Jason McEwen

Definition at line 342 of file ssht_sampling.c.

◆ ssht_sampling_mw_ss_nphi()

int ssht_sampling_mw_ss_nphi ( int  L)

Compute number of phi samples for McEwen and Wiaux symmetric sampling.

Parameters
[in]LHarmonic band-limit.
Return values
nphiNumber of phi samples.
Author
Jason McEwen

Definition at line 323 of file ssht_sampling.c.

◆ ssht_sampling_mw_ss_ntheta()

int ssht_sampling_mw_ss_ntheta ( int  L)

Compute number of theta samples for McEwen and Wiaux symmetric sampling.

/note Computes number of samples in [0,pi], not over extended domain.

Parameters
[in]LHarmonic band-limit.
Return values
nthetaNumber of theta samples.
Author
Jason McEwen

Definition at line 288 of file ssht_sampling.c.

◆ ssht_sampling_mw_ss_p2phi()

double ssht_sampling_mw_ss_p2phi ( int  p,
int  L 
)

Convert phi index to angle for McEwen and Wiaux symmetric sampling.

Note
  • p ranges from [0 .. 2*L-1] => 2*L points in [0,2*pi).
Parameters
[in]pPhi index.
[in]LHarmonic band-limit.
Return values
phiPhi angle.
Author
Jason McEwen

Definition at line 307 of file ssht_sampling.c.

References SSHT_PI.

Referenced by ssht_adjoint_mw_forward_sov_sym_ss_pole(), ssht_adjoint_mw_inverse_sov_sym_ss_pole(), ssht_core_mw_forward_sov_conv_sym_ss_pole(), and ssht_core_mw_inverse_sov_sym_ss_pole().

◆ ssht_sampling_mw_ss_t2theta()

double ssht_sampling_mw_ss_t2theta ( int  t,
int  L 
)

Convert theta index to angle for McEwen and Wiaux symmetric sampling.

Note
  • t ranges from [0 .. 2*L-1] => 2*L points in (0,2*pi).
Parameters
[in]tTheta index.
[in]LHarmonic band-limit.
Return values
thetaTheta angle.
Author
Jason McEwen

Definition at line 269 of file ssht_sampling.c.

References SSHT_PI.

Referenced by ssht_core_mwdirect_inverse_ss().

◆ ssht_sampling_mw_t2theta()

double ssht_sampling_mw_t2theta ( int  t,
int  L 
)

Convert theta index to angle for McEwen and Wiaux sampling.

Note
  • t ranges from [0 .. 2*L-2] => 2*L-1 points in (0,2*pi).
Parameters
[in]tTheta index.
[in]LHarmonic band-limit.
Return values
thetaTheta angle.
Author
Jason McEwen

Definition at line 197 of file ssht_sampling.c.

References SSHT_PI.

Referenced by ssht_core_mwdirect_inverse(), and ssht_core_mwdirect_inverse_sov().

◆ ssht_sampling_weight_dh()

double ssht_sampling_weight_dh ( double  theta_t,
int  L 
)

Compute Driscoll and Healy weights.

Parameters
[in]theta_tTheta value to compute weight for.
[in]LHarmonic band-limit. return w Weight value computed.
Author
Jason McEwen

Definition at line 65 of file ssht_sampling.c.