Total Variation Deconvolution using Split Bregman
Main Page
Modules
Data Structures
Files
File List
Globals
randmt.h
Go to the documentation of this file.
1
56
#ifndef _RANDMT_H_
57
#define _RANDMT_H_
58
59
#ifndef M_PI
60
61
#define M_PI 3.14159265358979323846264338327950288419176939937510
62
#endif
63
112
typedef
struct
randmtstruct_t
randmt_t
;
113
115
extern
randmt_t
__randmt_global_generator
;
116
117
/* Samplers using a specified generator */
150
randmt_t
*
new_randmt
();
151
159
void
free_randmt
(
randmt_t
*generator);
160
168
void
init_randmt_r
(
randmt_t
*generator,
unsigned
long
seed);
169
188
void
init_randmt_auto_r
(
randmt_t
*generator);
189
199
unsigned
long
rand_uint32_r
(
randmt_t
*generator);
200
211
double
rand_gamma_r
(
randmt_t
*generator,
double
a,
double
b);
212
222
double
rand_poisson_r
(
randmt_t
*generator,
double
mu);
223
236
#define rand_unif_r(generator) ( \
237
(((rand_uint32_r(generator) >> 5)*67108864.0 \
238
+ (rand_uint32_r(generator) >> 6)) \
239
+ 0.4999999999999998) / 9007199254740992.0)
240
249
#define rand_normal_r(generator) ( \
250
sqrt(-2.0*log(rand_unif_r(generator))) \
251
* cos(2.0*M_PI*rand_unif_r(generator)))
252
263
#define rand_exp_r(generator, mu) ( \
264
-(mu)*log(rand_unif_r(generator)))
265
276
#define rand_geometric_r(generator, p) ( \
277
floor(log(rand_unif_r(generator))/log(1 - p)) + 1)
278
282
/* Samplers using the global generator */
314
#define init_randmt(seed) (init_randmt_r(&__randmt_global_generator, seed))
315
328
#define init_randmt_auto() (init_randmt_auto_r(&__randmt_global_generator))
329
338
#define rand_uint32() (rand_uint32_r(&__randmt_global_generator))
339
357
#define rand_unif() (rand_unif_r(&__randmt_global_generator))
358
374
#define rand_normal() (rand_normal_r(&__randmt_global_generator))
375
395
#define rand_exp(mu) (rand_exp_r(&__randmt_global_generator, mu))
396
416
#define rand_gamma(a, b) (rand_gamma_r(&__randmt_global_generator, a, b))
417
442
#define rand_poisson(mu) (rand_poisson_r(&__randmt_global_generator, mu))
443
460
#define rand_geometric(p) (rand_geometric_r(&__randmt_global_generator, p))
461
464
#endif
/* _RANDMT_H_ */
Generated on Fri Jul 5 2013 18:58:04 for Total Variation Deconvolution using Split Bregman by
1.8.3.1