mathutils

package
v0.0.80 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AverageFloat32 added in v0.0.7

func AverageFloat32(array []float32) float64

AverageFloat32 is delegated to calculate the average of a float32 array

func AverageFloat64 added in v0.0.7

func AverageFloat64(array []float64) float64

AverageFloat64 is delegated to calculate the average of a float64 array

func AverageInt added in v0.0.7

func AverageInt(array []int) float64

AverageInt is delegated to calculate the average of an int array

func AverageInt32 added in v0.0.14

func AverageInt32(array []int32) float64

AverageInt32 is delegated to calculate the average of an int array

func AverageInt64 added in v0.0.14

func AverageInt64(array []int64) float64

AverageInt64 is delegated to calculate the average of an int array

func CalculateMaxPrimeFactor added in v0.0.19

func CalculateMaxPrimeFactor(n int64) int64

CalculateMaxPrimeFactor is delegated to calculate the max prime factor for the input number

func CorrelationFloat64 added in v0.0.23

func CorrelationFloat64(arr1, arr2 []float64) float64

CorrelationFloat64 is delegated to calculate the correlation for the two given arrays

func CorrelationInt added in v0.0.23

func CorrelationInt(arr1, arr2 []int) float64

CorrelationInt is delegated to calculate the correlation for the two given arrays

func CosineSimilarity added in v0.0.22

func CosineSimilarity(a, b []float64) float64

CosineSimilarity is delegated to calculate the Cosine Similarity for the given array

func CovarianceFloat64 added in v0.0.23

func CovarianceFloat64(arr1, arr2 []float64) float64

CovarianceFloat64 is delegated to calculate the Covariance between the given arrays

func CovarianceInt added in v0.0.23

func CovarianceInt(arr1, arr2 []int) float64

CovarianceInt is delegated to calculate the Covariance between the given arrays

func DumpMatrix added in v0.0.18

func DumpMatrix(m [][]int) string

DumpMatrix is delegated to print the given matrix

func EuclideanDistance added in v0.0.22

func EuclideanDistance(v1, v2 []float64) float64

EuclideanDistance is delegated to calculate the euclidean distance for the given array

func ExtractEvenValuedNumber added in v0.0.19

func ExtractEvenValuedNumber(array []int64) []int64

ExtractEvenValuedNumber Is delegated to extract only the even number from the input array

func FindDivisor added in v0.0.19

func FindDivisor(n int) []int

FindDivisor is delegated to find every divisor for the input number

func FindIndexValue added in v0.0.20

func FindIndexValue(array []int, value int) []int

FindIndexValue is delegated to retrieve the index of the given value into the input array.

func GenerateFibonacci added in v0.0.19

func GenerateFibonacci(max int64) []int64

GenerateFibonacci is delegated to generate the Fibonacci sequence

func GenerateFibonacciN added in v0.0.24

func GenerateFibonacciN(max int) []float64

GenerateFibonacciN is delegated to generate N Fibonacci number

func InitIntArray added in v0.0.18

func InitIntArray(dimension, value int) []int

InitIntArray is delegated to initialize a new array of the given dimension, populated with the same input value

func InitMatrix added in v0.0.24

func InitMatrix(r, c int) [][]int

InitMatrix is delegated to initialize a new empty matrix

func InitMatrixCustom added in v0.0.24

func InitMatrixCustom(r, c, value int) [][]int

InitMatrixCustom is delegated to initialize a matrix with the given dimension using the same value for each field

func InitRandomMatrix added in v0.0.18

func InitRandomMatrix(r, c int) [][]int

InitRandomMatrix is delegated to initialize a random matrix with the given dimension

func IsPrime added in v0.0.19

func IsPrime(n int) bool

IsPrime is delegated to verify if the given number is Prime

func ManhattanDistance added in v0.0.22

func ManhattanDistance(v1, v2 []float64) float64

ManhattanDistance is delegated to calculate the Manhattan norm for the given array

func MaxFloat32Index added in v0.0.14

func MaxFloat32Index(array []float32) int

MaxFloat32Index return the index that contains the max value for the given array

func MaxFloat64 added in v0.0.24

func MaxFloat64(a, b float64) float64

MaxFloat64 is delegated to return the max int from the two given int

func MaxFloat64Index added in v0.0.14

func MaxFloat64Index(array []float64) int

MaxFloat64Index return the index that contains the max value for the given array

func MaxInt added in v0.0.22

func MaxInt(a, b int) int

MaxInt is delegated to return the max int from the two given int

func MaxInt32Index added in v0.0.14

func MaxInt32Index(array []int32) int

MaxInt32Index return the index that contains the max value for the given array

