| 55 | // ---------------------------------------------------------------------------------------- |
| 56 | |
| 57 | py::list _max_cost_assignment ( |
| 58 | const matrix<double>& cost |
| 59 | ) |
| 60 | { |
| 61 | if (cost.nr() != cost.nc()) |
| 62 | throw dlib::error("The input matrix must be square."); |
| 63 | |
| 64 | // max_cost_assignment() only works with integer matrices, so convert from |
| 65 | // double to integer. |
| 66 | const double scale = (std::numeric_limits<dlib::int64>::max()/1000)/max(abs(cost)); |
| 67 | matrix<dlib::int64> int_cost = matrix_cast<dlib::int64>(round(cost*scale)); |
| 68 | return vector_to_python_list(max_cost_assignment(int_cost)); |
| 69 | } |
| 70 | |
| 71 | double _assignment_cost ( |
| 72 | const matrix<double>& cost, |
nothing calls this directly
no test coverage detected