slice

package
v0.0.0-...-ec70614 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(a, b []int) []int

Difference returns the elements in `a` that aren't in `b`.

func Distinct

func Distinct(ints []int) []int

Distinct returns a unique slice

func DistinctFloats

func DistinctFloats(floats []float64) []float64

func GetIndxFloat64

func GetIndxFloat64(sorted []float64, x float64) int

GetIndxFloat64 performs a Go-native binary tree search on a sorted slice of floats to determine the position x would fit. modified from: https://flaviocopes.com/golang-algorithms-binary-search/

func Intersect

func Intersect(a, b []int) (set []int)

Intersect returns the intersection of 2 slices modified from: https://github.com/juliangruber/go-intersect/blob/master/intersect.go

func InvertMap

func InvertMap(origMap map[int]int) (newMap map[int][]int, sortedkeys []int)

InvertMap collect slices of keys that share a particular value

func Max

func Max(s []int) int

Max returns the maximum value of an integer slice

func OnlyPositive

func OnlyPositive(s []float64) []float64

OnlyPositive removes all value <= 0.0 and all NaN's

func Rev

func Rev(s []int)

Rev is quick function used to reverse order of a slice

func RevF

func RevF(s []float64)

RevF is quick function used to reverse order of a float64 slice

func Sequential

func Sequential(n int) []int

Sequential builds a n+1 length slice indexed from 0 to n

func SliceMax

func SliceMax(s []float64) float64

SliceMax returns the maximum value of a slice

func SliceMean

func SliceMean(s []float64) float64

SliceMean returns the mean value of a slice

func SliceMedian

func SliceMedian(s []float64) float64

SliceMedian returns the median value of a slice

func SliceMin

func SliceMin(s []float64) float64

SliceMin returns the minimum value of a slice

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL