utils

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Epsilon = math.Nextafter(1, 2) - 1
)

Functions

func Abs

func Abs[T Number](val T) T

func Arange

func Arange[T Number](from T, to T, step T) []T

func ArgMax

func ArgMax[T Number](values ...T) int

func ArgMin

func ArgMin[T Number](values ...T) int

func Clip

func Clip[T Number](value T, lower T, upper T) T

func ClipLower

func ClipLower[T Number](value T, lower T) T

func ClipUpper

func ClipUpper[T Number](value T, upper T) T

func Combination

func Combination[T Number](n, k int) T

func Factorial

func Factorial[T Number](n int) T

func Fibonacci

func Fibonacci[T Number](n int, params *FibonacciParameters) []T

func MakeSlice

func MakeSlice[T any](fill T, size ...int) []T

MakeSlice makes slice of type T and returned slice is filled by `fill` value of T. size and capacity can be passet as in standard make function.

func Max

func Max[T Number](values ...T) T

func Min

func Min[T Number](values ...T) T

func PascalsTriangle

func PascalsTriangle[T Number](n int, params *PascalsTriangleParameters) []T

func Reverse

func Reverse[T any](values []T)

func Sign

func Sign[T Number](val T) T

func SineWave

func SineWave(n int, params *SineWaveParameters) []float64

func Sum

func Sum[T Number](values []T) T

func SymmetricTriangle

func SymmetricTriangle[T Number](n int, params *SymmetricTriangleParameters) []T

Types

type FibonacciParameters

type FibonacciParameters struct {
	Zero, Weighted bool
}

type Number

type Number interface {
	constraints.Signed | constraints.Float
}

type PascalsTriangleParameters

type PascalsTriangleParameters struct {
	Weighted, Inverse bool
}

type SineWaveParameters

type SineWaveParameters struct {
	Weighted bool
}

type SymmetricTriangleParameters

type SymmetricTriangleParameters struct {
	Weighted bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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