X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=src%2Fhungarian.cpp;h=fffb1f3758050696180adad79baba1e650b9395d;hb=70532232dd98f31467eff7baaaff6e68f803bb45;hp=85b49e508bdcede372009cf2a3a566902242fb35;hpb=0d625404c2ef4a286e1feee4485ff60c0fb9730e;p=trackerpp.git diff --git a/src/hungarian.cpp b/src/hungarian.cpp index 85b49e5..fffb1f3 100644 --- a/src/hungarian.cpp +++ b/src/hungarian.cpp @@ -57,6 +57,11 @@ int linear_sum_assignment(const MatrixXi& cost_matrix, VectorXi& row_ind, Vector { // The algorithm expects more columns than rows in the cost matrix. MatrixXi correct_matrix = cost_matrix; + if (cost_matrix.cols() == 0 || cost_matrix.rows() == 0){ + row_ind = VectorXi::Zero(0); + col_ind = VectorXi::Zero(0); + return 0; + } bool is_transposed = false; if (cost_matrix.cols() < cost_matrix.rows()){ cout << "cols < rows, transpose." << endl; @@ -301,3 +306,4 @@ int step_six(Hungary& state) } return 4; } +