vectors

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T constraints.Integer | constraints.Float](a []T) []T

Abs computes the absolute value of each element in a vector.

func AbsInPlace

func AbsInPlace[T constraints.Integer | constraints.Float](a []T)

AbsInPlace computes the absolute value of each element in a vector and stores the result in the vector.

func Add

func Add[T constraints.Integer | constraints.Float](a, b []T) []T

Add adds two vectors together and returns the result.

func AddInPlace

func AddInPlace[T constraints.Integer | constraints.Float](a, b []T)

AddInPlace adds two vectors together and stores the result in the first vector.

func AddNumber

func AddNumber[T constraints.Integer | constraints.Float](a []T, b T) []T

AddNumber adds a number to each element of a vector and returns the result.

func AddNumberInPlace

func AddNumberInPlace[T constraints.Integer | constraints.Float](a []T, b T)

AddNumberInPlace adds a number to each element of a vector and stores the result in the vector.

func DivideNumber

func DivideNumber[T constraints.Integer | constraints.Float](a []T, b T) []T

DivideNumber divides each element of a vector by a number and returns the result.

func DivideNumberInPlace

func DivideNumberInPlace[T constraints.Integer | constraints.Float](a []T, b T)

DivideNumberInPlace divides each element of a vector by a number and stores the result in the vector.

func Dot

func Dot[T constraints.Integer | constraints.Float](a, b []T) T

Dot computes the dot product of two vectors.

func EuclidianDistance

func EuclidianDistance[T constraints.Integer | constraints.Float](a, b []T) float64

EuclidianDistance computes the Euclidian distance between two vectors.

func Magnitude

func Magnitude[T constraints.Integer | constraints.Float](a []T) float64

Magnitude computes the magnitude of a vector.

func Max

func Max[T constraints.Integer | constraints.Float](a []T) T

Max computes the maximum element in a vector.

func Mean

func Mean[T constraints.Integer | constraints.Float](a []T) float64

func Mean computes the mean of a vector.

func Min

func Min[T constraints.Integer | constraints.Float](a []T) T

Min computes the minimum element in a vector.

func MultiplyNumber

func MultiplyNumber[T constraints.Integer | constraints.Float](a []T, b T) []T

MultiplyNumber multiplies each element of a vector by a number and returns the result.

func MultiplyNumberInPlace

func MultiplyNumberInPlace[T constraints.Integer | constraints.Float](a []T, b T)

MultiplyNumberInPlace multiplies each element of a vector by a number and stores the result in the vector.

func Normalize

func Normalize[T constraints.Integer | constraints.Float](a []T) []float64

Normalize normalizes a vector to have a magnitude of 1.

func Product

func Product[T constraints.Integer | constraints.Float](a []T) T

Product computes the product of all elements in a vector.

func Subtract

func Subtract[T constraints.Integer | constraints.Float](a, b []T) []T

Subtract subtracts one vector from another and returns the result.

func SubtractInPlace

func SubtractInPlace[T constraints.Integer | constraints.Float](a, b []T)

SubtractInPlace subtracts one vector from another and stores the result in the first vector.

func SubtractNumber

func SubtractNumber[T constraints.Integer | constraints.Float](a []T, b T) []T

SubtractNumber subtracts a number from each element of a vector and returns the result.

func SubtractNumberInPlace

func SubtractNumberInPlace[T constraints.Integer | constraints.Float](a []T, b T)

SubtractNumberInPlace subtracts a number from each element of a vector and stores the result in the vector.

func Sum

func Sum[T constraints.Integer | constraints.Float](a []T) T

Sum computes the sum of all elements in a vector.

Types

This section is empty.

Jump to

Keyboard shortcuts

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