correct template typedef for NormalMulti* classes
This commit is contained in:
parent
c0be5c9700
commit
2c0638aa8f
4 changed files with 21 additions and 20 deletions
|
|
@ -155,18 +155,16 @@ public:
|
|||
#ifdef WITH_EIGEN
|
||||
|
||||
//! edoEstimatorNormalMulti< EOT >
|
||||
template < typename EOT >
|
||||
class edoEstimatorNormalMulti : public edoEstimator< edoNormalMulti< EOT > >
|
||||
template < typename EOT, typename EOD = edoNormalMulti<EOT> >
|
||||
class edoEstimatorNormalMulti : public edoEstimator< EOD >
|
||||
{
|
||||
public:
|
||||
class CovMatrix
|
||||
{
|
||||
public:
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
// typedef typename edoNormalMulti<AtomType>::Vector Vector;
|
||||
// typedef typename edoNormalMulti<AtomType>::Matrix Matrix;
|
||||
typedef Eigen::Matrix< AtomType, 1, Eigen::Dynamic, Eigen::RowMajor> Vector;
|
||||
typedef Eigen::Matrix< AtomType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Matrix;
|
||||
typedef typename EOD::Vector Vector;
|
||||
typedef typename EOD::Matrix Matrix;
|
||||
|
||||
CovMatrix( const eoPop< EOT >& pop )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,13 +52,12 @@ public:
|
|||
#else
|
||||
#ifdef WITH_EIGEN
|
||||
|
||||
template < typename EOT >
|
||||
class edoNormalMultiCenter : public edoModifierMass< edoNormalMulti< EOT > >
|
||||
template < typename EOT, typename EOD = edoNormalMulti< EOT > >
|
||||
class edoNormalMultiCenter : public edoModifierMass<EOD>
|
||||
{
|
||||
public:
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
// typedef typename edoNormalMulti<AtomType>::Vector Vector;
|
||||
typedef Eigen::Matrix< AtomType, 1, Eigen::Dynamic, Eigen::RowMajor> Vector;
|
||||
typedef typename EOD::Vector Vector;
|
||||
|
||||
void operator() ( edoNormalMulti< EOT >& distrib, EOT& mass )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,10 +96,9 @@ class edoSamplerNormalMulti : public edoSampler< EOD >
|
|||
{
|
||||
public:
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
// typedef typename edoNormalMulti<AtomType>::Vector Vector;
|
||||
// typedef typename edoNormalMulti<AtomType>::Matrix Matrix;
|
||||
typedef Eigen::Matrix< AtomType, 1, Eigen::Dynamic, Eigen::RowMajor> Vector;
|
||||
typedef Eigen::Matrix< AtomType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Matrix;
|
||||
|
||||
typedef typename EOD::Vector Vector;
|
||||
typedef typename EOD::Matrix Matrix;
|
||||
|
||||
edoSamplerNormalMulti( edoRepairer<EOT> & repairer )
|
||||
: edoSampler< EOD >( repairer)
|
||||
|
|
@ -116,7 +115,7 @@ public:
|
|||
// Computes L and D such as V = L D L^T
|
||||
Eigen::LDLT<Matrix> cholesky( distrib.varcovar() );
|
||||
Matrix L = cholesky.matrixL();
|
||||
Matrix D = cholesky.vectorD();
|
||||
Matrix D = cholesky.vectorD().asDiagonal();
|
||||
|
||||
// now compute the final symetric matrix: LsD = L D^1/2
|
||||
// remember that V = ( L D^1/2) ( L D^1/2)^T
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Authors:
|
|||
|
||||
typedef eoReal< eoMinimizingFitness > EOT;
|
||||
typedef edoNormalMulti< EOT > Distrib;
|
||||
typedef EOT::AtomType AtomType;
|
||||
typedef typename EOT::AtomType AtomType;
|
||||
|
||||
#ifdef WITH_BOOST
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
|
|
@ -53,10 +53,8 @@ typedef EOT::AtomType AtomType;
|
|||
#else
|
||||
#ifdef WITH_EIGEN
|
||||
#include <Eigen/Dense>
|
||||
// typedef typename edoNormalMulti<AtomType>::Vector Vector;
|
||||
// typedef typename edoNormalMulti<AtomType>::Matrix Matrix;
|
||||
typedef Eigen::Matrix< AtomType, 1, Eigen::Dynamic, Eigen::RowMajor> Vector;
|
||||
typedef Eigen::Matrix< AtomType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Matrix;
|
||||
typedef typename edoNormalMulti<EOT>::Vector Vector;
|
||||
typedef typename edoNormalMulti<EOT>::Matrix Matrix;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -144,7 +142,14 @@ int main(int ac, char** av)
|
|||
// (2) distribution initial parameters
|
||||
|
||||
|
||||
#ifdef WITH_BOOST
|
||||
Vector mean( s_size, mean_value );
|
||||
#else
|
||||
#ifdef WITH_EIGEN
|
||||
Vector mean( s_size );
|
||||
mean = Vector::Constant( s_size, mean_value);
|
||||
#endif
|
||||
#endif
|
||||
Matrix varcovar( s_size, s_size );
|
||||
|
||||
varcovar( 0, 0 ) = covar1_value;
|
||||
|
|
|
|||
Reference in a new issue