Commit 5347f716 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new function interface

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2267
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 6e600090
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tf_gsl.c,v 1.1 2007-05-09 10:31:28 tforb Exp $
* $Id: tf_gsl.c,v 1.2 2007-05-09 10:48:48 tforb Exp $
* \author Thomas Forbriger
* \date 07/05/2007
*
......@@ -19,10 +19,61 @@
#define TF_TF_GSL_C_CC_VERSION \
"TF_TF_GSL_C_CC V1.0 "
#define TF_TF_GSL_C_CC_CVSID \
"$Id: tf_gsl.c,v 1.1 2007-05-09 10:31:28 tforb Exp $"
"$Id: tf_gsl.c,v 1.2 2007-05-09 10:48:48 tforb Exp $"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <time.h>
#include <f2c.h>
/* create a gaussian random vector of given size
* the values have unit variance and zero mean
*
* a: random vector
* n: size of random vector
*/
int tf_gsl_rng_ugaussian__(doublereal* a, integer* n)
{
int i;
/* set the default type of random number generator
* controlled by the environment variable GSL_RNG_TYPE
* and allocate a random number generator
*/
gsl_rng_env_setup();
const gsl_rng_type* T=gsl_rng_default;
gsl_rng* R=gsl_rng_alloc(T);
/* seed the generator with the current time */
gsl_rng_set(R, time(0));
/* read values from the generator, using the desired distribution */
for (i=0; i<=n; ++i)
{ a[i]=doublereal(gsl_ran_ugaussian(R)); }
/* discard the random number generator */
gsl_rng_free(R);
} /* tf_gsl_rng_ugaussian__ */
/* create a gaussian random vector of given size
* the values have unit variance and zero mean
*
* a: random vector
* n: size of random vector
*/
int tf_gsl_rng_uniform__(doublereal* a, integer* n)
{
int i;
/* set the default type of random number generator
* controlled by the environment variable GSL_RNG_TYPE
* and allocate a random number generator
*/
gsl_rng_env_setup();
const gsl_rng_type* T=gsl_rng_default;
gsl_rng* R=gsl_rng_alloc(T);
/* seed the generator with the current time */
gsl_rng_set(R, time(0));
/* read values from the generator, using the desired distribution */
for (i=0; i<=n; ++i)
{ a[i]=doublereal(gsl_rng_uniform(R)); }
/* discard the random number generator */
gsl_rng_free(R);
} /* tf_gsl_rng_uniform__ */
/* ----- END OF tf_gsl.c ----- */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment