Utilities

Utilities — Miscellaneous utilities

Synopsis

#include "utils.h"


void                show_matrix_eqn                     (gsl_matrix *M,
                                                         gsl_vector *v,
                                                         int r);
enum                AssplodeFlag;
#define             C_VACUO
#define             ELECTRON_CHARGE
#define             ERROR                               (...)
#define             J_to_eV                             (a)
#define             PLANCK
#define             STATUS                              (...)
#define             THOMSON_LENGTH
int                 assplode                            (const char *a,
                                                         const char *delims,
                                                         char ***pbits,
                                                         AssplodeFlag flags);
#define             biggest                             (a,
                                                         b)
char *              check_prefix                        (char *prefix);
void                chomp                               (char *s);
#define             deg2rad                             (a)
#define             eV_to_J                             (a)
double              gaussian_noise                      (double expected,
                                                         double stddev);
char *              safe_basename                       (const char *in);
void                progress_bar                        (int val,
                                                         int total,
                                                         const char *text);
#define             rad2deg                             (a)
#define             is_odd                              (a)
return              modulus                             ();
int                 poisson_noise                       (double expected);
size_t              notrail                             (char *s);
#define             smallest                            (a,
                                                         b)
#define             ph_en_to_lambda                     (a)
#define             ph_lambda_to_en                     (a)

Description

Wibble

Details

show_matrix_eqn ()

void                show_matrix_eqn                     (gsl_matrix *M,
                                                         gsl_vector *v,
                                                         int r);

Displays a matrix equation of the form M.a = v.

M must be square.

M :

A matrix

v :

A vector

r :

The number of elements in v and the side length of M.

enum AssplodeFlag

typedef enum {
	ASSPLODE_NONE = 0,
	ASSPLODE_DUPS = 1<<0
} AssplodeFlag;

C_VACUO

#define C_VACUO (299792458)

ELECTRON_CHARGE

#define ELECTRON_CHARGE (1.6021773e-19)

ERROR()

#define             ERROR(...)

J_to_eV()

#define J_to_eV(a) ((a)/ELECTRON_CHARGE)

PLANCK

#define PLANCK (6.62606896e-34)

STATUS()

#define             STATUS(...)

THOMSON_LENGTH

#define THOMSON_LENGTH (2.81794e-15)

assplode ()

int                 assplode                            (const char *a,
                                                         const char *delims,
                                                         char ***pbits,
                                                         AssplodeFlag flags);

biggest()

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

check_prefix ()

char *              check_prefix                        (char *prefix);

chomp ()

void                chomp                               (char *s);

deg2rad()

#define deg2rad(a) ((a)*M_PI/180)

eV_to_J()

#define eV_to_J(a) ((a)*ELECTRON_CHARGE)

gaussian_noise ()

double              gaussian_noise                      (double expected,
                                                         double stddev);

safe_basename ()

char *              safe_basename                       (const char *in);

progress_bar ()

void                progress_bar                        (int val,
                                                         int total,
                                                         const char *text);

rad2deg()

#define rad2deg(a) ((a)*180/M_PI)

is_odd()

#define is_odd(a) ((a)%2==1)

modulus ()

return              modulus                             ();

poisson_noise ()

int                 poisson_noise                       (double expected);

notrail ()

size_t              notrail                             (char *s);

smallest()

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

ph_en_to_lambda()

#define ph_en_to_lambda(a) ((PLANCK*C_VACUO)/(a))

ph_lambda_to_en()

#define ph_lambda_to_en(a) ((PLANCK*C_VACUO)/(a))