floats

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(dst, s []float32)

Add two vectors: dst = dst + s

func AddTo

func AddTo(a, b, dst []float32)

AddTo adds two vectors and saves the result in dst: dst = a + b

func Div

func Div(dst, s []float32)

Div one vectors by another: dst = dst / s

func Dot

func Dot(a, b []float32) (ret float32)

Dot two vectors.

func MatZero added in v0.2.0

func MatZero(x [][]float32)

MatZero fills zeros in a matrix of 32-bit floats.

func Max added in v0.2.0

func Max(x []float32) float32

Max element of a slice of 32-bit floats.

func Mean added in v0.2.0

func Mean(x []float32) float32

Mean of a slice of 32-bit floats.

func MeanVariance added in v0.2.0

func MeanVariance(x []float32) (mean, variance float32)

MeanVariance computes the sample mean and unbiased variance, where the mean and variance are

\sum_i w_i * x_i / (sum_i w_i)
\sum_i w_i (x_i - mean)^2 / (sum_i w_i - 1)

respectively. If weights is nil then all of the weights are 1. If weights is not nil, then len(x) must equal len(weights). When weights sum to 1 or less, a biased variance estimator should be used.

func Min added in v0.2.0

func Min(x []float32) float32

Min element of a slice of 32-bit floats.

func Mul

func Mul(dst, s []float32)

Mul two vectors: dst = dst * s

func MulAddTo added in v0.2.5

func MulAddTo(a, b, c []float32)

MulAddTo multiplies a vector and a vector, then adds to a vector: c += a * b

func MulConst

func MulConst(dst []float32, c float32)

MulConst multiplies a vector with a const: dst = dst * c

func MulConstAddTo

func MulConstAddTo(a []float32, c float32, dst []float32)

MulConstAddTo multiplies a vector and a const, then adds to dst: dst = dst + a * c

func MulConstTo

func MulConstTo(a []float32, c float32, dst []float32)

MulConstTo multiplies a vector and a const, then saves the result in dst: dst = a * c

func StdDev added in v0.2.0

func StdDev(x []float32) float32

StdDev returns the sample standard deviation.

func Sub

func Sub(dst, s []float32)

Sub one vector by another: dst = dst - s

func SubTo

func SubTo(a, b, dst []float32)

SubTo subtracts one vector by another and saves the result in dst: dst = a - b

func Sum added in v0.2.0

func Sum(x []float32) float32

Sum of a slice of 32-bit floats.

func Zero added in v0.2.0

func Zero(a []float32)

Zero fills zeros in a slice of 32-bit floats.

Types

This section is empty.

Jump to

Keyboard shortcuts

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