moarray

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T types.RealNumbers](v []T) (res []T, err error)

func Add

func Add[T types.RealNumbers](v1, v2 []T) ([]T, error)

func Cast

func Cast[I types.RealNumbers, O types.RealNumbers](in []I) (out []O, err error)

func Compare

func Compare[T types.RealNumbers](v1, v2 []T) int

Compare returns an integer comparing two arrays/vectors lexicographically. TODO: this function might not be correct. we need to compare using tolerance for float values. TODO: need to check if we need len(v1)==len(v2) check.

func CosineDistance

func CosineDistance[T types.RealNumbers](v1, v2 []T) (float64, error)

func CosineSimilarity

func CosineSimilarity[T types.RealNumbers](v1, v2 []T) (float64, error)

func Divide

func Divide[T types.RealNumbers](v1, v2 []T) ([]T, error)

func InnerProduct

func InnerProduct[T types.RealNumbers](v1, v2 []T) (float64, error)

func L1Norm

func L1Norm[T types.RealNumbers](v []T) (float64, error)

L1Norm returns l1 distance to origin.

func L2Distance

func L2Distance[T types.RealNumbers](v1, v2 []T) (float64, error)

func L2Norm

func L2Norm[T types.RealNumbers](v []T) (float64, error)

L2Norm returns l2 distance to origin.

func Multiply

func Multiply[T types.RealNumbers](v1, v2 []T) ([]T, error)

func NormalizeL2

func NormalizeL2[T types.RealNumbers](v1 []T) ([]T, error)

func Sqrt

func Sqrt[T types.RealNumbers](v []T) (res []float64, err error)

func Subtract

func Subtract[T types.RealNumbers](v1, v2 []T) ([]T, error)

func Summation

func Summation[T types.RealNumbers](v []T) (float64, error)

func ToGonumVector

func ToGonumVector[T types.RealNumbers](arr1 []T) *mat.VecDense

func ToGonumVectors

func ToGonumVectors[T types.RealNumbers](arrays ...[]T) (res []*mat.VecDense, err error)

func ToMoArray

func ToMoArray[T types.RealNumbers](vec *mat.VecDense) (arr []T)

func ToMoArrays

func ToMoArrays[T types.RealNumbers](vecs []*mat.VecDense) [][]T

Types

This section is empty.

Jump to

Keyboard shortcuts

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