Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrealistic result of StdNormalGen. #15

Open
kilasuelika opened this issue Nov 26, 2020 · 3 comments
Open

Unrealistic result of StdNormalGen. #15

kilasuelika opened this issue Nov 26, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@kilasuelika
Copy link

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.
@bab2min bab2min added the bug Something isn't working label Nov 26, 2020
@bab2min
Copy link
Owner

bab2min commented Nov 26, 2020

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?

@kilasuelika
Copy link
Author

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.

@bab2min
Copy link
Owner

bab2min commented Jan 26, 2021

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants