vek32

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x []float32) []float32

Abs returns the absolute value of each slice element.

func Abs_Inplace

func Abs_Inplace(x []float32)

Abs_Inplace computes the absolute value of each slice element, inplace.

func Abs_Into

func Abs_Into(dst, x []float32) []float32

Abs_Into computes the absolute value of each slice element and stores the result in the destination slice.

func Add

func Add(x, y []float32) []float32

Add returns the result of adding two slices element-wise.

func AddNumber

func AddNumber(x []float32, a float32) []float32

AddNumber returns the result of adding a number to each slice element.

func AddNumber_Inplace

func AddNumber_Inplace(x []float32, a float32)

AddNumber_Inplace adds a number to each slice element, inplace.

func AddNumber_Into

func AddNumber_Into(dst, x []float32, a float32) []float32

AddNumber_Into adds a number to each slice element and stores the result in the destination slice.

func Add_Inplace

func Add_Inplace(x, y []float32)

Add_Inplace adds a slice element-wise to the first slice, inplace.

func Add_Into

func Add_Into(dst, x, y []float32) []float32

Add_Into adds two slices element-wise and stores the result in the destination slice.

func All

func All(x []bool) bool

All returns whether all boolean values in the slice are true.

func And

func And(x, y []bool) []bool

And returns the element-wise logical "and" operation between two slices.

func And_Inplace

func And_Inplace(x, y []bool)

And_Inplace computes the element-wise logical "and" operation between two slices, inplace.

func And_Into

func And_Into(dst, x, y []bool) []bool

And_Into stores the element-wise logical "and" operation between two slices in the destination slice.

func Any

func Any(x []bool) bool

Any returns whether at least one boolean value in the slice is true.

func ArgMax

func ArgMax(x []float32) int

ArgMax returns the (first) index of the maximum value of a slice.

func ArgMin

func ArgMin(x []float32) int

ArgMin returns the (first) index of the minimum value of a slice.

func Ceil

func Ceil(x []float32) []float32

Ceil returns the result of rounding each slice element to the nearest greater integer value.

func Ceil_Inplace

func Ceil_Inplace(x []float32)

Ceil_Inplace rounds each slice element to the nearest greater integer value, inplace.

func Ceil_Into

func Ceil_Into(dst, x []float32) []float32

Ceil_Into rounds each slice element to the nearest greater integer value and stores the result in the destination slice.

func Cos

func Cos(x []float32) []float32

Cos returns the cosine of each element.

func Cos_Inplace

func Cos_Inplace(x []float32)

Cos_Inplace computes the cosine of each element, inplace.

func Cos_Into

func Cos_Into(dst, x []float32) []float32

Cos_Into stores the cosine of each element in the destination slice.

func CosineSimilarity

func CosineSimilarity(x, y []float32) float32

CosineSimilarity returns the cosine similarity of two vectors.

func Count

func Count(x []bool) int

Count returns the number of boolean values that are true.

func CumProd

func CumProd(x []float32) []float32

CumProd returns the cumulative product of a slice. The element at index i equals the product of x[:i+1].

func CumProd_Inplace

func CumProd_Inplace(x []float32)

CumProd_Inplace computes the cumulative product of a slice, inplace. The new element at index i equals the product of x[:i+1].

func CumProd_Into

func CumProd_Into(dst, x []float32) []float32

CumProd_Into computes the cumulative product of a slice and stores the result in the destination slice. The element at index i equals the product of x[:i+1].

func CumSum

func CumSum(x []float32) []float32

CumSum returns the cumulative sum of a slice. The element at index i equals the sum of x[:i+1].

func CumSum_Inplace

func CumSum_Inplace(x []float32)

CumSum_Inplace computes the cumulative sum of a slice, inplace. The new element at index i equals the sum of x[:i+1].

func CumSum_Into

func CumSum_Into(dst, x []float32) []float32

CumSum_Into computes the cumulative sum of a slice and stores the result in the destination slice. The element at index i equals the sum of x[:i+1].

func Distance

func Distance(x, y []float32) float32

Distance returns the Euclidean distance between two vectors.

func Div

func Div(x, y []float32) []float32

Div returns the result of dividing two slices element-wise.

func DivNumber

func DivNumber(x []float32, a float32) []float32

DivNumber returns the result of dividing each slice element by a number.

func DivNumber_Inplace

func DivNumber_Inplace(x []float32, a float32)

DivNumber_Inplace divides each slice element by a number, inplace.

func DivNumber_Into

func DivNumber_Into(dst, x []float32, a float32) []float32

DivNumber_Into divides each slice element by a number and stores the result in the destination slice.

func Div_Inplace

func Div_Inplace(x, y []float32)

Div_Inplace divides the first slice element-wise by the second, inplace.

func Div_Into

func Div_Into(dst, x, y []float32) []float32

Div_Into divides two slices element-wise and stores the result in the destination slice.

func Dot

func Dot(x, y []float32) float32

Dot returns the dot product of two vectors.

func Eq

func Eq(x, y []float32) []bool

Eq returns an element-wise equality comparison between two slices.

func EqNumber

func EqNumber(x []float32, a float32) []bool

EqNumber returns an element-wise equality comparison between each slice element and a number.

func EqNumber_Into

func EqNumber_Into(dst []bool, x []float32, a float32) []bool

EqNumber_Into stores an element-wise equality comparison between each slice element and a number in the destination slice.

func Eq_Into

func Eq_Into(dst []bool, x, y []float32) []bool

Eq_Into stores an element-wise equality comparison between two slices in the destination slice.

func Exp

func Exp(x []float32) []float32

Exp returns the exponential of each element.

func Exp_Inplace

func Exp_Inplace(x []float32)

Exp_Inplace computes the exponential of each element, inplace.

func Exp_Into

func Exp_Into(dst, x []float32) []float32

Exp_Into stores the exponential of each element in the destination slice.

func Find

func Find(x []float32, a float32) int

Find returns the index of the first slice element equal to the given value, or -1 if not found.

func Floor

func Floor(x []float32) []float32

Floor returns the result of rounding each slice element to the nearest lesser integer value.

func Floor_Inplace

func Floor_Inplace(x []float32)

Floor_Inplace rounds each slice element to the nearest lesser integer value, inplace.

func Floor_Into

func Floor_Into(dst, x []float32) []float32

Floor_Into rounds each slice element to the nearest lesser integer value and stores the result in the destination slice.

func FromBool

func FromBool(x []bool) []float32

FromBool creates a slice of floats from a slice of bools by converting all false values to 0 and all true values to 1.

func FromBool_Into

func FromBool_Into(dst []float32, x []bool) []float32

FromBool_Into creates a slice of floats from a slice of bools by converting all false values to 0 and all true values to 1. The result is stored in the destination slice.

func FromFloat64

func FromFloat64(x []float64) []float32

FromFloat64 creates a slice of floats from a slice of 64-bit floats. Standard conversion rules apply.

func FromFloat64_Into

func FromFloat64_Into(dst []float32, x []float64) []float32

FromFloat64_Into creates a slice of floats from a slice of 32-bit floats. Standard conversion rules apply. The result is stored in the destination slice.

func FromInt32

func FromInt32(x []int32) []float32

FromInt32 creates a slice of floats from a slice of 32-bit ints. Standard conversion rules apply.

func FromInt32_Into

func FromInt32_Into(dst []float32, x []int32) []float32

FromInt32_Into creates a slice of floats from a slice of 32-bit ints. Standard conversion rules apply. The result is stored in the destination slice.

func FromInt64

func FromInt64(x []int64) []float32

FromInt64 creates a slice of floats from a slice of 64-bit ints. Standard conversion rules apply.

func FromInt64_Into

func FromInt64_Into(dst []float32, x []int64) []float32

FromInt64_Into creates a slice of floats from a slice of 64-bit ints. Standard conversion rules apply. The result is stored in the destination slice.

func Gather

func Gather(x []float32, idx []int) []float32

Gather returns a new slice containing just the elements at the given indices.

func Gather_Into

func Gather_Into(dst, x []float32, idx []int) []float32

Gather_Into stores the slice elements at the given indices in the destination slice.

func Gt

func Gt(x, y []float32) []bool

Gt returns an element-wise "greater than" comparison between two slices.

func GtNumber

func GtNumber(x []float32, a float32) []bool

GtNumber returns an element-wise "greater than" comparison between each slice element and a number.

func GtNumber_Into

func GtNumber_Into(dst []bool, x []float32, a float32) []bool

GtNumber_Into stores an element-wise "greater than" comparison between each slice element and a number in the destination slice.

func Gt_Into

func Gt_Into(dst []bool, x, y []float32) []bool

Gt_Into stores an element-wise "greater than" comparison between two slices in the destination slice.

func Gte

func Gte(x, y []float32) []bool

Gte returns an element-wise "greater than or equal" comparison between two slices.

func GteNumber

func GteNumber(x []float32, a float32) []bool

GteNumber returns an element-wise "greater than or equal" comparison between each slice element and a number.

func GteNumber_Into

func GteNumber_Into(dst []bool, x []float32, a float32) []bool

GteNumber_Into stores an element-wise "greater than or equal" comparison between each slice element and a number in the destination slice.

func Gte_Into

func Gte_Into(dst []bool, x, y []float32) []bool

Gte_Into stores an element-wise "greater than or equal" comparison between two slices in the destination slice.

func Info

func Info() vek.SystemInfo

Info returns information about the current operating environment.

func Inv

func Inv(x []float32) []float32

Inv returns the multiplicative inverse of each slice element.

func Inv_Inplace

func Inv_Inplace(x []float32)

Inv_Inplace computes the multiplicative inverse of each slice element, inplace.

func Inv_Into

func Inv_Into(dst, x []float32) []float32

Inv_Into computes the multiplicative inverse of each slice element and stores the result in the destination slice.

func Log

func Log(x []float32) []float32

Log returns the natural logarithm of each element.

func Log10

func Log10(x []float32) []float32

Log10 returns the base 10 logarithm of each element.

func Log10_Inplace

func Log10_Inplace(x []float32)

Log10_Inplace computes the base 10 logarithm of each element, inplace.

func Log10_Into

func Log10_Into(dst, x []float32) []float32

Log10_Into stores the base 10 logarithm of each element in the destination slice.

func Log2

func Log2(x []float32) []float32

Log2 returns the base 2 logarithm of each element.

func Log2_Inplace

func Log2_Inplace(x []float32)

Log2_Inplace computes the base 2 logarithm of each element, inplace.

func Log2_Into

func Log2_Into(dst, x []float32) []float32

Log2_Into stores the base 2 logarithm of each element in the destination slice.

func Log_Inplace

func Log_Inplace(x []float32)

Log_Inplace computes the natural logarithm of each element, inplace.

func Log_Into

func Log_Into(dst, x []float32) []float32

Log_Into stores the natural logarithm of each element in the destination slice.

func Lt

func Lt(x, y []float32) []bool

Lt returns an element-wise "less than" comparison between two slices.

func LtNumber

func LtNumber(x []float32, a float32) []bool

LtNumber returns an element-wise "less than" comparison between each slice element and a number.

func LtNumber_Into

func LtNumber_Into(dst []bool, x []float32, a float32) []bool

LtNumber_Into stores an element-wise "less than" comparison between each slice element and a number in the destination slice.

func Lt_Into

func Lt_Into(dst []bool, x, y []float32) []bool

Lt_Into stores an element-wise "less than" comparison between two slices in the destination slice.

func Lte

func Lte(x, y []float32) []bool

Lte returns an element-wise "less than or equal" comparison between two slices.

func LteNumber

func LteNumber(x []float32, a float32) []bool

LteNumber returns an element-wise "less than or equal" comparison between each slice element and a number.

func LteNumber_Into

func LteNumber_Into(dst []bool, x []float32, a float32) []bool

LteNumber_Into stores an element-wise "less than or equal" comparison between each slice element and a number in the destination slice.

func Lte_Into

func Lte_Into(dst []bool, x, y []float32) []bool

Lte_Into stores an element-wise "less than or equal" comparison between two slices in the destination slice.

func ManhattanDistance

func ManhattanDistance(x, y []float32) float32

ManhattanDistance returns the sum of element-wise absolute differences between two slices.

func ManhattanNorm

func ManhattanNorm(x []float32) float32

ManhattanNorm returns the sum of absolute values of the slice elements.

func Mat4Mul

func Mat4Mul(x, y []float32) []float32

Mat4Mul multiplies two 4-by-4 matrices and returns the resulting 4-by-4 matrix. The matrices should be in row-major order. To multiply a matrix and a vector batch them into groups of 4.

func Mat4Mul_Into

func Mat4Mul_Into(dst, x, y []float32) []float32

Mat4Mul_Into multiplies two 4-by-4 matrices and stores the resulting 4-by-4 matrix in the destination slice. The matrices should be in row-major order. To multiply a matrix and a vector batch them into groups of 4.

func MatMul

func MatMul(x, y []float32, n int) []float32

MatMul multiplies an m-by-n and n-by-p matrix and returns the resulting m-by-p matrix. The matrices should be in row-major order. To multiply a matrix and a vector pass an n-by-1 matrix.

func MatMul_Into

func MatMul_Into(dst, x, y []float32, n int) []float32

MatMul_Into multiplies an m-by-n and n-by-p matrix and stores the resulting m-by-p matrix in the destination slice. The matrices should be in row-major order. To multiply a matrix and a vector pass an n-by-1 matrix.

func Max

func Max(x []float32) float32

Max returns the maximum value of a slice.

func Maximum

func Maximum(x, y []float32) []float32

Maximum returns the element-wise maximum values between two slices.

func MaximumNumber

func MaximumNumber(x []float32, a float32) []float32

MaximumNumber returns the maximum of a number and each slice element.

func MaximumNumber_Inplace

func MaximumNumber_Inplace(x []float32, a float32)

MaximumNumber_Inplace compares a number to each slice element and replaces the values in the slice with the maximum value.

func MaximumNumber_Into

func MaximumNumber_Into(dst, x []float32, a float32) []float32

MaximumNumber_Into compares a number to each slice element and stores the maximum values in the destination slice.

func Maximum_Inplace

func Maximum_Inplace(x, y []float32)

Maximum_Inplace compares two slices element-wise and replaces the values in the first slice with the maximum value.

func Maximum_Into

func Maximum_Into(dst, x, y []float32) []float32

Maximum_Into compares two slices element-wise and stores the maximum values in the destination slice.

func Mean

func Mean(x []float32) float32

Mean returns the arithmetic average of the slice elements.

func Median

func Median(x []float32) float32

Median returns the median value of the slice elements.

func Min

func Min(x []float32) float32

Min returns the minimum value of a slice.

func Minimum

func Minimum(x, y []float32) []float32

Minimum returns the element-wise minimum values between two slices.

func MinimumNumber

func MinimumNumber(x []float32, a float32) []float32

MinimumNumber returns the minimum of a number and each slice element.

func MinimumNumber_Inplace

func MinimumNumber_Inplace(x []float32, a float32)

MinimumNumber_Inplace compares a number to each slice element and replaces the values in the slice with the minimum value.

func MinimumNumber_Into

func MinimumNumber_Into(dst, x []float32, a float32) []float32

MinimumNumber_Into compares a number to each slice element and stores the minimum values in the destination slice.

func Minimum_Inplace

func Minimum_Inplace(x, y []float32)

Minimum_Inplace compares two slices element-wise and replaces the values in the first slice with the minimum value.

func Minimum_Into

func Minimum_Into(dst, x, y []float32) []float32

Minimum_Into compares two slices element-wise and stores the minimum values in the destination slice.

func Mul

func Mul(x, y []float32) []float32

Mul returns the result of multiplying two slices element-wise.

func MulNumber

func MulNumber(x []float32, a float32) []float32

MulNumber returns the result of multiplying each slice element by a number.

func MulNumber_Inplace

func MulNumber_Inplace(x []float32, a float32)

MulNumber_Inplace multiplies each slice element by a number, inplace.

func MulNumber_Into

func MulNumber_Into(dst, x []float32, a float32) []float32

MulNumber_Into multiplies each slice element by a number and stores the result in the destination slice.

func Mul_Inplace

func Mul_Inplace(x, y []float32)

Mul_Inplace multiplies the first slice element-wise by the second, inplace.

func Mul_Into

func Mul_Into(dst, x, y []float32) []float32

Mul_Into multiplies two slices element-wise and stores the result in the destination slice.

func Neg

func Neg(x []float32) []float32

Neg returns the additive inverse of each slice element.

func Neg_Inplace

func Neg_Inplace(x []float32)

Neg_Inplace computes the additive inverse of each slice element, inplace.

func Neg_Into

func Neg_Into(dst, x []float32) []float32

Neg_Into computes the additive inverse of each slice element and stores the result in the destination slice.

func Neq

func Neq(x, y []float32) []bool

Neq returns an element-wise "not equal" comparison between two slices.

func NeqNumber

func NeqNumber(x []float32, a float32) []bool

NeqNumber returns an element-wise "not equal" comparison between each slice element and a number.

func NeqNumber_Into

func NeqNumber_Into(dst []bool, x []float32, a float32) []bool

NeqNumber_Into stores an element-wise "not equal" comparison between each slice element and a number in the destination slice.

func Neq_Into

func Neq_Into(dst []bool, x, y []float32) []bool

Neq_Into stores an element-wise "not equal" comparison between two slices in the destination slice.

func None

func None(x []bool) bool

None returns whether none of the boolean values in the slice are true.

func Norm

func Norm(x []float32) float32

Norm returns the Euclidean norm of a vector, i.e. its length.

func Not

func Not(x []bool) []bool

Not returns the logical negation of each slice element.

func Not_Inplace

func Not_Inplace(x []bool)

Not_Inplace computes the logical negation of each slice element, inplace.

func Not_Into

func Not_Into(dst, x []bool) []bool

Not_Into stores the logical negation of each slice element in the destination slice.

func Ones

func Ones(n int) []float32

Ones returns a new slice of length n filled with ones.

func Ones_Into

func Ones_Into(dst []float32, n int) []float32

Ones_Into sets the first n elements in the destination slice to one.

func Or

func Or(x, y []bool) []bool

Or returns the element-wise logical "or" operation between two slices.

func Or_Inplace

func Or_Inplace(x, y []bool)

Or_Inplace computes the element-wise logical "or" operation between two slices, inplace.

func Or_Into

func Or_Into(dst, x, y []bool) []bool

Or_Into stores the element-wise logical "or" operation between two slices in the destination slice.

func Prod

func Prod(x []float32) float32

Prod returns the product of all elements in a slice.

func Quantile

func Quantile(x []float32, q float32) float32

Quantile returns the q-th quantile of the slice elements. The value of q should be between 0 and 1 (inclusive).

func Range

func Range(a, b float32) []float32

Range returns a new slice with values incrementing from a to b (excl.) in steps of 1.

func Range_Into

func Range_Into(dst []float32, a, b float32) []float32

Range_Into writes values incrementing from a to b (excl.) in steps of 1 to the destination slice.

func Repeat

func Repeat(a float32, n int) []float32

Repeat returns a new slice of length n filled with the given value.

func Repeat_Into

func Repeat_Into(dst []float32, a float32, n int) []float32

Repeat_Into sets the first n elements in the destination slice to the given value.

func Round

func Round(x []float32) []float32

Round returns the result of rounding each slice element to the nearest integer value.

func Round_Inplace

func Round_Inplace(x []float32)

Round_Inplace rounds each slice element to the nearest integer value, inplace.

func Round_Into

func Round_Into(dst, x []float32) []float32

Round_Into rounds each slice element to the nearest integer value and stores the result in the destination slice.

func Scatter

func Scatter(x []float32, idx []int, size int) []float32

Scatter returns a slice of size elements where position idx[i] is set to x[i], for all i < len(x) = len(idx). The other elements are set to zero.

func Scatter_Into

func Scatter_Into(dst, x []float32, idx []int) []float32

Scatter_Into sets positions idx[i] to x[i] in the destination slice, for all i < len(x) = len(idx). The other elements are not modified.

func Select

func Select(x []float32, y []bool) []float32

Select returns the slice elements for which the corresponding boolean values are true.

func Select_Into

func Select_Into(dst, x []float32, y []bool) []float32

Select_Into stores the slice elements for which the corresponding boolean values are true in the destination slice. This function grows the destination slice if the selection yields more values than it has capacity for.

func SetAcceleration

