MCPcopy Create free account
hub / github.com/GeoDaCenter/geoda / pick_rand_breaks

Function pick_rand_breaks

Explore/CatClassification.cpp:69–81  ·  view source on GitHub ↗

Assume that b.size() <= N-1 */

Source from the content-addressed store, hash-verified

67
68/** Assume that b.size() <= N-1 */
69void pick_rand_breaks(std::vector<int>& b, int N, boost::uniform_01<boost::mt19937>& X)
70{
71 int num_breaks = b.size();
72 if (num_breaks > N-1) return;
73
74 std::set<int> s;
75 while (s.size() != num_breaks) s.insert(1 + (N-1)*X());
76 int cnt=0;
77 for (std::set<int>::iterator it=s.begin(); it != s.end(); it++) {
78 b[cnt++] = *it;
79 }
80 std::sort(b.begin(), b.end());
81}
82
83// translate unique value breaks into normal breaks given unique value mapping
84void unique_to_normal_breaks(const std::vector<int>& u_val_breaks,

Callers 2

FindNaturalBreaksMethod · 0.85
SetNaturalBreaksCatsMethod · 0.85

Calls 3

sortFunction · 0.50
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected