From 99f282180efdb3bfba25eb48d90a9e7bb5f30b1b Mon Sep 17 00:00:00 2001 From: toni Date: Tue, 18 Apr 2017 11:15:06 +0200 Subject: [PATCH] commiting a hackgit diff! attention --- math/distribution/NormalN.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/math/distribution/NormalN.h b/math/distribution/NormalN.h index bb332c4..b30c4d9 100644 --- a/math/distribution/NormalN.h +++ b/math/distribution/NormalN.h @@ -91,7 +91,12 @@ namespace Distribution { Assert::notEqual(numElements, 0, "data is empty, thats not enough for getting the distribution!"); const Eigen::MatrixXd centered = data.rowwise() - mean.transpose(); - const Eigen::MatrixXd cov = (centered.adjoint() * centered) / double(data.rows() - 1); + Eigen::MatrixXd cov = (centered.adjoint() * centered) / double(data.rows() - 1); + + //this is a hack + if(cov(2,2) < 0.1){ + cov(2,2) = 0.1; + } return NormalDistributionN(mean, cov); }