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

Function create_unique_val_mapping

Explore/CatClassification.cpp:45–66  ·  view source on GitHub ↗

clears uv_mapping and resizes as needed */

Source from the content-addressed store, hash-verified

43
44/** clears uv_mapping and resizes as needed */
45void create_unique_val_mapping(std::vector<UniqueValElem>& uv_mapping,
46 const std::vector<double>& v,
47 const std::vector<bool>& v_undef)
48{
49 uv_mapping.clear();
50 int cur_ind = -1;
51
52 for (int i=0, iend=v.size(); i<iend; i++) {
53 if (v_undef[i])
54 continue;
55 if (uv_mapping.empty()) {
56 cur_ind++;
57 uv_mapping.push_back(UniqueValElem(v[i], i, i));
58 } else {
59 if (uv_mapping[cur_ind].val != v[i]) {
60 uv_mapping[cur_ind].last = i-1;
61 cur_ind++;
62 uv_mapping.push_back(UniqueValElem(v[i], i, i));
63 }
64 }
65 }
66}
67
68/** Assume that b.size() <= N-1 */
69void pick_rand_breaks(std::vector<int>& b, int N, boost::uniform_01<boost::mt19937>& X)

Callers 4

SetBreakPointsMethod · 0.85
FindNaturalBreaksMethod · 0.85
SetNaturalBreaksCatsMethod · 0.85

Calls 4

UniqueValElemClass · 0.85
clearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected