Skip to content

Commit

Permalink
Made max_cost_assignment() give an error if you incorrectly give it a
Browse files Browse the repository at this point in the history
non-square matrix.
  • Loading branch information
davisking committed Jun 18, 2015
1 parent 3286a0a commit c9c3fa1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/python/src/other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ list _max_cost_assignment (
const matrix<double>& cost
)
{
if (cost.nr() != cost.nc())
throw dlib::error("The input matrix must be square.");

// max_cost_assignment() only works with integer matrices, so convert from
// double to integer.
const double scale = (std::numeric_limits<dlib::int64>::max()/1000)/max(abs(cost));
Expand Down

0 comments on commit c9c3fa1

Please sign in to comment.