From 15ae721ceae936f7a9f2aa0e3473e41f21a4a181 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Thu, 9 Sep 2010 13:55:18 +0200 Subject: [PATCH] * added some comments --- src/doEstimatorNormalMulti.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/doEstimatorNormalMulti.h b/src/doEstimatorNormalMulti.h index e1c907b27..098eb8f59 100644 --- a/src/doEstimatorNormalMulti.h +++ b/src/doEstimatorNormalMulti.h @@ -22,14 +22,23 @@ public: CovMatrix( const eoPop< EOT >& pop ) { - unsigned int p_size = pop.size(); // population size + //------------------------------------------------------------- + // Some checks before starting to estimate covar + //------------------------------------------------------------- + unsigned int p_size = pop.size(); // population size assert(p_size > 0); unsigned int s_size = pop[0].size(); // solution size - assert(s_size > 0); + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Copy the population to an ublas matrix + //------------------------------------------------------------- + ublas::matrix< AtomType > sample( p_size, s_size ); for (unsigned int i = 0; i < p_size; ++i) @@ -40,6 +49,9 @@ public: } } + //------------------------------------------------------------- + + _varcovar.resize(s_size, s_size); @@ -52,6 +64,8 @@ public: ublas::symmetric_matrix< AtomType, ublas::lower > var = ublas::prod( ublas::trans( sample ), sample ); + // Be sure that the symmetric matrix got the good size + assert(var.size1() == s_size); assert(var.size2() == s_size); assert(var.size1() == _varcovar.size1()); @@ -60,6 +74,8 @@ public: //------------------------------------------------------------- + // TODO: to remove the comment below + // for (unsigned int i = 0; i < s_size; ++i) // { // // triangular LOWER matrix, thus j is not going further than i @@ -72,7 +88,7 @@ public: _varcovar = var / p_size; - _mean.resize(s_size); + _mean.resize(s_size); // FIXME: check if it is really used because of the assignation below // unit vector ublas::scalar_vector< AtomType > u( p_size, 1 );