util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Overview

Util provides util to handle common tasks: file and struct operations, string manipulation, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertBinToInt added in v0.2.0

func ConvertBinToInt(n []float64) int

func ConvertIntToBinary added in v0.2.0

func ConvertIntToBinary(n int64, d int) []float64

func GenerateRandomBinaryInt added in v0.2.0

func GenerateRandomBinaryInt(d int) []float64

func GenerateRandomIntWithBinaryDim added in v0.2.0

func GenerateRandomIntWithBinaryDim(d int) int64

func MaxInSlice added in v0.2.0

func MaxInSlice(v []float64) (float64, int)

MaxInSlice return max value in float64 slice It returns the max float64 value and index of max in slice.

func Random added in v0.2.0

func Random(min, max int) int

Random return pseudo random number in [min, max]

func Round added in v0.2.0

func Round(val float64, roundOn float64, places int) (newVal float64)

func ScalarProduct

func ScalarProduct(a []float64, b []float64) float64

ScalarProduct compute scalar product between two float64 based slices. It returns a float64 value.

func StringInSlice

func StringInSlice(element string, slice []string) (bool, int)

StringInSlice looks for a string in slice. It returns true or false and position of string in slice (false, -1 if not found).

func StringToFloat

func StringToFloat(slice []string, mode int, def float64) []float64

StringToFloat cast a slice of string element to a slice of float64 element. If passed mode is 0, for each error encountered in casting, passed default will be inserted in slice. If passed mode is 1, output slice will contain only correctly casted element. It returns slice converted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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