rename everything from 'do' to 'edo'

This commit is contained in:
Johann Dreo 2011-01-27 11:23:23 +01:00
commit d618ab07df
73 changed files with 2936 additions and 1534 deletions

View file

@ -2,8 +2,8 @@
### 1) Set all needed source files for the project
######################################################################################
FILE(GLOB HDRS *.h do)
INSTALL(FILES ${HDRS} DESTINATION include/do COMPONENT headers)
FILE(GLOB HDRS *.h edo)
INSTALL(FILES ${HDRS} DESTINATION include/edo COMPONENT headers)
FILE(GLOB SOURCES *.cpp)

59
src/do
View file

@ -1,59 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _do_
#define _do_
#include "doAlgo.h"
#include "doEDASA.h"
#include "doEDA.h"
#include "doDistrib.h"
#include "doUniform.h"
#include "doNormalMono.h"
#include "doNormalMulti.h"
#include "doEstimator.h"
#include "doEstimatorUniform.h"
#include "doEstimatorNormalMono.h"
#include "doEstimatorNormalMulti.h"
#include "doModifier.h"
#include "doModifierDispersion.h"
#include "doModifierMass.h"
#include "doUniformCenter.h"
#include "doNormalMonoCenter.h"
#include "doNormalMultiCenter.h"
#include "doSampler.h"
#include "doSamplerUniform.h"
#include "doSamplerNormalMono.h"
#include "doSamplerNormalMulti.h"
#include "doVectorBounds.h"
#include "doBounder.h"
#include "doBounderNo.h"
#include "doBounderBound.h"
#include "doBounderRng.h"
#include "doContinue.h"
#include "utils/doCheckPoint.h"
#include "utils/doStat.h"
#include "utils/doStatUniform.h"
#include "utils/doStatNormalMono.h"
#include "utils/doStatNormalMulti.h"
#include "utils/doFileSnapshot.h"
#include "utils/doPopStat.h"
#endif // !_do_
// Local Variables:
// mode: C++
// End:

View file

@ -1,8 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#include "do"

View file

@ -1,23 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doAlgo_h
#define _doAlgo_h
#include <eoAlgo.h>
template < typename D >
class doAlgo : public eoAlgo< typename D::EOType >
{
//! Alias for the type
typedef typename D::EOType EOT;
public:
virtual ~doAlgo(){}
};
#endif // !_doAlgo_h

View file

@ -1,34 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doBounder_h
#define _doBounder_h
#include <eoFunctor.h>
template < typename EOT >
class doBounder : public eoUF< EOT&, void >
{
public:
doBounder( EOT min = EOT(1, 0), EOT max = EOT(1, 0) )
: _min(min), _max(max)
{
assert(_min.size() > 0);
assert(_min.size() == _max.size());
}
// virtual void operator()( EOT& ) = 0 (provided by eoUF< A1, R >)
EOT& min(){return _min;}
EOT& max(){return _max;}
private:
EOT _min;
EOT _max;
};
#endif // !_doBounder_h

View file

@ -1,42 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doBounderBound_h
#define _doBounderBound_h
#include "doBounder.h"
template < typename EOT >
class doBounderBound : public doBounder< EOT >
{
public:
doBounderBound( EOT min, EOT max )
: doBounder< EOT >( min, max )
{}
void operator()( EOT& x )
{
unsigned int size = x.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) // browse all dimensions
{
if (x[d] < this->min()[d])
{
x[d] = this->min()[d];
continue;
}
if (x[d] > this->max()[d])
{
x[d] = this->max()[d];
}
}
}
};
#endif // !_doBounderBound_h

View file

@ -1,20 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doBounderNo_h
#define _doBounderNo_h
#include "doBounder.h"
template < typename EOT >
class doBounderNo : public doBounder< EOT >
{
public:
void operator()( EOT& ) {}
};
#endif // !_doBounderNo_h

View file

@ -1,42 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doBounderRng_h
#define _doBounderRng_h
#include "doBounder.h"
template < typename EOT >
class doBounderRng : public doBounder< EOT >
{
public:
doBounderRng( EOT min, EOT max, eoRndGenerator< double > & rng )
: doBounder< EOT >( min, max ), _rng(rng)
{}
void operator()( EOT& x )
{
unsigned int size = x.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) // browse all dimensions
{
// FIXME: attention: les bornes RNG ont les memes bornes quelque soit les dimensions idealement on voudrait avoir des bornes differentes pour chaque dimensions.
if (x[d] < this->min()[d] || x[d] > this->max()[d])
{
x[d] = _rng();
}
}
}
private:
eoRndGenerator< double> & _rng;
};
#endif // !_doBounderRng_h

View file

@ -1,35 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
*/
#ifndef _doBounderUniform_h
#define _doBounderUniform_h
#include "doBounder.h"
template < typename EOT >
class doBounderUniform : public doBounder< EOT >
{
public:
doBounderUniform( EOT min, EOT max )
: doBounder< EOT >( min, max )
{}
void operator()( EOT& sol )
{
unsigned int size = sol.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) {
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
// use EO's global "rng"
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
}
} // for d in size
}
};
#endif // !_doBounderUniform_h

View file

@ -1,41 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doContinue_h
#define _doContinue_h
#include <eoFunctor.h>
#include <eoPersistent.h>
//! doContinue< EOT > classe fitted to Distribution Object library
template < typename D >
class doContinue : public eoUF< const D&, bool >, public eoPersistent
{
public:
virtual std::string className(void) const { return "doContinue"; }
void readFrom(std::istream&)
{
/* It should be implemented by subclasses ! */
}
void printOn(std::ostream&) const
{
/* It should be implemented by subclasses ! */
}
};
template < typename D >
class doDummyContinue : public doContinue< D >
{
bool operator()(const D&){ return true; }
virtual std::string className() const { return "doDummyContinue"; }
};
#endif // !_doContinue_h

View file

@ -1,23 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doDistrib_h
#define _doDistrib_h
#include <eoFunctor.h>
template < typename EOT >
class doDistrib : public eoFunctorBase
{
public:
//! Alias for the type
typedef EOT EOType;
virtual ~doDistrib(){}
};
#endif // !_doDistrib_h

View file

@ -1,23 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doEstimator_h
#define _doEstimator_h
#include <eoPop.h>
#include <eoFunctor.h>
template < typename D >
class doEstimator : public eoUF< eoPop< typename D::EOType >&, D >
{
public:
typedef typename D::EOType EOType;
// virtual D operator() ( eoPop< EOT >& )=0 (provided by eoUF< A1, R >)
};
#endif // !_doEstimator_h

View file

@ -1,77 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doEstimatorNormalMono_h
#define _doEstimatorNormalMono_h
#include "doEstimator.h"
#include "doNormalMono.h"
template < typename EOT >
class doEstimatorNormalMono : public doEstimator< doNormalMono< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
class Variance
{
public:
Variance() : _sumvar(0){}
void update(AtomType v)
{
_n++;
AtomType d = v - _mean;
_mean += 1 / _n * d;
_sumvar += (_n - 1) / _n * d * d;
}
AtomType get_mean() const {return _mean;}
AtomType get_var() const {return _sumvar / (_n - 1);}
AtomType get_std() const {return sqrt( get_var() );}
private:
AtomType _n;
AtomType _mean;
AtomType _sumvar;
};
public:
doNormalMono< EOT > operator()(eoPop<EOT>& pop)
{
unsigned int popsize = pop.size();
assert(popsize > 0);
unsigned int dimsize = pop[0].size();
assert(dimsize > 0);
std::vector< Variance > var( dimsize );
for (unsigned int i = 0; i < popsize; ++i)
{
for (unsigned int d = 0; d < dimsize; ++d)
{
var[d].update( pop[i][d] );
}
}
EOT mean( dimsize );
EOT variance( dimsize );
for (unsigned int d = 0; d < dimsize; ++d)
{
mean[d] = var[d].get_mean();
variance[d] = var[d].get_var();
}
return doNormalMono< EOT >( mean, variance );
}
};
#endif // !_doEstimatorNormalMono_h

