mathutils

package
v0.0.101 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Average added in v0.0.94

func Average[T types.Number](array []T) float64

Average 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 given input

func Correlation added in v0.0.94

func Correlation[T types.Number](arr1, arr2 []T) float64

Correlation 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 Covariance added in v0.0.94

func Covariance[T types.Number](arr1, arr2 []T) float64

Covariance is delegated to calculate the Covariance between the given arrays

func DumpMatrix added in v0.0.18

func DumpMatrix[T any](m [][]T) 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 types.Number

func FindIndexValue added in v0.0.20

func FindIndexValue[T types.Number](array []T, value T) []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[T types.Number](max T) []T

GenerateFibonacci is delegated to generate the Fibonacci sequence

func InitMatrix added in v0.0.24

func InitMatrix[T types.Number](r, c int) [][]T

InitMatrix is delegated to initialize a new empty matrix

func InitMatrixCustom added in v0.0.24

func InitMatrixCustom[T types.Number](r, c int, value T) [][]T

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

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 Max added in v0.0.94

func Max[T types.Number](a, b T) T

Max is delegated to return the max from the two given numbers

func MaxIndex added in v0.0.94

func MaxIndex[T types.Number](array []T) int

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

func Maxs added in v0.0.94

func Maxs[T types.Number](a ...T) T

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

func Median added in v0.0.94

func Median[T types.Number](arr []T) float64

Median is delegated to calculate the median for the given array

func Min added in v0.0.94

func Min[T types.Number](a, b T) T

Min is delegated to return the min from the two given numbers

func MinIndex added in v0.0.94

func MinIndex[T types.Number](array []T) int

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

func Mins added in v0.0.94

func Mins[T types.Number](a ...T) T

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

func Mode added in v0.0.94

func Mode[T types.Number](array []T) []T

Mode is delegated to calculate the mode of the given array

func MultiplyMatrix added in v0.0.18

func MultiplyMatrix[T types.Number](m1, m2 [][]T) [][]T

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

func MultiplyMatrixLegacy added in v0.0.23

func MultiplyMatrixLegacy[T types.Number](m1, m2 [][]T) [][]T

MultiplyMatrixLegacy is delegated to execute the multiplication between the given matrix

func MultiplySumArray added in v0.0.18

func MultiplySumArray[T types.Number](a, b []T) T

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

func NewArray added in v0.0.94

func NewArray[T types.Number](n int, value T) []T

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

func PadArray added in v0.0.19

func PadArray[T types.Number](array []T, n int) []T

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

func SimilarityPreCheck added in v0.0.22

func SimilarityPreCheck[T types.Number](a, b []T) bool

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

func SortMaxIndex added in v0.0.20

func SortMaxIndex[T types.Number](array []T) []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 StandardDeviation added in v0.0.94

func StandardDeviation[T types.Number](array []T) float64

StandardDeviation is delegated to calculate the STD for the given array

func SubtractArray added in v0.0.94

func SubtractArray[T types.Number](integers []T) T

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

func SubtractArrays added in v0.0.94

func SubtractArrays[T types.Number](a1, a2 []T) []T

SubtractArrays is delegated to sum the two given array

func SubtractMatrix added in v0.0.18

func SubtractMatrix[T types.Number](m1, m2 [][]T) [][]T

SubtractMatrix is delegated to sum the given matrix

func SumArray added in v0.0.94

func SumArray[T types.Number](array []T) T

SumArray return the sum of every element contained in the array

func SumArrays added in v0.0.19

func SumArrays[T types.Number](a1, a2 []T) []T

SumArrays is delegated to sum the two given array

func SumArraysPadded added in v0.0.94

func SumArraysPadded[T types.Number](n1, n2 []T) []T

SumArraysPadded is delegated to sum 2 array of different length.

func SumMatrix added in v0.0.18

func SumMatrix[T types.Number](m1, m2 [][]T) [][]T

SumMatrix is delegated to sum the given matrix

func Transponse1D added in v0.0.101

func Transponse1D[T any](v []T) [][1]T

Transponse1D This method does not perform the real transpose

func Variance added in v0.0.94

func Variance[T types.Number](array []T) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

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