From 0f4e43c0e7c41a1fbac512032af83aa27697cebc Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Fri, 10 Sep 2010 23:21:31 +0200 Subject: [PATCH] t-doEstimatorNormalMulti: display means and distance --- test/t-doEstimatorNormalMulti.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/t-doEstimatorNormalMulti.cpp b/test/t-doEstimatorNormalMulti.cpp index c6fdeabce..4dbc658ce 100644 --- a/test/t-doEstimatorNormalMulti.cpp +++ b/test/t-doEstimatorNormalMulti.cpp @@ -161,8 +161,6 @@ int main(int ac, char** av) pop.push_back( candidate_solution ); } - // pop.sort(); - //----------------------------------------------------------------------------- @@ -211,5 +209,29 @@ int main(int ac, char** av) //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // (8) euclidianne distance estimation + //----------------------------------------------------------------------------- + + ublas::vector< AtomType > new_mean = distrib.mean(); + ublas::symmetric_matrix< AtomType, ublas::lower > new_varcovar = distrib.varcovar(); + + AtomType distance = 0; + + for ( unsigned int d = 0; d < s_size; ++d ) + { + distance += pow( mean[ d ] - new_mean[ d ], 2 ); + } + + distance = sqrt( distance ); + + eo::log << eo::logging + << "mean: " << mean << std::endl + << "new mean: " << new_mean << std::endl + << "distance: " << distance << std::endl + ; + + //----------------------------------------------------------------------------- + return 0; }