View file

@ -1,51 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doEstimatorUniform_h
#define _doEstimatorUniform_h
#include "doEstimator.h"
#include "doUniform.h"
// TODO: calcule de la moyenne + covariance dans une classe derivee
template < typename EOT >
class doEstimatorUniform : public doEstimator< doUniform< EOT > >
{
public:
doUniform< EOT > operator()(eoPop<EOT>& pop)
{
unsigned int size = pop.size();
assert(size > 0);
EOT min = pop[0];
EOT max = pop[0];
for (unsigned int i = 1; i < size; ++i)
{
unsigned int size = pop[i].size();
assert(size > 0);
// possibilité d'utiliser std::min_element et std::max_element mais exige 2 pass au lieu d'1.
for (unsigned int d = 0; d < size; ++d)
{
if (pop[i][d] < min[d])
min[d] = pop[i][d];
if (pop[i][d] > max[d])
max[d] = pop[i][d];
}
}
return doUniform< EOT >(min, max);
}
};
#endif // !_doEstimatorUniform_h

View file

@ -1,20 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doModifier_h
#define _doModifier_h
template < typename D >
class doModifier
{
public:
virtual ~doModifier(){}
typedef typename D::EOType EOType;
};
#endif // !_doModifier_h

View file

@ -1,23 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doModifierDispersion_h
#define _doModifierDispersion_h
#include <eoPop.h>
#include <eoFunctor.h>
#include "doModifier.h"
template < typename D >
class doModifierDispersion : public doModifier< D >, public eoBF< D&, eoPop< typename D::EOType >&, void >
{
public:
// virtual void operator() ( D&, eoPop< D::EOType >& )=0 (provided by eoBF< A1, A2, R >)
};
#endif // !_doModifierDispersion_h

View file

@ -1,24 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doModifierMass_h
#define _doModifierMass_h
#include <eoFunctor.h>
#include "doModifier.h"
template < typename D >
class doModifierMass : public doModifier< D >, public eoBF< D&, typename D::EOType&, void >
{
public:
//typedef typename D::EOType::AtomType AtomType; // does not work !!!
// virtual void operator() ( D&, D::EOType& )=0 (provided by eoBF< A1, A2, R >)
};
#endif // !_doModifierMass_h

View file

@ -1,38 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doNormalMono_h
#define _doNormalMono_h
#include "doDistrib.h"
template < typename EOT >
class doNormalMono : public doDistrib< EOT >
{
public:
doNormalMono( const EOT& mean, const EOT& variance )
: _mean(mean), _variance(variance)
{
assert(_mean.size() > 0);
assert(_mean.size() == _variance.size());
}
unsigned int size()
{
assert(_mean.size() == _variance.size());
return _mean.size();
}
EOT mean(){return _mean;}
EOT variance(){return _variance;}
private:
EOT _mean;
EOT _variance;
};
#endif // !_doNormalMono_h

View file

@ -1,26 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doNormalMonoCenter_h
#define _doNormalMonoCenter_h
#include "doModifierMass.h"
#include "doNormalMono.h"
template < typename EOT >
class doNormalMonoCenter : public doModifierMass< doNormalMono< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
void operator() ( doNormalMono< EOT >& distrib, EOT& mass )
{
distrib.mean() = mass;
}
};
#endif // !_doNormalMonoCenter_h

View file

@ -1,28 +0,0 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doNormalMultiCenter_h
#define _doNormalMultiCenter_h
#include "doModifierMass.h"
#include "doNormalMulti.h"
template < typename EOT >
class doNormalMultiCenter : public doModifierMass< doNormalMulti< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
void operator() ( doNormalMulti< EOT >& distrib, EOT& mass )
{
ublas::vector< AtomType > mean( distrib.size() );
std::copy( mass.begin(), mass.end(), mean.begin() );
distrib.mean() = mean;
}
};
#endif // !_doNormalMultiCenter_h

Some files were not shown because too many files have changed in this diff Show more