added some asserts

This commit is contained in:
toni
2017-03-21 17:20:55 +01:00
parent 3a83f5bdc9
commit 991f42060c
3 changed files with 8 additions and 2 deletions

View File

@@ -53,6 +53,10 @@ namespace Divergence {
auto log1 = std::log(det1);
auto log2 = std::log(det2);
//determinate shouldn't be 0!
Assert::isNot0(det1, "Determinat of the first Gauss is Zero! Check the Cov Matrix.");
Assert::isNot0(det2, "Determinat of the second Gauss is Zero! Check the Cov Matrix.");
//trace
Eigen::MatrixXd toTrace(norm1.getSigma().rows(),norm1.getSigma().cols());
toTrace = norm2.getSigmaInv() * norm1.getSigma();
@@ -74,6 +78,8 @@ namespace Divergence {
if(klb < 0.0){
Assert::doThrow("The Kullback Leibler Distance is < 0! Thats not possible");
}
Assert::isNotNaN(klb, "The Kullback Leibler Distance is NaN!");
return klb;
}