MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / MapValuesToContiguousRange

Function MapValuesToContiguousRange

internal/ceres/array_utils.cc:93–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void MapValuesToContiguousRange(const int64_t size, int* array) {
94 std::vector<int> unique_values(array, array + size);
95 std::sort(unique_values.begin(), unique_values.end());
96 unique_values.erase(std::unique(unique_values.begin(), unique_values.end()),
97 unique_values.end());
98
99 for (int64_t i = 0; i < size; ++i) {
100 array[i] =
101 std::lower_bound(unique_values.begin(), unique_values.end(), array[i]) -
102 unique_values.begin();
103 }
104}
105
106} // namespace ceres::internal

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68