math

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T Numeric](a T) T

Abs returns the absolute value of a number of any numeric type.

Parameters:

  • a: the value

Returns:

  • the absolute value of the number

func DotProduct

func DotProduct(left, right []float32, result *float32)

DotProduct calculates the dot product of two vectors using NEON or AVX SIMD instructions if supported, otherwise it falls back to the standard implementation.

Parameters:

  • left: the first vector
  • right: the second vector
  • result: pointer to the result

func Max

func Max[T Numeric](a, b T) T

Max returns the maximum of two values of any numeric type.

Parameters:

  • a: the first value
  • b: the second value

Returns:

  • the maximum of the two values

func Min

func Min[T Numeric](a, b T) T

Min returns the minimum of two values of any numeric type.

Parameters:

  • a: the first value
  • b: the second value

Returns:

  • the minimum of the two values

Types

type Numeric

type Numeric interface {
	float32 | float64 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

Directories

Path Synopsis
avx

Jump to

Keyboard shortcuts

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