X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;ds=sidebyside;f=test%2FTestHungarian.cpp;h=55620a9994b01f93b5c4f9dfb763932e38984ae6;hb=209cfd9fe0ea398b794d1d1995629a826125f035;hp=3d6173fdcfa54041d412b22d6174350ff270e16d;hpb=48adce31a0ffdb3757ee1be8a63ce7e769e87deb;p=trackerpp.git diff --git a/test/TestHungarian.cpp b/test/TestHungarian.cpp index 3d6173f..55620a9 100644 --- a/test/TestHungarian.cpp +++ b/test/TestHungarian.cpp @@ -1,6 +1,7 @@ #include "hungarian.h" #include "gtest/gtest.h" #include +#include using namespace std; using namespace Eigen; @@ -46,6 +47,15 @@ TEST(Hungarian, 4x3) EXPECT_TRUE(expect_col_ind == col_ind); } +TEST(Hungarian, 0x0) +{ + MatrixXi C = MatrixXi::Zero(0, 0); + VectorXi row_ind, col_ind; + int ret = linear_sum_assignment(C, row_ind, col_ind); + EXPECT_EQ(ret, 0); +} + + TEST(Distance, consine) { Vector3d u, v; @@ -78,3 +88,31 @@ TEST(Distance, euclidean) d = distance_euclidean(u, v); EXPECT_DOUBLE_EQ(d, 1.0); } + +TEST(Distance, vector) +{ + std::vector sv = {1, 2, 3, 4, 5, 6}; + VectorXi v1; + VectorXi b = Eigen::Map(sv.data(), sv.size()); + std::cout << b << std::endl; + std::vector f1_hog = { 0.1, 0.2, 0,3}; +// Eigen::Map(f2_hog.data(), f2_hog.size()) + + //VectorXd mf = Map >(sv.data(), sv.size()); + std::vector sd = {1, 2, 3, 4, 5, 6}; + VectorXd mm = Map(sd.data(), sd.size()); + VectorXd xd = Map >(sd.data(), sd.size()); + cout << Map >(sd.data(), sd.size()) << endl; + + int array[12]; + for(int i = 0; i < 12; ++i) array[i] = i; + cout << Map >(sv.data(), sv.size()) // the inner stride has already been passed as template parameter + << endl; + + + //Vector3d v = Vector3d::Random(); + //std::cout << v << std::endl; + +} + +