random number generators

random number generators

Portrait de stansy

Hi,
Why the first element of the vector is generated from the distribution with the mean value equal to 0.0. How should I correct this code:

void RNorm(int n ,float *x ,float mu=100.0f, float sigma=1.0f)
{
VSLStreamStatePtr stream;
vslNewStream( &stream, VSL_BRNG_MCG31, 777);
// vsRngGaussian( VSL_METHOD_SGAUSSIAN_BOXMULLER2, stream, 1, x, mu, sigma );  //if I use this line the result will be correct
vsRngGaussian( VSL_METHOD_SGAUSSIAN_BOXMULLER2, stream, n, x, mu, sigma );
vslDeleteStream( &stream );
}

Thanks,
Stan

4 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Gennady Fedorov (Intel)

here what i see with this generator when n == 11 elements:( mkl 11.0.update2) 

1.exe

mu == 100.000000

X[0] == 94.557526

X[1] == 100.209007
X[2] == 98.103668
X[3] == 101.462799
X[4] == 99.835510
X[5] == 100.047592
X[6] == 100.162888
X[7] == 100.772491
X[8] == 100.407875
X[9] == 98.523254
X[10] == 99.375008

Portrait de Andrey Nikolaev (Intel)

Hello Stan,

Please, have a look at the paper which describes some aspects of initialization (seed'ing) of random number generators in Intel(R) Math Kernel Library, http://software.intel.com/en-us/articles/initializing-Intel-MKL-BRNGs/

Does it answer your question?

Thanks,

Andrey

Portrait de stansy

Hello Andrey,

Thank you very much for your help. I have not read this document before but intuitively applied to the tips outlined in it.

With greetings,
Stan

Connectez-vous pour laisser un commentaire.