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]

QRNG-Niederreiter Sequence (fwd)


Hi,

Has somebody used the qrng to generate Niederreiter sequences? I was
wondering if the sequnces produced by that are correct. I've generated
both the Sobol and the Niedereiter and for 2 dimensions these 2 are almost
the same (except for the first and last point). Is this a fact??? Should
the 2 sequences be almost identical?

I've used:
#include <stdio.h>
#include <gsl/gsl_qrng.h>
#define M 20
#define DIM 2

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

  qmc = gsl_qrng_alloc (gsl_qrng_niederreiter_2, DIM);

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


  gsl_qrng_free(qmc);
  return 0;
}

and the Niederreiter seq is:

0.000000 0.000000
0.500000 0.500000
0.750000 0.250000
0.250000 0.750000
0.375000 0.375000
0.875000 0.875000
0.625000 0.125000
0.125000 0.625000
0.187500 0.312500
0.687500 0.812500
0.937500 0.062500
0.437500 0.562500
0.312500 0.187500
0.812500 0.687500
0.562500 0.437500
0.062500 0.937500
0.093750 0.468750
0.593750 0.968750
0.843750 0.218750
0.343750 0.718750

Can somebody please check if this is right?

The Sobol sequence (2 dim, n=20) is:

0.5     0.5
0.75    0.25
0.25    0.75
0.375   0.375
0.875   0.875
0.625   0.125
0.125   0.625
0.1875  0.3125
0.6875  0.8125
0.9375  0.0625
0.4375  0.5625
0.3125  0.1875
0.8125  0.6875
0.5625  0.4375
0.0625  0.9375
0.09375 0.46875
0.59375 0.96875
0.84375 0.21875
0.34375 0.71875
0.46875 0.09375

Should they be almost the same? Is this a known fact or is just an error?

Thank you so much!
Ofelia



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