floatx

package
v0.0.0-...-0953495 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2015 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrIndexOutOfRange = Error("floatx: index out of range")
	ErrZeroLength      = Error("floatx: zero length in slice definition")
	ErrLength          = Error("floatx: length mismatch")
)

Variables

View Source
var Inv = func(r int, v float64) float64 { return 1.0 / v }

Functions

func Abs

func Abs(dst, s []float64)

Abs returns the absolute value, element-wise, of the elements of s, and stores in dst. Panics if the lengths of dst and s do not match.

func Apply

func Apply(fn ApplyFunc, in, out []float64) []float64

Apply function to 1D slice. If out slice is empty, the function is applied in place.

func Apply2D

func Apply2D(fn ApplyFunc2D, in, out [][]float64) [][]float64

Apply function to 2D slice. If out slice is empty, the function is applied in place.

func Apply3D

func Apply3D(fn ApplyFunc3D, in, out [][][]float64) [][][]float64

Apply function to 3D slice. If out slice is empty, the function is applied in place.

func Check2D

func Check2D(s [][]float64) (n1, n2 int)

func Check3D

func Check3D(s [][][]float64) (n1, n2, n3 int)

func Clear

func Clear(s []float64)

Set all values to zero.

func Clear2D

func Clear2D(s [][]float64)

Set all values to zero.

func Clear3D

func Clear3D(s [][][]float64)

Set all values to zero.

func ConvertInf

func ConvertInf(value float64) float64

Replace Inf and -Inf to +/- MaxFloat64 value.

func ConvertInfSlice

func ConvertInfSlice(values []float64) []float64

Replace Inf and -Inf values in slice to +/- MaxFloat64 value.

func ConvertInfSlice2D

func ConvertInfSlice2D(values [][]float64) [][]float64

Replace Inf and -Inf values in slice of slices to +/- MaxFloat64 value.

func CopyFloat2D

func CopyFloat2D(s [][]float64) [][]float64

func Exp

func Exp(dst, s []float64)

Exp returns the exponential base-e, element-wise, of the elements of s, and stores in dst. Panics if the lengths of dst and s do not match.

func Flatten2D

func Flatten2D(s [][]float64) []float64

func Floorv

func Floorv(min float64) func(r int, v float64) float64

func Log

func Log(dst, s []float64)

Log returns the natural logarithm, element-wise, of the elements of s, and stores in dst. Panics if the lengths of dst and s do not match.

func MakeFloat2D

func MakeFloat2D(n1, n2 int) [][]float64

func MakeFloat3D

func MakeFloat3D(n1, n2, n3 int) [][][]float64

func Sq

func Sq(dst, s []float64)

Sq returns the square, element-wise, of the elements of s, and stores in dst. Panics if the lengths of dst and s do not match.

func Sqrt

func Sqrt(dst, s []float64)

Sqrt returns the square root, element-wise, of the elements of s, and stores in dst. Panics if the lengths of dst and s do not match.

func SubSlice2D

func SubSlice2D(s [][]float64, c int) []float64

Types

type ApplyFunc

type ApplyFunc func(n int, v float64) float64

func AddScalarFunc

func AddScalarFunc(f float64) ApplyFunc

func ScaleFunc

func ScaleFunc(f float64) ApplyFunc

func SetValueFunc

func SetValueFunc(f float64) ApplyFunc

type ApplyFunc2D

type ApplyFunc2D func(n1, n2 int, v float64) float64

type ApplyFunc3D

type ApplyFunc3D func(n1, n2, n3 int, v float64) float64

type Error

type Error string

func (Error) Error

func (err Error) Error() string

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

A simple []float64 slice pool object. Use it to avoid allocating unecessary resources in concurrent code.

func NewPool

func NewPool(n int) *Pool

func (*Pool) Get

func (pool *Pool) Get() []float64

func (*Pool) Put

func (pool *Pool) Put(p []float64)

Jump to

Keyboard shortcuts

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