diff options
Diffstat (limited to 'extern/libmv/third_party/ceres/internal/ceres/array_utils.h')
-rw-r--r-- | extern/libmv/third_party/ceres/internal/ceres/array_utils.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/extern/libmv/third_party/ceres/internal/ceres/array_utils.h b/extern/libmv/third_party/ceres/internal/ceres/array_utils.h index 34fda6fd475..7f56947066b 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/array_utils.h +++ b/extern/libmv/third_party/ceres/internal/ceres/array_utils.h @@ -67,6 +67,21 @@ void AppendArrayToString(const int size, const double* x, string* result); extern const double kImpossibleValue; +// This routine takes an array of integer values, sorts and uniques +// them and then maps each value in the array to its position in the +// sorted+uniqued array. By doing this, if there are are k unique +// values in the array, each value is replaced by an integer in the +// range [0, k-1], while preserving their relative order. +// +// For example +// +// [1 0 3 5 0 1 5] +// +// gets mapped to +// +// [1 0 2 3 0 1 3] +void MapValuesToContiguousRange(int size, int* array); + } // namespace internal } // namespace ceres |