added some asserts
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -29,7 +29,7 @@ int main(int argc, char** argv) {
|
||||
//::testing::GTEST_FLAG(filter) = "*WiFiOptimizer*";
|
||||
|
||||
|
||||
::testing::GTEST_FLAG(filter) = "*FloorplanCeilings*";
|
||||
::testing::GTEST_FLAG(filter) = "*KullbackLeibler*";
|
||||
//::testing::GTEST_FLAG(filter) = "*Barometer*";
|
||||
//::testing::GTEST_FLAG(filter) = "*GridWalk2RelPressure*";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ TEST(KullbackLeibler, multivariateGaussGeCov) {
|
||||
|
||||
double kld12 = Divergence::KullbackLeibler<float>::getMultivariateGauss(norm1, norm2);
|
||||
double kld34 = Divergence::KullbackLeibler<float>::getMultivariateGauss(norm3, norm4);
|
||||
std::cout << kld34 << " >" << kld12 << std::endl;
|
||||
std::cout << kld34 << " > " << kld12 << std::endl;
|
||||
|
||||
double kld12sym = Divergence::KullbackLeibler<float>::getMultivariateGaussSymmetric(norm1, norm2);
|
||||
double kld34sym = Divergence::KullbackLeibler<float>::getMultivariateGaussSymmetric(norm3, norm4);
|
||||
|
||||
Reference in New Issue
Block a user