gearmath

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Intersection added in v1.0.3

func Intersection[T constraints.Ordered | constraints.Complex](slice1, slice2 []T) []T

Intersection return the same elements of two slices

func IsPrime

func IsPrime(num int) bool

IsPrime weather a number is a prime

func IsSubset

func IsSubset[T comparable](s, subset []T) bool

IsSubset return true if the slice contains all the elements in the subset

func Max

func Max[T constraints.Integer | constraints.Float](s []T) T

Max return the minimum value of the slice return zero value if the slice is empty

func Mean

func Mean(s []float64) float64

Mean return the mean value of the slice

func Min

func Min[T constraints.Integer | constraints.Float](s []T) T

Min return the minimum value of the slice return zero value if the slice is empty

func Sum

Sum return a sum of the slice

func SumBy

func SumBy[T any, V constraints.Integer | constraints.Float](s []T, fn func(el T, index int) V) V

SumBy summarize the values in the slice using the given return value from the function

func Union

func Union[T constraints.Ordered | constraints.Complex](args ...[]T) []T

Union return the union values of slices

Types

This section is empty.

Jump to

Keyboard shortcuts

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