Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:59

0001 /* Author: G. Jungman + modifications from O. Teytaud
0002  */
0003 #ifndef __GSL_QRNG_H__
0004 #define __GSL_QRNG_H__
0005 
0006 #include <stdlib.h>
0007 #include <gsl/gsl_types.h>
0008 #include <gsl/gsl_errno.h>
0009 #include <gsl/gsl_inline.h>
0010 
0011 #undef __BEGIN_DECLS
0012 #undef __END_DECLS
0013 #ifdef __cplusplus
0014 # define __BEGIN_DECLS extern "C" {
0015 # define __END_DECLS }
0016 #else
0017 # define __BEGIN_DECLS /* empty */
0018 # define __END_DECLS /* empty */
0019 #endif
0020 
0021 __BEGIN_DECLS
0022 
0023 
0024 /* Once again, more inane C-style OOP... kill me now. */
0025 
0026 /* Structure describing a type of generator.
0027  */
0028 typedef struct
0029 {
0030   const char * name;
0031   unsigned int max_dimension;
0032   size_t (*state_size) (unsigned int dimension);
0033   int (*init_state) (void * state, unsigned int dimension);
0034   int (*get) (void * state, unsigned int dimension, double x[]);
0035 }
0036 gsl_qrng_type;
0037 
0038 /* Structure describing a generator instance of a
0039  * specified type, with generator-specific state info
0040  * and dimension-specific info.
0041  */
0042 typedef struct
0043 {
0044   const gsl_qrng_type * type;
0045   unsigned int dimension;
0046   size_t state_size;
0047   void * state;
0048 }
0049 gsl_qrng;
0050 
0051 
0052 /* Supported generator types.
0053  */
0054 GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2;
0055 GSL_VAR const gsl_qrng_type * gsl_qrng_sobol;
0056 GSL_VAR const gsl_qrng_type * gsl_qrng_halton;
0057 GSL_VAR const gsl_qrng_type * gsl_qrng_reversehalton;
0058 
0059 
0060 /* Allocate and initialize a generator
0061  * of the specified type, in the given
0062  * space dimension.
0063  */
0064 gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension);
0065 
0066 
0067 /* Copy a generator. */
0068 int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src);
0069 
0070 
0071 /* Clone a generator. */
0072 gsl_qrng * gsl_qrng_clone (const gsl_qrng * q);
0073 
0074 
0075 /* Free a generator. */
0076 void gsl_qrng_free (gsl_qrng * q);
0077 
0078 
0079 /* Intialize a generator. */
0080 void gsl_qrng_init (gsl_qrng * q);
0081 
0082 
0083 /* Get the standardized name of the generator. */
0084 const char * gsl_qrng_name (const gsl_qrng * q);
0085 
0086 
0087 /* ISN'T THIS CONFUSING FOR PEOPLE?
0088   WHAT IF SOMEBODY TRIES TO COPY WITH THIS ???
0089   */
0090 size_t gsl_qrng_size (const gsl_qrng * q);
0091 
0092 
0093 void * gsl_qrng_state (const gsl_qrng * q);
0094 
0095 
0096 /* Retrieve next vector in sequence. */
0097 INLINE_DECL int gsl_qrng_get (const gsl_qrng * q, double x[]);
0098 
0099 #ifdef HAVE_INLINE
0100 INLINE_FUN int gsl_qrng_get (const gsl_qrng * q, double x[])
0101 {
0102   return (q->type->get) (q->state, q->dimension, x);
0103 }
0104 
0105 #endif /* HAVE_INLINE */
0106 
0107 
0108 __END_DECLS
0109 
0110 
0111 #endif /* !__GSL_QRNG_H__ */