mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Implements the kmeans++ algo to select the landmarks in the geometric method
Former-commit-id: 732404a0dc6d7276e4e479dd2481aa4bd42d4ce5
This commit is contained in:
@ -15,6 +15,12 @@ func (r intRanker) Len() int { return len(r.x) }
|
||||
func (r intRanker) Less(i, j int) bool { return r.x[r.r[i]] < r.x[r.r[j]] }
|
||||
func (r intRanker) Swap(i, j int) { r.r[i], r.r[j] = r.r[j], r.r[i] }
|
||||
|
||||
// IntOrder sorts a slice of integers and returns a slice
|
||||
// of indices that represents the order of the sorted
|
||||
// elements.
|
||||
//
|
||||
// `data` is a slice of integers to be ordered.
|
||||
// Returns a slice of the ordered indices.
|
||||
func IntOrder(data []int) []int {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user