Generated on Mon Jun 23 16:24:56 2008 for BIU-1.7.0 by doxygen 1.5.1

src/biu/qrng/gsl_qrng.h

Go to the documentation of this file.
00001 /* Author: G. Jungman
00002  */
00003 #ifndef __GSL_QRNG_H__
00004 #define __GSL_QRNG_H__
00005 
00006 #include <stdlib.h>
00007 #include "biu/qrng/gsl_types.h"
00008 #include "biu/qrng/gsl_errno.h"
00009 
00010 #undef __BEGIN_DECLS
00011 #undef __END_DECLS
00012 #ifdef __cplusplus
00013 # define __BEGIN_DECLS extern "C" {
00014 # define __END_DECLS }
00015 #else
00016 # define __BEGIN_DECLS /* empty */
00017 # define __END_DECLS /* empty */
00018 #endif
00019 
00020 __BEGIN_DECLS
00021 
00022 
00023 /* Once again, more inane C-style OOP... kill me now. */
00024 
00025 /* Structure describing a type of generator.
00026  */
00027 typedef struct
00028 {
00029   const char * name;
00030   unsigned int max_dimension;
00031   size_t (*state_size) (unsigned int dimension);
00032   int (*init_state) (void * state, unsigned int dimension);
00033   int (*get) (void * state, unsigned int dimension, double x[]);
00034 }
00035 gsl_qrng_type;
00036 
00037 /* Structure describing a generator instance of a
00038  * specified type, with generator-specific state info
00039  * and dimension-specific info.
00040  */
00041 typedef struct
00042 {
00043   const gsl_qrng_type * type;
00044   unsigned int dimension;
00045   size_t state_size;
00046   void * state;
00047 }
00048 gsl_qrng;
00049 
00050 
00051 /* Supported generator types.
00052  */
00053 GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2;
00054 GSL_VAR const gsl_qrng_type * gsl_qrng_sobol;
00055 
00056 
00057 /* Allocate and initialize a generator
00058  * of the specified type, in the given
00059  * space dimension.
00060  */
00061 gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension);
00062 
00063 
00064 /* Copy a generator. */
00065 int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src);
00066 
00067 
00068 /* Clone a generator. */
00069 gsl_qrng * gsl_qrng_clone (const gsl_qrng * q);
00070 
00071 
00072 /* Free a generator. */
00073 void gsl_qrng_free (gsl_qrng * q);
00074 
00075 
00076 /* Intialize a generator. */
00077 void gsl_qrng_init (gsl_qrng * q);
00078 
00079 
00080 /* Get the standardized name of the generator. */
00081 const char * gsl_qrng_name (const gsl_qrng * q);
00082 
00083 
00084 /* ISN'T THIS CONFUSING FOR PEOPLE?
00085   WHAT IF SOMEBODY TRIES TO COPY WITH THIS ???
00086   */
00087 size_t gsl_qrng_size (const gsl_qrng * q);
00088 
00089 
00090 void * gsl_qrng_state (const gsl_qrng * q);
00091 
00092 
00093 /* Retrieve next vector in sequence. */
00094 int gsl_qrng_get (const gsl_qrng * q, double x[]);
00095 
00096 
00097 #ifdef HAVE_INLINE
00098 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[]);
00099 extern inline int gsl_qrng_get (const gsl_qrng * q, double x[])
00100 {
00101   return (q->type->get) (q->state, q->dimension, x);
00102 }
00103 
00104 #endif /* HAVE_INLINE */
00105 
00106 
00107 __END_DECLS
00108 
00109 
00110 #endif /* !__GSL_QRNG_H__ */