so3  1.3.0
Fast and exact Wigner transforms
Macros | Functions
so3_sampling.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#include "so3/so3_error.h"
#include "so3/so3_types.h"
Include dependency graph for so3_sampling.c:

Macros

#define MAX(a, b)   ((a > b) ? (a) : (b))
 

Functions

int so3_sampling_nalpha (const so3_parameters_t *)
 
int so3_sampling_nbeta (const so3_parameters_t *)
 
int so3_sampling_ngamma (const so3_parameters_t *)
 
complex double so3_sampling_weight (const so3_parameters_t *parameters, int p)
 
int so3_sampling_f_size (const so3_parameters_t *parameters)
 
int so3_sampling_n (const so3_parameters_t *parameters)
 
double so3_sampling_a2alpha (int a, const so3_parameters_t *parameters)
 
double so3_sampling_b2beta (int b, const so3_parameters_t *parameters)
 
double so3_sampling_g2gamma (int g, const so3_parameters_t *parameters)
 
int so3_sampling_flmn_size (const so3_parameters_t *parameters)
 
void so3_sampling_elmn2ind (int *ind, int el, int m, int n, const so3_parameters_t *parameters)
 
void so3_sampling_ind2elmn (int *el, int *m, int *n, int ind, const so3_parameters_t *parameters)
 
void so3_sampling_elmn2ind_real (int *ind, int el, int m, int n, const so3_parameters_t *parameters)
 
void so3_sampling_ind2elmn_real (int *el, int *m, int *n, int ind, const so3_parameters_t *parameters)
 
void so3_sampling_n_loop_values (int *n_start, int *n_stop, int *n_inc, const so3_parameters_t *parameters)
 
void so3_sampling_el_loop_values (int *el_start, int *el_stop, int *el_inc, const int n, const so3_parameters_t *parameters)
 
void so3_sampling_m_loop_values (int *m_start, int *m_stop, int *m_inc, const int el)
 
bool so3_sampling_is_i_in_loop_range (const int i, const int i_start, const int i_stop, const int i_inc)
 
bool so3_sampling_is_elmn_non_zero (const int el, const int m, const int n, const so3_parameters_t *parameters)
 
int so3_sampling_is_elmn_non_zero_return_int (const int el, const int m, const int n, const so3_parameters_t *parameters)
 

Macro Definition Documentation

◆ MAX

#define MAX (   a,
 
)    ((a > b) ? (a) : (b))

Function Documentation

◆ so3_sampling_a2alpha()

double so3_sampling_a2alpha ( int  a,
const so3_parameters_t parameters 
)

Convert alpha index to angle for a given sampling scheme.

Note
  • a ranges from [0 .. 2*L-2] => 2*L-1 points in [0,2*pi).
Parameters
[in]aAlpha index.
[in]parametersA parameters object with (at least) the following fields: L, sampling_scheme
Return values
alphaAlpha angle.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_b2beta()

double so3_sampling_b2beta ( int  b,
const so3_parameters_t parameters 
)

Convert beta index to angle for a given sampling scheme.

Note
  • b ranges from [0 .. 2*L-2] => 2*L-1 points in (0,2*pi).
Parameters
[in]bBeta index.
[in]parametersA parameters object with (at least) the following fields: L, sampling_scheme
Return values
betaBeta angle.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_el_loop_values()

void so3_sampling_el_loop_values ( int *  el_start,
int *  el_stop,
int *  el_inc,
const int  n,
const so3_parameters_t parameters 
)

Calculates the starting, stopping and increment of el that a applicable for a flmn. This is useful for looping over the whole array

Parameters
[out]el_startstarting el.
[out]el_stopstopping el.
[out]el_incincrement in el.
[in]nThe value of n the loop is being applied to.
[in]parametersA parameters object with (at least) the following fields: L, N, storage
The reality flag is ignored. Use so3_sampling_ind2elmn instead.
Return values
noneexample: so3_sampling_el_loop_values(&el_start, &el_stop, &el_inc, n, &parameters); for (el = el_start; el <= el_stop; el +=el_inc){}
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_elmn2ind()

void so3_sampling_elmn2ind ( int *  ind,
int  el,
int  m,
int  n,
const so3_parameters_t parameters 
)

Convert (el,m,n) harmonic indices to 1D index used to access flmn array.

Note
Index ranges are as follows:
  • el ranges from [0 .. L-1].
  • m ranges from [-el .. el].
  • n ranges from [-el' .. el'], where el' = min{el, N}
  • ind ranges from [0 .. (2*N)(L**2-N(N-1)/3)-1] for compact storage methods and from [0 .. (2*N-1)*L**2-1] for 0-padded storage methods.
