math

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package math provides SIMD-accelerated mathematical transforms for the dataset engines.

Slice transforms apply a transcendental function element-wise to an entire slice using SIMD vectorization (AVX-512, AVX2, NEON, or scalar fallback).

Vector-level functions operate on individual SIMD register vectors for use in custom compute kernels.

All functions are generic over hwy.Floats (float32, float64, Float16, BFloat16) and provide ~4 ULP accuracy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cos

func Cos[T hwy.Floats](dst, src []T)

Cos applies cos(x) element-wise: dst[i] = cos(src[i]).

func Erf

func Erf[T hwy.Floats](dst, src []T)

Erf applies the error function element-wise: dst[i] = erf(src[i]).

func Exp

func Exp[T hwy.Floats](dst, src []T)

Exp applies e^x element-wise: dst[i] = exp(src[i]).

func Log

func Log[T hwy.Floats](dst, src []T)

Log applies ln(x) element-wise: dst[i] = log(src[i]).

func Sigmoid

func Sigmoid[T hwy.Floats](dst, src []T)

Sigmoid applies the logistic function element-wise: dst[i] = 1/(1+e^(-src[i])).

func Sin

func Sin[T hwy.Floats](dst, src []T)

Sin applies sin(x) element-wise: dst[i] = sin(src[i]).

func Tanh

func Tanh[T hwy.Floats](dst, src []T)

Tanh applies tanh(x) element-wise: dst[i] = tanh(src[i]).

Types

type Vec

type Vec[T hwy.Lanes] = hwy.Vec[T]

Vec is the SIMD vector type re-exported for convenience.

func AcoshVec

func AcoshVec[T hwy.Floats](v Vec[T]) Vec[T]

AcoshVec computes arccosh(v) element-wise on a SIMD vector.

func AsinhVec

func AsinhVec[T hwy.Floats](v Vec[T]) Vec[T]

AsinhVec computes arcsinh(v) element-wise on a SIMD vector.

func AtanhVec

func AtanhVec[T hwy.Floats](v Vec[T]) Vec[T]

AtanhVec computes arctanh(v) element-wise on a SIMD vector.

func CosVec

func CosVec[T hwy.Floats](v Vec[T]) Vec[T]

CosVec computes cos(v) element-wise on a SIMD vector.

func CoshVec

func CoshVec[T hwy.Floats](v Vec[T]) Vec[T]

CoshVec computes cosh(v) element-wise on a SIMD vector.

func ErfVec

func ErfVec[T hwy.Floats](v Vec[T]) Vec[T]

ErfVec computes erf(v) element-wise on a SIMD vector.

func Exp2Vec

func Exp2Vec[T hwy.Floats](v Vec[T]) Vec[T]

Exp2Vec computes 2^v element-wise on a SIMD vector.

func ExpVec

func ExpVec[T hwy.Floats](v Vec[T]) Vec[T]

ExpVec computes e^v element-wise on a SIMD vector.

func Log2Vec

func Log2Vec[T hwy.Floats](v Vec[T]) Vec[T]

Log2Vec computes log₂(v) element-wise on a SIMD vector.

func Log10Vec

func Log10Vec[T hwy.Floats](v Vec[T]) Vec[T]

Log10Vec computes log₁₀(v) element-wise on a SIMD vector.

func LogVec

func LogVec[T hwy.Floats](v Vec[T]) Vec[T]

LogVec computes ln(v) element-wise on a SIMD vector.

func PowVec

func PowVec[T hwy.Floats](base, exp Vec[T]) Vec[T]

PowVec computes base^exp element-wise on SIMD vectors.

func SigmoidVec

func SigmoidVec[T hwy.Floats](v Vec[T]) Vec[T]

SigmoidVec computes 1/(1+e^(-v)) element-wise on a SIMD vector.

func SinVec

func SinVec[T hwy.Floats](v Vec[T]) Vec[T]

SinVec computes sin(v) element-wise on a SIMD vector.

func SinhVec

func SinhVec[T hwy.Floats](v Vec[T]) Vec[T]

SinhVec computes sinh(v) element-wise on a SIMD vector.

func TanhVec

func TanhVec[T hwy.Floats](v Vec[T]) Vec[T]

TanhVec computes tanh(v) element-wise on a SIMD vector.

Jump to

Keyboard shortcuts

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