an intermediate commit to keep updates

This commit is contained in:
Caner Candan 2010-08-16 07:52:30 +02:00
commit 963d59e706
21 changed files with 649 additions and 556 deletions

65
src/doSamplerNormalMono.h Normal file
View file

@ -0,0 +1,65 @@
#ifndef _doSamplerNormalMono_h
#define _doSamplerNormalMono_h
#include <utils/eoRNG.h>
#include "doSampler.h"
#include "doNormalMono.h"
#include "doBounder.h"
#include "doStats.h"
/**
* doSamplerNormalMono
* This class uses the NormalMono distribution parameters (bounds) to return
* a random position used for population sampling.
*/
template < typename EOT >
class doSamplerNormalMono : public doSampler< doNormalMono< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
doSamplerNormalMono( doBounder< EOT > & bounder )
: doSampler< doNormalMono< EOT > >( bounder )
{}
EOT sample( doNormalMono< EOT >& distrib )
{
unsigned int size = distrib.size();
assert(size > 0);
//-------------------------------------------------------------
// Point we want to sample to get higher a set of points
// (coordinates in n dimension)
// x = {x1, x2, ..., xn}
//-------------------------------------------------------------
EOT solution;
//-------------------------------------------------------------
//-------------------------------------------------------------
// Sampling all dimensions
//-------------------------------------------------------------
for (unsigned int i = 0; i < size; ++i)
{
AtomType mean = distrib.mean()[i];
AtomType variance = distrib.variance()[i];
AtomType random = rng.normal(mean, variance);
assert(variance >= 0);
solution.push_back(random);
}
//-------------------------------------------------------------
return solution;
}
};
#endif // !_doSamplerNormalMono_h