BUGFIX: should use the standard deviation when sampling a mono-normal law, because it have the same scale than the mean
This commit is contained in:
parent
96dc505f92
commit
1af6715ddc
1 changed files with 8 additions and 8 deletions
|
|
@ -28,6 +28,8 @@ Authors:
|
||||||
#ifndef _edoSamplerNormalMono_h
|
#ifndef _edoSamplerNormalMono_h
|
||||||
#define _edoSamplerNormalMono_h
|
#define _edoSamplerNormalMono_h
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <utils/eoRNG.h>
|
#include <utils/eoRNG.h>
|
||||||
|
|
||||||
#include "edoSampler.h"
|
#include "edoSampler.h"
|
||||||
|
|
@ -52,19 +54,17 @@ public:
|
||||||
unsigned int size = distrib.size();
|
unsigned int size = distrib.size();
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
// Point we want to sample to get higher a set of points
|
// The point we want to draw
|
||||||
// (coordinates in n dimension)
|
// (coordinates in n dimension)
|
||||||
// x = {x1, x2, ..., xn}
|
// x = {x1, x2, ..., xn}
|
||||||
EOT solution;
|
EOT solution;
|
||||||
|
|
||||||
// Sampling all dimensions
|
// Sampling all dimensions
|
||||||
for (unsigned int i = 0; i < size; ++i)
|
for (unsigned int i = 0; i < size; ++i) {
|
||||||
{
|
|
||||||
AtomType mean = distrib.mean()[i];
|
AtomType mean = distrib.mean()[i];
|
||||||
AtomType variance = distrib.variance()[i];
|
AtomType variance = distrib.variance()[i];
|
||||||
AtomType random = rng.normal(mean, variance);
|
// should use the standard deviation, which have the same scale than the mean
|
||||||
|
AtomType random = rng.normal(mean, sqrt(variance) );
|
||||||
assert(variance >= 0);
|
|
||||||
|
|
||||||
solution.push_back(random);
|
solution.push_back(random);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue