|
From: Alberto M. Brand?o Sim?es <am...@us...> - 2002-04-22 08:08:06
|
Update of /cvsroot/numexp/numexp-core/modules/gsl
In directory usw-pr-cvs1:/tmp/cvs-serv19491/modules/gsl
Modified Files:
Makefile.am STATUS gsl.c rng.in rng.xml
Added Files:
qrng.in qrng.xml
Log Message:
- Added error message when chdir'ing to an invalid namespace;
- Unix random number generators;
- Numerical Recipes generators;
- Other random number generators;
- Added qrng.{in,xml} for quasi-random number generators;
- Quasi-random number generation initialization;
- Sampling from a quasi-random number generator;
- Quasi-random number generator algorithms;
--- NEW FILE ---
/* -*- c -*- */
#include <gsl/gsl_qrng.h>
#include "nxp_kernel.h"
#include "gsl.h"
/* STATUS: done */
#NAMESPACE gsl::qRNG
#PROTOTYPE <STRING> qrng_name() WITH NAME current
static NxpElement* nxp_gsl_qrng_name(ETC) {
gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
if (qrng) {
NxpElement *el = nxp_element_string_new(gsl_qrng_name(qrng));
GSL_RETURN(el);
} else {
return nxp_element_string_new("-none-");
}
}
#PROTOTYPE <INT> qrng_size() WITH NAME currentSize
static NxpElement* nxp_gsl_qrng_size(ETC) {
gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
if (qrng) {
unsigned int *usize = nxp_eval_context_get_user_data(context, "qRNG-size");
NxpElement *el = nxp_element_int_new(*usize);
GSL_RETURN(el);
} else {
return nxp_element_int_new(0);
}
}
#PROTOTYPE <VECTOR> qrng_init_get(<VOID>) WITH NAME sample
static NxpElement* nxp_gsl_qrng_init_get(ETC) {
double* buffer;
gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
if (qrng) {
unsigned int *usize = nxp_eval_context_get_user_data(context, "qRNG-size");
NxpElement *vec;
buffer = g_new(double, *usize);
gsl_qrng_get(qrng, buffer);
vec = nxp_double_buffer_to_vector(buffer, *usize);
GSL_RETURN(vec);
} else {
return NULL;
}
}
#PROTOTYPE <VOID> qrng_init_niederreiter_2(<INT>) WITH NAME init_niederreiter2
static NxpElement* nxp_gsl_qrng_init_niederreiter_2(NxpElementInt *dimension, ETC) {
unsigned int *usize = g_new(unsigned int, 1);
gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
if (qrng) {
/* Free it */
gsl_qrng_free(qrng);
g_free(nxp_eval_context_get_user_data(context, "qRNG-size"));
qrng = NULL;
}
*usize = (unsigned int)ABS(dimension->value);
qrng = gsl_qrng_alloc(gsl_qrng_niederreiter_2, *usize);
nxp_eval_context_set_user_data(context, "qRNG", qrng);
nxp_eval_context_set_user_data(context, "qRNG-size", usize);
GSL_RETURN(nxp_element_void_new());
}
//#PROTOTYPE <VOID> qrng_reset() WITH NAME reset
//static NxpElement* nxp_gsl_qrng_reset(ETC) {
// gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
// // if (qrng) gsl_qrng_init(qrng);
// GSL_RETURN(nxp_element_void_new());
//}
#PROTOTYPE <VOID> qrng_init_sobol(<INT>) WITH NAME init_sobol
static NxpElement* nxp_gsl_qrng_init_sobol(NxpElementInt *dimension, ETC) {
unsigned int *usize = g_new(unsigned int, 1);
gsl_qrng *qrng = nxp_eval_context_get_user_data(context, "qRNG");
if (qrng) {
/* Free it */
gsl_qrng_free(qrng);
g_free(nxp_eval_context_get_user_data(context, "qRNG-size"));
qrng = NULL;
}
*usize = (unsigned int)ABS(dimension->value);
qrng = gsl_qrng_alloc(gsl_qrng_sobol, *usize);
nxp_eval_context_set_user_data(context, "qRNG", qrng);
nxp_eval_context_set_user_data(context, "qRNG-size", usize);
GSL_RETURN(nxp_element_void_new());
}
void nxp_gsl_qrng_init(NxpEvalContext * context) {
gsl_qrng* qrng;
NxpIdentifier *id;
unsigned int *size;
/* it starts empty!! This means that I don't know when to free it :-/ */
qrng = NULL;
size = g_new(unsigned int, 1);
*size = 0;
nxp_eval_context_set_user_data(context, "qRNG", qrng);
nxp_eval_context_set_user_data(context, "qRNG-size", size);
#PROTOTYPES
}
--- NEW FILE ---
<namespace name="::gsl::qRNG::">
<description>
</description>
</namespace>
Index: Makefile.am
===================================================================
RCS file: /cvsroot/numexp/numexp-core/modules/gsl/Makefile.am,v
retrieving revision 1.33
retrieving revision 1.34
diff -U4 -r1.33 -r1.34
--- Makefile.am 9 Apr 2002 06:59:09 -0000 1.33
+++ Makefile.am 22 Apr 2002 07:39:38 -0000 1.34
@@ -17,9 +17,9 @@
sf_gegenbauer.in sf_hyperg.in sf_laguerre.in \
sf_lambert.in sf_legendre.in sf_log.in sf_psi.in \
sf_synchrotron.in sf_transport.in sf_trig.in sf_zeta.in\
permutation.in multifit_nlin.in linalg.in stats.in \
- randist.in rng.in
+ randist.in rng.in qrng.in
BUILT_SOURCES = physical.c basics.c complexes.c sf_airy.c sf_bessel.c \
sf_clausen.c poly_roots.c sf_coulomb.c sf_coupling.c \
sf_dawson.c sf_debye.c sf_dilog.c sf_ellint.c \
@@ -27,9 +27,9 @@
sf_fermi_dirac.c sf_gamma.c sf_gegenbauer.c \
sf_hyperg.c sf_laguerre.c sf_lambert.c sf_legendre.c \
sf_log.c sf_psi.c sf_synchrotron.c sf_transport.c \
sf_trig.c sf_zeta.c permutation.c multifit_nlin.c \
- linalg.c stats.c randist.c rng.c
+ linalg.c stats.c randist.c rng.c qrng.c
EXTRA_DIST = $(GSL_IN_FILES) $(MODULE_DOCS) gsl-proto-gen.pl gslpermut-prototypes.in header.xml
PROTO_FILES_C = gslpermut-prototypes.generated.c
@@ -53,9 +53,9 @@
sf_hyperg.xml sf_laguerre.xml sf_lambert.xml \
sf_legendre.xml sf_log.xml sf_psi.xml sf_synchrotron.xml\
sf_transport.xml sf_trig.xml sf_zeta.xml permutation.xml\
multifit_nlin.xml linalg.xml stats.xml randist.xml \
- rng.xml \
+ rng.xml qrng.xml\
physical.xml
gsl.xml: header.xml $(MODULE_DOCS)
@echo Constructing gsl.xml document file...
Index: STATUS
===================================================================
RCS file: /cvsroot/numexp/numexp-core/modules/gsl/STATUS,v
retrieving revision 1.4
retrieving revision 1.5
diff -U4 -r1.4 -r1.5
--- STATUS 20 Apr 2002 11:58:39 -0000 1.4
+++ STATUS 22 Apr 2002 07:39:38 -0000 1.5
@@ -108,25 +108,25 @@
* QAWS adaptive integration for singular functions
* QAWO adaptive integration for oscillatory functions
* QAWF adaptive integration for Fourier integrals
-* Random Number Generation
+* [TODO:DOCUMENTATION] Random Number Generation
* [DONE] Random number generator initialization
* [DONE] Sampling from a random number generator
* [IGORED] Auxiliary random number generator functions
* [IGORED] Random number environment variables
* [IGORED] Saving and restoring random number generator state
* [DONE] Random number generator algorithms
- * Unix random number generators
- * Numerical Recipes generators
- * Other random number generators
+ * [DONE] Unix random number generators
+ * [DONE] Numerical Recipes generators
+ * [DONE] Other random number generators
-* Quasi-Random Sequences
- * Quasi-random number generator initialization
- * Sampling from a quasi-random number generator
- * Auxiliary quasi-random number generator functions
- * Saving and resorting quasi-random number generator state
- * Quasi-random number generator algorithms
+* [TODO:DOCUMENTATION] Quasi-Random Sequences
+ * [DONE] Quasi-random number generator initialization
+ * [DONE] Sampling from a quasi-random number generator
+ * [IGNORED] Auxiliary quasi-random number generator functions
+ * [IGNORED] Saving and resorting quasi-random number generator state
+ * [DONE] Quasi-random number generator algorithms
* Random Number Distributions
* The Gaussian Distribution
* The Gaussian Tail Distribution
Index: gsl.c
===================================================================
RCS file: /cvsroot/numexp/numexp-core/modules/gsl/gsl.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -U4 -r1.12 -r1.13
--- gsl.c 20 Apr 2002 08:26:20 -0000 1.12
+++ gsl.c 22 Apr 2002 07:39:38 -0000 1.13
@@ -22,8 +22,9 @@
void nxp_gsl_permutation_init(NxpEvalContext*);
void nxp_gsl_linalg_init(NxpEvalContext*);
void nxp_gsl_stats_init(NxpEvalContext*);
void nxp_gsl_rng_init(NxpEvalContext*);
+void nxp_gsl_qrng_init(NxpEvalContext*);
void nxp_module_init(NxpEvalContext *context)
{
gsl_is_on_error = 0;
@@ -38,8 +39,9 @@
nxp_gsl_permutation_init(context);
nxp_gsl_linalg_init(context);
nxp_gsl_stats_init(context);
nxp_gsl_rng_init(context);
+ nxp_gsl_qrng_init(context);
nxp_gsl_physical_init(context);
}
Index: rng.in
===================================================================
RCS file: /cvsroot/numexp/numexp-core/modules/gsl/rng.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -U4 -r1.3 -r1.4
--- rng.in 20 Apr 2002 11:58:39 -0000 1.3
+++ rng.in 22 Apr 2002 07:39:38 -0000 1.4
@@ -120,8 +120,134 @@
change(context, gsl_rng_ranlxs2);
return nxp_element_void_new();
}
+#PROTOTYPE <VOID> rng_rand() WITH NAME init_stdRand
+static NxpElement* nxp_gsl_rng_rand(ETC) {
+ change(context, gsl_rng_rand);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_random_bsd() WITH NAME init_bsdRand
+static NxpElement* nxp_gsl_rng_random_bsd(ETC) {
+ change(context, gsl_rng_random_bsd);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_random_libc5() WITH NAME init_libc5Rand
+static NxpElement* nxp_gsl_rng_random_libc5(ETC) {
+ change(context, gsl_rng_random_libc5);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_random_glibc2() WITH NAME init_glibc2Rand
+static NxpElement* nxp_gsl_rng_random_glibc2(ETC) {
+ change(context, gsl_rng_random_glibc2);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_rand48() WITH NAME init_rand48
+static NxpElement* nxp_gsl_rng_rand48(ETC) {
+ change(context, gsl_rng_rand48);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ran0() WITH NAME init_ran0
+static NxpElement* nxp_gsl_rng_ran0(ETC) {
+ change(context, gsl_rng_ran0);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ran1() WITH NAME init_ran1
+static NxpElement* nxp_gsl_rng_ran1(ETC) {
+ change(context, gsl_rng_ran1);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ran2() WITH NAME init_ran2
+static NxpElement* nxp_gsl_rng_ran2(ETC) {
+ change(context, gsl_rng_ran2);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ran3() WITH NAME init_ran3
+static NxpElement* nxp_gsl_rng_ran3(ETC) {
+ change(context, gsl_rng_ran3);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ranf() WITH NAME init_ranf
+static NxpElement* nxp_gsl_rng_ranf(ETC) {
+ change(context, gsl_rng_ranf);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_ranmar() WITH NAME init_ranmar
+static NxpElement* nxp_gsl_rng_ranmar(ETC) {
+ change(context, gsl_rng_ranmar);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_r250() WITH NAME init_r250
+static NxpElement* nxp_gsl_rng_r250(ETC) {
+ change(context, gsl_rng_r250);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_tt800() WITH NAME init_tt800
+static NxpElement* nxp_gsl_rng_tt800(ETC) {
+ change(context, gsl_rng_tt800);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_vax() WITH NAME init_vax
+static NxpElement* nxp_gsl_rng_vax(ETC) {
+ change(context, gsl_rng_vax);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_transputer() WITH NAME init_transputer
+static NxpElement* nxp_gsl_rng_transputer(ETC) {
+ change(context, gsl_rng_transputer);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_randu() WITH NAME init_randu
+static NxpElement* nxp_gsl_rng_randu(ETC) {
+ change(context, gsl_rng_randu);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_minstd() WITH NAME init_minstd
+static NxpElement* nxp_gsl_rng_minstd(ETC) {
+ change(context, gsl_rng_minstd);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_uni() WITH NAME init_uni
+static NxpElement* nxp_gsl_rng_uni(ETC) {
+ change(context, gsl_rng_uni);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_uni32() WITH NAME init_uni32
+static NxpElement* nxp_gsl_rng_uni32(ETC) {
+ change(context, gsl_rng_uni32);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_slatec() WITH NAME init_slatec
+static NxpElement* nxp_gsl_rng_slatec(ETC) {
+ change(context, gsl_rng_slatec);
+ return nxp_element_void_new();
+}
+
+#PROTOTYPE <VOID> rng_zuf() WITH NAME init_zuf
+static NxpElement* nxp_gsl_rng_zuf(ETC) {
+ change(context, gsl_rng_zuf);
+ return nxp_element_void_new();
+}
+
void nxp_gsl_rng_init(NxpEvalContext * context) {
gsl_rng* rng;
NxpIdentifier *id;
Index: rng.xml
===================================================================
RCS file: /cvsroot/numexp/numexp-core/modules/gsl/rng.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -U4 -r1.1 -r1.2
--- rng.xml 9 Apr 2002 06:59:09 -0000 1.1
+++ rng.xml 22 Apr 2002 07:39:38 -0000 1.2
@@ -1,5 +1,5 @@
- <namespace name="::gsl::randomGeneration::">
+ <namespace name="::gsl::RNG::">
<description>
</description>
|