Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / qrng / gsl_qrng.h
1 /* Author: G. Jungman + modifications from O. Teytaud
2  */
3 #ifndef __GSL_QRNG_H__
4 #define __GSL_QRNG_H__
5
6 #include <stdlib.h>
7 #include <gsl/gsl_types.h>
8 #include <gsl/gsl_errno.h>
9
10 #undef __BEGIN_DECLS
11 #undef __END_DECLS
12 #ifdef __cplusplus
13 # define __BEGIN_DECLS extern "C" {
14 # define __END_DECLS }
15 #else
16 # define __BEGIN_DECLS /* empty */
17 # define __END_DECLS /* empty */
18 #endif
19
20 __BEGIN_DECLS
21
22
23 /* Once again, more inane C-style OOP... kill me now. */
24
25 /* Structure describing a type of generator.
26  */
27 typedef struct
28 {
29   const char * name;
30   unsigned int max_dimension;
31   size_t (*state_size) (unsigned int dimension);
32   int (*init_state) (void * state, unsigned int dimension);
33   int (*get) (void * state, unsigned int dimension, double x[]);
34 }
35 gsl_qrng_type;
36
37 /* Structure describing a generator instance of a
38  * specified type, with generator-specific state info
39  * and dimension-specific info.
40  */
41 typedef struct
42 {
43   const gsl_qrng_type * type;
44   unsigned int dimension;
45   size_t state_size;
46   void * state;
47 }
48 gsl_qrng;
49
50
51 /* Supported generator types.
52  */
53 GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2;
54 GSL_VAR const gsl_qrng_type * gsl_qrng_sobol;
55 GSL_VAR const gsl_qrng_type * gsl_qrng_halton;
56 GSL_VAR const gsl_qrng_type * gsl_qrng_reversehalton;
57
58
59 /* Allocate and initialize a generator
60  * of the specified type, in the given
61  * space dimension.
62  */
63 gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension);
64
65
66 /* Copy a generator. */
67 int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src);
68
69
70 /* Clone a generator. */
71 gsl_qrng * gsl_qrng_clone (const gsl_qrng * q);
72
73
74 /* Free a generator. */
75 void gsl_qrng_free (gsl_qrng * q);
76
77
78 /* Intialize a generator. */
79 void gsl_qrng_init (gsl_qrng * q);
80
81
82 /* Get the standardized name of the generator. */
83 const char * gsl_qrng_name (const gsl_qrng * q);
84
85
86 /* ISN'T THIS CONFUSING FOR PEOPLE?
87   WHAT IF SOMEBODY TRIES TO COPY WITH THIS ???
88   */
89 size_t gsl_qrng_size (const gsl_qrng * q);
90
91
92 void * gsl_qrng_state (const gsl_qrng * q);
93
94
95 /* Retrieve next vector in sequence. */
96 int gsl_qrng_get (const gsl_qrng * q, double x[]);
97
98
99 #ifdef HAVE_INLINE
100 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[]);
101 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[])
102 {
103   return (q->type->get) (q->state, q->dimension, x);
104 }
105
106 #endif /* HAVE_INLINE */
107
108
109 __END_DECLS
110
111
112 #endif /* !__GSL_QRNG_H__ */