floatutils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgMax

func ArgMax(v []float32) int

ArgMax finds the index of the max argument.

func ArgMin

func ArgMin(v []float32) int

ArgMin finds the index of the min argument.

func ArgMinMax

func ArgMinMax(v []float32) (imin, imax int)

ArgMinMax finds the indices of min and max arguments.

func Copy

func Copy(in []float32) []float32

Copy creates and return a copy of the given slice.

func CumSum

func CumSum(dst, src []float32) []float32

CumSum computes the cumulative sum of src into dst, and returns dst.

func EqualApprox

func EqualApprox(a, b float32) bool

EqualApprox returns true if a and b are equal to within reasonable absolute tolerance (hardcoded as 1.0e-04).

func FillFloatSlice

func FillFloatSlice(slice []float32, value float32)

FillFloatSlice fills the given slice's elements with value.

func MakeFloatMatrix

func MakeFloatMatrix(rows, cols int) [][]float32

MakeFloatMatrix returns a new 2-dimensional slice.

func Max

func Max(v []float32) (m float32)

Max returns the maximum value from the given slice, which MUST NOT be empty.

func Sign

func Sign(a float32) int

Sign returns +1 if a is positive, -1 if a is negative, or 0 if a is 0.

func SliceEqualApprox

func SliceEqualApprox(a, b []float32) bool

SliceEqualApprox returns true if a and b have the same length and EqualApprox is true for each element pair from a and b.

func SoftMax

func SoftMax(v []float32) (sm []float32)

SoftMax returns the results of the softmax function.

func StrToFloatSlice

func StrToFloatSlice(str string) ([]float32, error)

StrToFloatSlice parses a string representation of a slice of float32 values.

func Sum

func Sum(v []float32) (s float32)

Sum returns the sum of all values from the given slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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