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

Function split

dlib/optimization/max_sum_submatrix.h:45–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44 template <typename T>
45 void split (
46 const range_set<T>& rset,
47 range_set<T>& a,
48 range_set<T>& b
49 )
50 {
51 if (rset.top_max - rset.top_min > rset.bottom_max - rset.bottom_min)
52 {
53 // split top
54 const int middle = (rset.top_max + rset.top_min)/2;
55 a.top_min = rset.top_min;
56 a.top_max = middle;
57 b.top_min = middle+1;
58 b.top_max = rset.top_max;
59
60 a.bottom_min = rset.bottom_min;
61 a.bottom_max = rset.bottom_max;
62 b.bottom_min = rset.bottom_min;
63 b.bottom_max = rset.bottom_max;
64 }
65 else
66 {
67 // split bottom
68 const int middle = (rset.bottom_max + rset.bottom_min)/2;
69 a.bottom_min = rset.bottom_min;
70 a.bottom_max = middle;
71 b.bottom_min = middle+1;
72 b.bottom_max = rset.bottom_max;
73
74 a.top_min = rset.top_min;
75 a.top_max = rset.top_max;
76 b.top_min = rset.top_min;
77 b.top_max = rset.top_max;
78 }
79 }
80
81 // ------------------------------------------------------------------------------------
82

Callers 1

max_sum_submatrixFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected