Adding dep files and dependencies.
This commit is contained in:
parent
45f9efa578
commit
b341c0a0e4
539 changed files with 313111 additions and 0 deletions
43
vendor/github.com/montanaflynn/stats/util.go
generated
vendored
Normal file
43
vendor/github.com/montanaflynn/stats/util.go
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
package stats
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
)
|
||||
|
||||
// float64ToInt rounds a float64 to an int
|
||||
func float64ToInt(input float64) (output int) {
|
||||
r, _ := Round(input, 0)
|
||||
return int(r)
|
||||
}
|
||||
|
||||
// unixnano returns nanoseconds from UTC epoch
|
||||
func unixnano() int64 {
|
||||
return time.Now().UTC().UnixNano()
|
||||
}
|
||||
|
||||
// copyslice copies a slice of float64s
|
||||
func copyslice(input Float64Data) Float64Data {
|
||||
s := make(Float64Data, input.Len())
|
||||
copy(s, input)
|
||||
return s
|
||||
}
|
||||
|
||||
// sortedCopy returns a sorted copy of float64s
|
||||
func sortedCopy(input Float64Data) (copy Float64Data) {
|
||||
copy = copyslice(input)
|
||||
sort.Float64s(copy)
|
||||
return
|
||||
}
|
||||
|
||||
// sortedCopyDif returns a sorted copy of float64s
|
||||
// only if the original data isn't sorted.
|
||||
// Only use this if returned slice won't be manipulated!
|
||||
func sortedCopyDif(input Float64Data) (copy Float64Data) {
|
||||
if sort.Float64sAreSorted(input) {
|
||||
return input
|
||||
}
|
||||
copy = copyslice(input)
|
||||
sort.Float64s(copy)
|
||||
return
|
||||
}
|
Reference in a new issue