func SetAcceleration(enabled bool)

SetAcceleration toggles simd acceleration. Not thread safe.

func Sin

func Sin(x []float32) []float32

Sin returns the sine of each element.

func SinCos_Into

func SinCos_Into(dstSin, dstCos, x []float32)

SinCos_Into stores the sine and cosine of each element in the destination slices. Faster than calling Sin_Into and Cos_Into individually if both are needed.

func Sin_Inplace

func Sin_Inplace(x []float32)

Sin_Inplace computes the sine of each element, inplace.

func Sin_Into

func Sin_Into(dst, x []float32) []float32

Sin_Into stores the sine of each element in the destination slice.

func Sqrt

func Sqrt(x []float32) []float32

Sqrt returns the square root of each slice element.

func Sqrt_Inplace

func Sqrt_Inplace(x []float32)

Sqrt_Inplace computes the square root of each slice element, inplace.

func Sqrt_Into

func Sqrt_Into(dst, x []float32) []float32

Sqrt_Into computes the square root of each slice element and stores the result in the destination slice.

func Sub

func Sub(x, y []float32) []float32

Sub returns the result of subtracting two slices element-wise.

func SubNumber

func SubNumber(x []float32, a float32) []float32

SubNumber returns the result of subtracting a number from each slice element.

func SubNumber_Inplace

func SubNumber_Inplace(x []float32, a float32)

SubNumber_Inplace subtracts a number from each slice element, inplace.

func SubNumber_Into

func SubNumber_Into(dst, x []float32, a float32) []float32

SubNumber_Into subtracts a number from each slice element and stores the result in the destination slice.

func Sub_Inplace

func Sub_Inplace(x, y []float32)

Sub_Inplace subtracts a slice element-wise from the first slice, inplace.

func Sub_Into

func Sub_Into(dst, x, y []float32) []float32

Sub_Into subtracts two slices element-wise and stores the result in the destination slice.

func Sum

func Sum(x []float32) float32

Sum returns the sum of all elements in a slice.

func ToBool

func ToBool(x []float64) []bool

ToBool converts a slice of floats to a slice of bools by setting all zero values to true and all non-zero values to false.

func ToBool_Into

func ToBool_Into(dst []bool, x []float64) []bool

ToBool_Into converts a slice of floats to a slice of bools by setting all zero values to true and all non-zero values to false. The result is stored in the destination slice.

func ToFloat64

func ToFloat64(x []float32) []float64

ToFloat64 converts a slice of floats to a slice of 32-bit floats. Standard conversion rules apply.

func ToFloat64_Into

func ToFloat64_Into(dst []float64, x []float32) []float64

ToFloat64_Into converts a slice of floats to a slice of 64-bit floats. Standard conversion rules apply. The result is stored in the destination slice.

func ToInt32

func ToInt32(x []float32) []int32

ToInt32 converts a slice of floats to a slice of 32-bit ints. Standard conversion rules apply.

func ToInt32_Into

func ToInt32_Into(dst []int32, x []float32) []int32

ToInt32_Into converts a slice of floats to a slice of 32-bit ints. Standard conversion rules apply. The result is stored in the destination slice.

func ToInt64

func ToInt64(x []float32) []int64

ToInt64 converts a slice of floats to a slice of 64-bit ints. Standard conversion rules apply.

func ToInt64_Into

func ToInt64_Into(dst []int64, x []float32) []int64

ToInt64_Into converts a slice of floats to a slice of 64-bit ints. Standard conversion rules apply. The result is stored in the destination slice.

func Xor

func Xor(x, y []bool) []bool

Xor returns the element-wise "exclusive or" operation between two slices.

func Xor_Inplace

func Xor_Inplace(x, y []bool)

Xor_Inplace computes the element-wise "exclusive or" operation between two slices, inplace.

func Xor_Into

func Xor_Into(dst, x, y []bool) []bool

Xor_Into stores the element-wise "exclusive or" operation between two slices in the destination slice.

func Zeros

func Zeros(n int) []float32

Zeros returns a new slice of length n filled with zeros.

func Zeros_Into

func Zeros_Into(dst []float32, n int) []float32

Zeros_Into sets the first n elements in the destination slice to zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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