Parameters
[out]ind1D index to access flmn array.
[in]elHarmonic index.
[in]mAzimuthal harmonic index.
[in]nOrientational harmonic index.
[in]parametersA parameters object with (at least) the following fields: L, N, storage, n_order
The reality flag is ignored. Use instead. none Martin Büttner
Author
Jason McEwen

◆ so3_sampling_elmn2ind_real()

void so3_sampling_elmn2ind_real ( int *  ind,
int  el,
int  m,
int  n,
const so3_parameters_t parameters 
)

Convert (el,m,n) harmonic indices to 1D index used to access flmn array for a real signal.

Note
Index ranges are as follows:
  • el ranges from [0 .. L-1].
  • m ranges from [-el .. el].
  • n ranges from [0 .. el'], where el' = min{el, N}
  • ind ranges from [0 .. N*(L*L-(N-1)*(2*N-1)/6)-1] for compact storage methods and from [0 .. N*L*L-1] for 0-padded storage methods.
Parameters
[out]ind1D index to access flmn array.
[in]elHarmonic index
[in]mAzimuthal harmonic index.
[in]nOrientational harmonic index.
[in]parametersA parameters object with (at least) the following fields: L, N, storage
The reality flag is ignored. Use so3_sampling_elmn2ind instead.
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_f_size()

int so3_sampling_f_size ( const so3_parameters_t parameters)

Compute size of the signal buffer f to be passed to the forward and returned from the inverse transform function for a given sampling scheme.

Note
Computes number of samples on rotation group, not over extended domain.
This includes degenerate samples on the poles which are the same for each value of phi. To get the logical number of samples (i.e. ignoring without degeneracy) use so3_sampling_n, instead.
Parameters
[in]parametersA parameters object with (at least) the following fields: L, N, sampling_scheme
Return values
nNumber of samples stored in the signal buffers.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_flmn_size()

int so3_sampling_flmn_size ( const so3_parameters_t parameters)

Get storage size of flmn array for different storage methods.

Parameters
[in]parametersA parameters object with (at least) the following fields: L, N, storage, reality
Return values
Numberof coefficients to be stored.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_g2gamma()

double so3_sampling_g2gamma ( int  g,
const so3_parameters_t parameters 
)

Convert gamma index to angle for a given sampling scheme.

Note
  • g ranges from [0 .. 2*L-2] => 2*L-1 points in [0,2*pi).
Parameters
[in]gGamma index.
[in]parametersA parameters object with (at least) the following fields: N, sampling_scheme
Return values
gammaGamma angle.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_ind2elmn()

void so3_sampling_ind2elmn ( int *  el,
int *  m,
int *  n,
int  ind,
const so3_parameters_t parameters 
)

Convert 1D index used to access flmn array to (el,m,n) harmonic indices.

Note
Index ranges are as follows:
  • el ranges from [0 .. L-1].
  • m ranges from [-el .. el].
  • n ranges from [-el' .. el'], where el' = min{el, N}
  • ind ranges from [0 .. (2*N)(L**2-N(N-1)/3)-1] for compact storage methods and from [0 .. (2*N-1)*L**2-1] for 0-padded storage methods.
Parameters
[out]elHarmonic index.
[out]mAzimuthal harmonic index.
[out]nOrientational harmonic index.
[in]ind1D index to access flm array.
[in]parametersA parameters object with (at least) the following fields: L, N, storage
The reality flag is ignored. Use so3_sampling_ind2elmn_real instead.
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_ind2elmn_real()

void so3_sampling_ind2elmn_real ( int *  el,
int *  m,
int *  n,
int  ind,
const so3_parameters_t parameters 
)

Convert 1D index used to access flmn array to (el,m,n) harmonic indices for a real signal.

Note
Index ranges are as follows:
  • el ranges from [0 .. L-1].
  • m ranges from [-el .. el].
  • n ranges from [0 .. el'], where el' = min{el, N}
  • ind ranges from [0 .. N*(L*L-(N-1)*(2*N-1)/6)-1] for compact storage methods and from [0 .. N*L*L-1] for 0-padded storage methods.
Parameters
[out]elHarmonic index.
[out]mAzimuthal harmonic index.
[out]nOrientational harmonic index.
[in]ind1D index to access flm array.
[in]parametersA parameters object with (at least) the following fields: L, N, storage
The reality flag is ignored. Use so3_sampling_ind2elmn instead.
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_is_elmn_non_zero()

bool so3_sampling_is_elmn_non_zero ( const int  el,
const int  m,
const int  n,
const so3_parameters_t parameters 
)

Queries if (el,m,n) harmonic indices are non zero in this setting

Note
Index ranges are as follows:
  • el ranges from [0 .. L-1].
  • m ranges from [-el .. el].
  • n ranges from [-el' .. el'], where el' = min{el, N}
  • ind ranges from [0 .. (2*N)(L**2-N(N-1)/3)-1] for compact storage methods and from [0 .. (2*N-1)*L**2-1] for 0-padded storage methods.
Parameters
[in]elHarmonic index.
[in]mAzimuthal harmonic index.
[in]nOrientational harmonic index.
[in]parametersA parameters object with (at least) the following fields: L, N, storage, n_order, reality
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_is_elmn_non_zero_return_int()

int so3_sampling_is_elmn_non_zero_return_int ( const int  el,
const int  m,
const int  n,
const so3_parameters_t parameters 
)

◆ so3_sampling_is_i_in_loop_range()

bool so3_sampling_is_i_in_loop_range ( const int  i,
const int  i_start,
const int  i_stop,
const int  i_inc 
)

Queries if integer i would be covered in a loop for (i=i_start; i<=i_stop; i += i_inc)

Parameters
[in]iinteger to query
[in]i_startstarting point
[in]i_stopstoping point
[in]i_incincrementing step
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_m_loop_values()

void so3_sampling_m_loop_values ( int *  m_start,
int *  m_stop,
int *  m_inc,
const int  el 
)

Calculates the starting, stopping and increment of m that a applicable for a flmn. This is useful for looping over the whole array

Parameters
[out]m_startstarting m.
[out]m_stopstopping m.
[out]m_incincrement in m.
[in]elThe value of el the loop is being applied to.
Return values
noneexample: so3_sampling_el_loop_values(&m_start, &m_stop, &m_inc, el); for (m = m_start; m <= m_stop; m +=m_inc){}
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_n()

int so3_sampling_n ( const so3_parameters_t parameters)

Compute total number of samples for a given sampling scheme.

Note
Computes number of samples on rotation group, not over extended domain.
This returns the logical number of samples (without degeneracy), and not the size of the signal buffer used in the transform functions. Use so3_sampling_f_size to get the actual size of the signal buffer.
Parameters
[in]parametersA parameters object with (at least) the following fields: L, N, sampling_scheme
Return values
nNumber of samples.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_n_loop_values()

void so3_sampling_n_loop_values ( int *  n_start,
int *  n_stop,
int *  n_inc,
const so3_parameters_t parameters 
)

Calculates the starting, stopping and increment of n that a applicable for a flmn. This is useful for looping over the whole array

Parameters
[out]n_startstarting n.
[out]n_stopstopping n.
[out]n_incincrement in n.
[in]parametersA parameters object with (at least) the following fields: L, N, storage
The reality flag is ignored. Use so3_sampling_ind2elmn instead. example: so3_sampling_n_loop_values(&n_start, &n_stop, &n_inc, parameters); for (n = n_start; n <= n_stop; n += n_inc) {}
Return values
none
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_nalpha()

int so3_sampling_nalpha ( const so3_parameters_t parameters)

Compute number of alpha samples for a given sampling scheme.

Parameters
[in]parametersA parameters object with (at least) the following fields: L, sampling_scheme
Return values
nalphaNumber of alpha samples.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_nbeta()

int so3_sampling_nbeta ( const so3_parameters_t parameters)

Compute number of beta samples for a given sampling scheme.

Note
Computes number of samples in (0,pi], not over extended domain.
Parameters
[in]parametersA parameters object with (at least) the following fields: L, sampling_scheme
Return values
nbetaNumber of beta samples.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_ngamma()

int so3_sampling_ngamma ( const so3_parameters_t parameters)

Compute number of gamma samples for a given sampling scheme.

Parameters
[in]parametersA parameters object with (at least) the following fields: B, sampling_scheme
Return values
ngammaNumber of gamma samples.
Author
Martin Büttner
Jason McEwen

◆ so3_sampling_weight()

complex double so3_sampling_weight ( const so3_parameters_t parameters,
int  p 
)

Compute conjugate weights for toroidal extension.

Parameters
[in]parametersA parameters object with (at least) sampling_scheme
[in]pInteger index to compute weight for.
Return values
Correspondingconjugate weight.
Author
Jason McEwen