Documentation
¶
Index ¶
- func AvgAbsDiff512(a, b *Vec512) float32
- func ClearF32(buf []float32)
- func Cosine512(a, b *Vec512, scaleA, scaleB float32) float32
- func Dot512(a, b *Vec512) int32
- func Dot512Batch(query *Vec512, vectors []Vec512, scores []int32) []int32
- func DotN(a, b []int8) int32
- func EmbedAccum(embedding []int8, scale float32, result []float32)
- func EmbedAccumBatch(embeddings [][]int8, scales []float32, result []float32)
- func EmbedTokensIntoSIMD(embeddings [][]int8, scales []float32, tokens []int16, result []float32) int
- func L2Squared512(a, b *Vec512) int32
- func ScaleF32(buf []float32, scale float32)
- func SumAbsDiff512(a, b *Vec512) int32
- type Vec512
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvgAbsDiff512 ¶
AvgAbsDiff512 returns the average absolute difference across 512 dims as float32
func Cosine512 ¶
Cosine computes cosine similarity between normalized int8 vectors Assumes vectors are pre-normalized and quantized
func Dot512Batch ¶
Dot512Batch computes dot products between a query vector and a slice of vectors. The scores slice is reused when capacity allows to avoid allocations.
func EmbedAccum ¶
EmbedAccum accumulates embedding * scale into result using AVX2
func EmbedAccumBatch ¶
EmbedAccumBatch accumulates multiple embeddings into result using AVX2
func EmbedTokensIntoSIMD ¶
func EmbedTokensIntoSIMD(embeddings [][]int8, scales []float32, tokens []int16, result []float32) int
EmbedTokensIntoSIMD is the optimized embedding function using SIMD Returns number of valid tokens processed (zero allocation hot path)
func L2Squared512 ¶
L2Squared512 computes squared L2 distance between int8 vectors (optimized)
func SumAbsDiff512 ¶
SumAbsDiff512 computes sum of absolute differences (L1) between two int8 vectors (512-d) Returns the total L1 distance as int32. Uses AVX2 when available.