package
Version:
v0.4.5
Opens a new window with list of versions in this module.
Published: Nov 28, 2023
License: GPL-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
func OrderInt(values []int, decreasing bool) []int
Returns reordered indices (permutation) by values (like order() R function).
It may be in decreasing order.
Example:
input := []int{10,20,30,80,50}
output := OrderInt(input) // {0,1,2,4,3}
// To iterate over the sorted array :
for _,ord := range output {
input[ord]
}
func SortIntBy(toSort []int, byValues []int, decreasing bool)
Sorts "toSort" array according to "byValues" Array.
- "toSort" array is modified after the function.
- "byValues" array is not modified.
The sort may be in decreasing order.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.