EigenRand
EigenRand copied to clipboard
Unrealistic result of StdNormalGen.
My code:
#include <iostream>
#include <functional>
#include <Eigen/Dense>
#include <EigenRand/EigenRand>
using namespace std;
using namespace Eigen;
int main()
{
Rand::Vmt19937_64 urng{4212};
Rand::StdNormalGen<float> stdnorm;
for (int i = 0; i < 10; ++i)
{
cout << stdnorm.generate<Matrix<float, 4, -1>>(4, 1, urng) << endl;
};
};
``
Returning result:
-0
-6.42001 8.3635 -6.50135 1.90169 2.42386e-38 2.94601e-38 2.49921e-38 -0 0 -0 0 0.783801 0.534232 1.48888 0.844737 4.74061 7.18897 -0 -5.66121 1.59769e-38 2.74603e-38 0.594965 2.17096e-38 -1.74388 -0 -0 3.80259 6.58371e-39 0.81791 0.762132 1.40474e-38 -0 -2.30039 -0 -12.4106 1.05125 8.62637e-39 0.706428 4.00838e-38
One can see that there are many values very close to 0. It's unlikely that these values obey normal distribution.
I'm using EigenRand in 64bit Ubuntu and my CPU has AVX and SSE flags.
Hi, @kilasuelika , thank you for your interest in my package. Can you share your environment more detail including your Ubuntu version, compiler version and compile options?
Hi, @kilasuelika , thank you for your interest in my package. Can you share your environment more detail including your Ubuntu version, compiler version and compile options?
I have upload a RepEigenRand.zip to my fork. It contains all necessary files to run.
I'm using G++ 10.2 with cxx_std_20 on Ubuntu 20.04.
I tested on my single core server and home computer. Results are the same. These two computers have same Ubuntu OS version and toolchain.
@kilasuelika, Sorry for late reply. I tried to reproduce your bug in the same environment to yours, but it failed. I think maybe it's caused by the hardware architecture like SIMD instructions. Could you share your CPU model?