+ do files

This commit is contained in:
Caner Candan 2010-07-05 19:04:35 +02:00
commit a038586edb
27 changed files with 1439 additions and 0 deletions

60
src/doSamplerNormal.h Normal file
View file

@ -0,0 +1,60 @@
#ifndef _doSamplerNormal_h
#define _doSamplerNormal_h
#include <utils/eoRNG.h>
#include "doSampler.h"
#include "doNormal.h"
#include "doBounder.h"
/**
* doSamplerNormal
* This class uses the Normal distribution parameters (bounds) to return
* a random position used for population sampling.
*/
template < typename EOT >
class doSamplerNormal : public doSampler< doNormal< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
doSamplerNormal( doBounder< EOT > & bounder )
: doSampler< doNormal< EOT > >( bounder )
{}
EOT sample( doNormal< 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)
{
solution.push_back(
rng.normal(distrib.mean()[i],
distrib.variance()[i])
);
}
//-------------------------------------------------------------
return solution;
}
};
#endif // !_doSamplerNormal_h