This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

BUG Report for QRNG-Niederreiter-sequence


/*
This is a bug report and bug-demonstration file for gsl-1.2

Hardware: Old PC
SYSTEM RedHat Linux 6.2

Compiler: gcc (sorry I was not able to determine the version number.
               I installed it directly from the red-hat 6.2 CD) 

compiling command used: gcc -static -Wall testbug.c -lgsl -lm 



Bug description: 
For qrng for the Niedereiter-sequence.
The below program should generate the same sequence 3 times
and thus also print three identical lines, as the state of
the sequence is reset by the   "gsl_qrng_init(qmc)" - command
between the for-loops.

But the output on my computer is

0.171875,0.890625,0.628906,0.378906,
0.171875,0.890625,0.628906,0.378906,
0.171875,0.890625,0.519531,0.378906,

There occur similar problems for dimension 3 and for higher dimensions.

******************************************/

#include <stdio.h>
#include <gsl/gsl_qrng.h>
#define M 40
#define DIM 4

int main (void)
{
  double v[DIM];
  int i;
  gsl_qrng *qmc;

  qmc = gsl_qrng_alloc (gsl_qrng_niederreiter_2, DIM);
  
  for(i=0;i<M;i++) gsl_qrng_get(qmc, v);
  for(i=0;i<DIM;i++) printf("%f,",v[i]);
  printf("\n");

  gsl_qrng_init(qmc);/*resets the state of the "generator" to the
start*/

  for(i=0;i<M;i++) gsl_qrng_get(qmc, v);
  for(i=0;i<DIM;i++) printf("%f,",v[i]);
  printf("\n");

  gsl_qrng_init(qmc);/*resets the state of the "generator" to the
start*/

  for(i=0;i<M;i++) gsl_qrng_get(qmc, v);
  for(i=0;i<DIM;i++)  printf("%f,",v[i]);
  printf("\n");

  gsl_qrng_free(qmc);
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]