so3_test.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
#include <time.h>
#include <fftw3.h>
#include <omp.h>
#include <so3.h>

Go to the source code of this file.

Defines

#define NREPEAT   5
#define MIN(a, b)   ((a < b) ? (a) : (b))
#define MAX(a, b)   ((a > b) ? (a) : (b))

Functions

double get_max_error (complex double *expected, complex double *actual, int n)
double ran2_dp (int idum)
void so3_test_gen_flmn_complex (complex double *flmn, const so3_parameters_t *parameters, int seed)
void so3_test_gen_flmn_real (complex double *flmn, const so3_parameters_t *parameters, int seed)
int main (int argc, char **argv)

Detailed Description

Applies SO3 algorithms to perform inverse and forward Wigner transforms (respectively) to check that the original signal is reconstructed exactly (to numerical precision). Test is performed on a random signal with harmonic coefficients uniformly sampled from (-1,1), using a variety of options.

Usage
 {.sh}
   so3_test [L [N [L0 [seed]]]]
e.g.
 {.sh}
   so3_test 64 4 32 314
Defaults: L = 16, N = L, L0 = 0, seed = 1
Author:
Martin Büttner
Jason McEwen

Definition in file so3_test.c.


Define Documentation

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

Definition at line 38 of file so3_test.c.

#define MIN ( a,
 )     ((a < b) ? (a) : (b))

Definition at line 37 of file so3_test.c.

#define NREPEAT   5

Definition at line 36 of file so3_test.c.

Referenced by main().


Function Documentation

double get_max_error ( complex double *  expected,
complex double *  actual,
int  n 
)

Definition at line 293 of file so3_test.c.

References MAX.

Referenced by main().

int main ( int  argc,
char **  argv 
)
double ran2_dp ( int  idum  ) 

Generate uniform deviate in range [0,1) given seed. (Using double precision.)

Note:
Uniform deviate (Num rec 1992, chap 7.1), original routine said to be 'perfect'.
Parameters:
[in] idum Seed.
Return values:
ran_dp Generated uniform deviate.
Author:
Martin Büttner
Jason McEwen

Definition at line 513 of file so3_test.c.

Referenced by so3_test_gen_flmn_complex(), and so3_test_gen_flmn_real().

void so3_test_gen_flmn_complex ( complex double *  flmn,
const so3_parameters_t parameters,
int  seed 
)

Generate random Wigner coefficients of a complex signal.

Parameters:
[out] flmn Random spherical harmonic coefficients generated. Provide enough memory for fully padded storage, i.e. (2*N-1)*L*L elements. Unused trailing elements will be set to zero.
[in] parameters A parameters object with (at least) the following fields: L0, L, N, storage, n_mode The reality flag is ignored. Use so3_test_gen_flmn_real instead for real signals.
[in] seed Integer seed required for random number generator.
Return values:
none 
Author:
Martin Büttner
Jason McEwen

Definition at line 323 of file so3_test.c.

References so3_parameters_t::L, so3_parameters_t::L0, MAX, so3_parameters_t::N, so3_parameters_t::n_mode, ran2_dp(), SO3_ERROR_GENERIC, SO3_N_MODE_ALL, SO3_N_MODE_EVEN, SO3_N_MODE_L, SO3_N_MODE_MAXIMUM, SO3_N_MODE_ODD, and so3_sampling_elmn2ind().

Referenced by main().

void so3_test_gen_flmn_real ( complex double *  flmn,
const so3_parameters_t parameters,
int  seed 
)

Generate random Wigner coefficients of a real signal. We only generate coefficients for n >= 0, and for n = 0, we need flm0* = (-1)^(m)*fl-m0, so that fl00 has to be real.

Parameters:
[out] flmn Random spherical harmonic coefficients generated. Provide enough memory for fully padded, complex (!) storage, i.e. (2*N-1)*L*L elements. Unused trailing elements will be set to zero.
[in] parameters A parameters object with (at least) the following fields: L0, L, N, storage, n_mode The reality flag is ignored. Use so3_test_gen_flmn_complex instead for complex signals.
[in] seed Integer seed required for random number generator.
Return values:
none 
Author:
Martin Büttner
Jason McEwen

Definition at line 403 of file so3_test.c.

References so3_parameters_t::L, so3_parameters_t::L0, MAX, so3_parameters_t::N, so3_parameters_t::n_mode, ran2_dp(), SO3_ERROR_GENERIC, SO3_N_MODE_ALL, SO3_N_MODE_EVEN, SO3_N_MODE_L, SO3_N_MODE_MAXIMUM, SO3_N_MODE_ODD, and so3_sampling_elmn2ind_real().

Referenced by main().


Generated on 10 Nov 2016 by  doxygen 1.6.1