MCPcopy Create free account
hub / github.com/davisking/dlib / compute_slack

Function compute_slack

dlib/optimization/max_cost_assignment.h:54–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 {
53 template <typename EXP>
54 inline void compute_slack(
55 const long x,
56 std::vector<typename EXP::type>& slack,
57 std::vector<long>& slackx,
58 const matrix_exp<EXP>& cost,
59 const std::vector<typename EXP::type>& lx,
60 const std::vector<typename EXP::type>& ly
61 )
62 {
63 for (long y = 0; y < cost.nc(); ++y)
64 {
65 if (lx[x] + ly[y] - cost(x,y) < slack[y])
66 {
67 slack[y] = lx[x] + ly[y] - cost(x,y);
68 slackx[y] = x;
69 }
70 }
71 }
72 }
73
74// ----------------------------------------------------------------------------------------

Callers 1

max_cost_assignmentFunction · 0.85

Calls 1

ncMethod · 0.45

Tested by

no test coverage detected