func MaxInt64Index added in v0.0.14

func MaxInt64Index(array []int64) int

MaxInt64Index return the index that contains the max value for the given array

func MaxIntIndex

func MaxIntIndex(array []int) int

MaxIntIndex return the index that contains the max value for the given array

func MaxIntMultiple added in v0.0.22

func MaxIntMultiple(a ...int) int

MaxIntMultiple is delegated to return the max value with a variable number of input int

func MedianInt added in v0.0.23

func MedianInt(arr []int) float64

MedianInt is delegated to calculate the median for the given INT array

func MinFloat64 added in v0.0.24

func MinFloat64(a, b float64) float64

MinFloat64 is delegated to return the min int from the two given int

func MinInt added in v0.0.22

func MinInt(a, b int) int

MinInt is delegated to return the min int from the two given int

func MinInt64 added in v0.0.75

func MinInt64(a, b int64) int64

MinInt64 is delegated to return the min int from the two given int

func MinIntIndex added in v0.0.22

func MinIntIndex(array []int) int

MinIntIndex return the index that contains the min value for the given array

func MinIntMultiple added in v0.0.22

func MinIntMultiple(a ...int) int

MinIntMultiple is delegated to return the min value with a variable number of input int

func ModeInt added in v0.0.23

func ModeInt(array []int) []int

ModeInt is delegated to calculate the mode of the given array

func MultiplyMatrix added in v0.0.18

func MultiplyMatrix(m1, m2 [][]int) [][]int

MultiplyMatrix is delegated to execute the multiplication between the given matrix without extra allocation

func MultiplyMatrixLegacy added in v0.0.23

func MultiplyMatrixLegacy(m1, m2 [][]int) [][]int

MultiplyMatrixLegacy is delegated to execute the multiplication between the given matrix

func MultiplySumArray added in v0.0.18

func MultiplySumArray(a, b []int) int

MultiplySumArray is delegated to multiply the given array and sum every number of the result array

func PadArray added in v0.0.19

func PadArray(array []int, n int) []int

PadArray is delegated to return a new padded array with length n

func SimilarityPreCheck added in v0.0.22

func SimilarityPreCheck(a, b []float64) bool

SimilarityPreCheck is delegated to verify that the given array have the correct size

func SortMaxIndex added in v0.0.20

func SortMaxIndex(array []int) []int

SortMaxIndex is delegated to return an array that contains the position of the order value (from max to min) of the given array {1, 9, 2, 10, 3} -> [3 1 4 2 0] || {7, 6, 5, 4, 3, 2, 1} -> [0 1 2 3 4 5 6] || {1, 2, 3, 4, 5, 6, 7} -> [6 5 4 3 2 1 0]

func StandardDeviationFloat64 added in v0.0.23

func StandardDeviationFloat64(array []float64) float64

StandardDeviationFloat64 is delegated to calculate the STD for the given array

func StandardDeviationInt added in v0.0.23

func StandardDeviationInt(array []int) float64

StandardDeviationInt is delegated to calculate the STD for the given array

func SubtractIntArray added in v0.0.18

func SubtractIntArray(integers []int) int

SubtractIntArray subtract of every element contained in the array and return the result

func SubtractIntArrays added in v0.0.18

func SubtractIntArrays(a1, a2 []int) []int

SubtractIntArrays is delegated to sum the two given array

func SubtractMatrix added in v0.0.18

func SubtractMatrix(m1, m2 [][]int) [][]int

SubtractMatrix is delegated to sum the given matrix

func SumArrays added in v0.0.19

func SumArrays(n1, n2 []int) []int

SumArrays is delegated to sum 2 array of different length.

func SumFloat32Array added in v0.0.14

func SumFloat32Array(integers []float32) float32

SumFloat32Array return the of every element contained in the array

func SumFloat64Array added in v0.0.14

func SumFloat64Array(integers []float64) float64

SumFloat64Array return the of every element contained in the array

func SumInt32Array added in v0.0.14

func SumInt32Array(integers []int32) int32

SumInt32Array return the of every element contained in the array

func SumInt64Array added in v0.0.14

func SumInt64Array(integers []int64) int64

SumInt64Array return the of every element contained in the array

func SumIntArray

func SumIntArray(integers []int) int

SumIntArray return the sum of every element contained in the array

func SumIntArrays added in v0.0.18

func SumIntArrays(a1, a2 []int) []int

SumIntArrays is delegated to sum the two given array

func SumMatrix added in v0.0.18

func SumMatrix(m1, m2 [][]int) [][]int

SumMatrix is delegated to sum the given matrix

func VarianceInt added in v0.0.23

func VarianceInt(array []int) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

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