# Matrix Kernels

> NumKong for Go

Packed kernels are the main batch-throughput path.
The `DotsPackedMatrix` struct wraps the packed buffer with its dimensions and dtype, providing type safety.

```go
package main

import (
	"fmt"

	nk "github.com/ashvardanian/NumKong/golang"
)

func main() {
	rows, columns, depth := 4, 8, 16
	a := make([]float32, rows*depth) // 4 query vectors of dimension 16
	b := make([]float32, columns*depth)  // 8 database vectors of dimension 16

	// Fill with sample data
	for i := range a { a[i] = float32(i % 7) }
	for i := range b { b[i] = float32(i % 5) }

	// Pack the right-hand side (once, reuse across batches)
	bPacked := nk.NewDotsPackedMatrixF32(b, columns, depth)

	// Compute A × Bᵀ
	c := make([]float64, rows*columns)
	nk.DotsPackedF32(a, bPacked, c, rows)

	// Angular and Euclidean distances use the same DotsPackedMatrix
	angDist := make([]float64, rows*columns)
	nk.AngularsPackedF32(a, bPacked, angDist, rows)

	eucDist := make([]float64, rows*columns)
	nk.EuclideansPackedF32(a, bPacked, eucDist, rows)

	fmt.Println(c[:columns]) // first row of the result matrix
}
```

`DotsPackedF64` takes `[]float64` and produces `[]float64`.
`DotsPackedF32` takes `[]float32` and produces `[]float64` (widened).
`DotsPackedI8` takes `[]int8` and produces `[]int32` (widened).
`DotsPackedU8` takes `[]uint8` and produces `[]uint32` (widened).
The same widening pattern applies to `AngularsPacked*` and `EuclideansPacked*` variants.

### Symmetric Kernels for SYRK-Like Workloads

Symmetric kernels compute self-similarity or self-distance matrices.
They skip duplicate `(i, j)` and `(j, i)` pairs, filling only the upper triangle and mirroring the result.

```go
package main

import (
	"fmt"

	nk "github.com/ashvardanian/NumKong/golang"
)

func main() {
	n, depth := 4, 8
	vectors := make([]float32, n*depth)
	for i := range vectors { vectors[i] = float32(i % 5) }

	// Gram matrix: all-pairs dot products
	gram := make([]float64, n*n)
	nk.DotsSymmetricF32(vectors, n, depth, gram)

	// Angular distance matrix
	angDist := make([]float64, n*n)
	nk.AngularsSymmetricF32(vectors, n, depth, angDist)

	// Euclidean distance matrix
	eucDist := make([]float64, n*n)
	nk.EuclideansSymmetricF32(vectors, n, depth, eucDist)

	fmt.Println("gram[0]:", gram[0])
	fmt.Println("angular[0,1]:", angDist[1])
	fmt.Println("euclidean[0,1]:", eucDist[1])
}
```

Available symmetric variants: `DotsSymmetric{F64,F32,I8,U8}`, `AngularsSymmetric{F64,F32,I8,U8}`, `EuclideansSymmetric{F64,F32,I8,U8}`.

### Binary Packed and Symmetric Kernels

Binary vectors use `[]byte` storage where `depth` is the number of bits.
`DimensionsToValues("u1", depth)` gives the bytes per vector, and `depth` must be a multiple of `DimensionsPerValue("u1")`.
Packing uses `NewDotsPackedMatrixU1`.

```go
package main

import (
	"fmt"

	nk "github.com/ashvardanian/NumKong/golang"
)

func main() {
	n, depth := 4, 64 // 4 vectors of 64 dimensions each
	bytesPerVec := nk.DimensionsToValues("u1", depth)
	vectors := make([]byte, n*bytesPerVec)
	for i := range vectors { vectors[i] = byte(i * 37) }

	// Pack for batch queries
	columns := 2
	queryVectors := vectors[:columns*bytesPerVec]
	queryPacked := nk.NewDotsPackedMatrixU1(queryVectors, columns, depth)

	// Hamming distances: n database vectors × columns query vectors
	hammingResult := make([]uint32, n*columns)
	nk.HammingsPackedU1(vectors, queryPacked, hammingResult, n)

	// Jaccard distances
	jaccardResult := make([]float32, n*columns)
	nk.JaccardsPackedU1(vectors, queryPacked, jaccardResult, n)

	// Symmetric Hamming distance matrix
	hammingSym := make([]uint32, n*n)
	nk.HammingsSymmetricU1(vectors, n, depth, hammingSym)

	// Symmetric Jaccard distance matrix
	jaccardSym := make([]float32, n*n)
	nk.JaccardsSymmetricU1(vectors, n, depth, jaccardSym)

	fmt.Println("hamming packed:", hammingResult[:columns])
	fmt.Println("jaccard symmetric[0,1]:", jaccardSym[1])
}
```

`import "github.com/ashvardanian/NumKong"`

## DotsPackedMatrix

DotsPackedMatrix holds a matrix packed once for the Dots, Angulars, Euclideans, Hammings and Jaccards Packed kernels.

```go
type DotsPackedMatrix struct {
    // contains filtered or unexported fields
}
```

Construct it with the constructor of the element type, such as [NewDotsPackedMatrixF32](#NewDotsPackedMatrixF32).

## NewDotsPackedMatrixF32

NewDotsPackedMatrixF32 packs columns float32 vectors of depth dimensions for the Packed kernels.

```go
func NewDotsPackedMatrixF32(
    b []float32,
    columns, depth int,
) DotsPackedMatrix
```

The slice b holds at least columns * depth values.

## NewDotsPackedMatrixF64

NewDotsPackedMatrixF64 packs columns float64 vectors of depth dimensions for the Packed kernels.

```go
func NewDotsPackedMatrixF64(
    b []float64,
    columns, depth int,
) DotsPackedMatrix
```

The slice b holds at least columns * depth values.

## NewDotsPackedMatrixI8

NewDotsPackedMatrixI8 packs columns int8 vectors of depth dimensions for the Packed kernels.

```go
func NewDotsPackedMatrixI8(
    b []int8,
    columns, depth int,
) DotsPackedMatrix
```

The slice b holds at least columns * depth values.

## NewDotsPackedMatrixU1

NewDotsPackedMatrixU1 packs columns binary vectors of depth dimensions for the Packed kernels.

```go
func NewDotsPackedMatrixU1(
    b []byte,
    columns, depth int,
) DotsPackedMatrix
```

The depth is a multiple of 8, and b holds at least columns * [DimensionsToValues]("u1", depth) bytes.

## NewDotsPackedMatrixU8

NewDotsPackedMatrixU8 packs columns uint8 vectors of depth dimensions for the Packed kernels.

```go
func NewDotsPackedMatrixU8(
    b []uint8,
    columns, depth int,
) DotsPackedMatrix
```

The slice b holds at least columns * depth values.

## AngularsF32WithPool

AngularsF32WithPool is [AngularsPackedF32](#AngularsPackedF32) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) AngularsF32WithPool(
    a []float32,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## AngularsF64WithPool

AngularsF64WithPool is [AngularsPackedF64](#AngularsPackedF64) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) AngularsF64WithPool(
    a []float64,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## AngularsI8WithPool

AngularsI8WithPool is [AngularsPackedI8](#AngularsPackedI8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) AngularsI8WithPool(
    a []int8,
    c []float32,
    rows int,
    pool *WorkerPool,
)
```

## AngularsU8WithPool

AngularsU8WithPool is [AngularsPackedU8](#AngularsPackedU8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) AngularsU8WithPool(
    a []uint8,
    c []float32,
    rows int,
    pool *WorkerPool,
)
```

## Bytes

Bytes returns the packed buffer.

```go
func (p DotsPackedMatrix) Bytes() []byte
```

## Columns

Columns returns the number of packed vectors.

```go
func (p DotsPackedMatrix) Columns() int
```

## DType

DType returns the element type the matrix was packed from: "f64", "f32", "i8", "u8" or "u1".

```go
func (p DotsPackedMatrix) DType() string
```

## Depth

Depth returns the number of dimensions per packed vector.

```go
func (p DotsPackedMatrix) Depth() int
```

## DotsF32WithPool

DotsF32WithPool is [DotsPackedF32](#DotsPackedF32) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) DotsF32WithPool(
    a []float32,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## DotsF64WithPool

DotsF64WithPool is [DotsPackedF64](#DotsPackedF64) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) DotsF64WithPool(
    a []float64,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## DotsI8WithPool

DotsI8WithPool is [DotsPackedI8](#DotsPackedI8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) DotsI8WithPool(
    a []int8,
    c []int32,
    rows int,
    pool *WorkerPool,
)
```

## DotsU8WithPool

DotsU8WithPool is [DotsPackedU8](#DotsPackedU8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) DotsU8WithPool(
    a []uint8,
    c []uint32,
    rows int,
    pool *WorkerPool,
)
```

## EuclideansF32WithPool

EuclideansF32WithPool is [EuclideansPackedF32](#EuclideansPackedF32) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) EuclideansF32WithPool(
    a []float32,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## EuclideansF64WithPool

EuclideansF64WithPool is [EuclideansPackedF64](#EuclideansPackedF64) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) EuclideansF64WithPool(
    a []float64,
    c []float64,
    rows int,
    pool *WorkerPool,
)
```

## EuclideansI8WithPool

EuclideansI8WithPool is [EuclideansPackedI8](#EuclideansPackedI8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) EuclideansI8WithPool(
    a []int8,
    c []float32,
    rows int,
    pool *WorkerPool,
)
```

## EuclideansU8WithPool

EuclideansU8WithPool is [EuclideansPackedU8](#EuclideansPackedU8) with the rows rows of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) EuclideansU8WithPool(
    a []uint8,
    c []float32,
    rows int,
    pool *WorkerPool,
)
```

## HammingsU1WithPool

HammingsU1WithPool is [HammingsPackedU1](#HammingsPackedU1) with the rows vectors of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) HammingsU1WithPool(
    vectors []byte,
    c []uint32,
    rows int,
    pool *WorkerPool,
)
```

## JaccardsU1WithPool

JaccardsU1WithPool is [JaccardsPackedU1](#JaccardsPackedU1) with the rows vectors of a split across pool, each of [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, while c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

```go
func (pm DotsPackedMatrix) JaccardsU1WithPool(
    vectors []byte,
    c []float32,
    rows int,
    pool *WorkerPool,
)
```

## Shape

Shape reads the columns and depth back from the header of the packed buffer.

```go
func (p DotsPackedMatrix) Shape() (columns, depth int)
```

## AngularsPackedF32

AngularsPackedF32 computes the angular distance from each of rows float32 rows of a to every packed row of b.

```go
func AngularsPackedF32(
    a []float32,
    b DotsPackedMatrix,
    result []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## AngularsPackedF64

AngularsPackedF64 computes the angular distance from each of rows float64 rows of a to every packed row of b.

```go
func AngularsPackedF64(
    a []float64,
    b DotsPackedMatrix,
    result []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## AngularsPackedI8

AngularsPackedI8 computes the angular distance from each of rows int8 rows of a to every packed row of b.

```go
func AngularsPackedI8(
    a []int8,
    b DotsPackedMatrix,
    result []float32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## AngularsPackedU8

AngularsPackedU8 computes the angular distance from each of rows uint8 rows of a to every packed row of b.

```go
func AngularsPackedU8(
    a []uint8,
    b DotsPackedMatrix,
    result []float32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## AngularsSymmetricF32

AngularsSymmetricF32 computes the angular distance between every pair of nVectors row-major float32 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricF32(
    vectors []float32,
    nVectors, depth int,
    result []float64,
)
```

## AngularsSymmetricF32WithPool

AngularsSymmetricF32WithPool is [AngularsSymmetricF32](#AngularsSymmetricF32) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricF32WithPool(
    vectors []float32,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## AngularsSymmetricF64

AngularsSymmetricF64 computes the angular distance between every pair of nVectors row-major float64 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricF64(
    vectors []float64,
    nVectors, depth int,
    result []float64,
)
```

## AngularsSymmetricF64WithPool

AngularsSymmetricF64WithPool is [AngularsSymmetricF64](#AngularsSymmetricF64) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricF64WithPool(
    vectors []float64,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## AngularsSymmetricI8

AngularsSymmetricI8 computes the angular distance between every pair of nVectors row-major int8 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricI8(
    vectors []int8,
    nVectors, depth int,
    result []float32,
)
```

## AngularsSymmetricI8WithPool

AngularsSymmetricI8WithPool is [AngularsSymmetricI8](#AngularsSymmetricI8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricI8WithPool(
    vectors []int8,
    nVectors, depth int,
    result []float32,
    pool *WorkerPool,
)
```

## AngularsSymmetricU8

AngularsSymmetricU8 computes the angular distance between every pair of nVectors row-major uint8 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricU8(
    vectors []uint8,
    nVectors, depth int,
    result []float32,
)
```

## AngularsSymmetricU8WithPool

AngularsSymmetricU8WithPool is [AngularsSymmetricU8](#AngularsSymmetricU8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func AngularsSymmetricU8WithPool(
    vectors []uint8,
    nVectors, depth int,
    result []float32,
    pool *WorkerPool,
)
```

## DotsPackedF32

DotsPackedF32 computes the dot product of each of rows float32 rows of a with every packed row of b.

```go
func DotsPackedF32(
    a []float32,
    b DotsPackedMatrix,
    c []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## DotsPackedF64

DotsPackedF64 computes the dot product of each of rows float64 rows of a with every packed row of b.

```go
func DotsPackedF64(
    a []float64,
    b DotsPackedMatrix,
    c []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## DotsPackedI8

DotsPackedI8 computes the dot product of each of rows int8 rows of a with every packed row of b.

```go
func DotsPackedI8(
    a []int8,
    b DotsPackedMatrix,
    c []int32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## DotsPackedU8

DotsPackedU8 computes the dot product of each of rows uint8 rows of a with every packed row of b.

```go
func DotsPackedU8(
    a []uint8,
    b DotsPackedMatrix,
    c []uint32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and c holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## DotsSymmetricF32

DotsSymmetricF32 computes the dot product between every pair of nVectors float32 vectors of depth dimensions.

```go
func DotsSymmetricF32(
    vectors []float32,
    nVectors, depth int,
    result []float64,
)
```

The vectors are stored row-major, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## DotsSymmetricF32WithPool

DotsSymmetricF32WithPool is [DotsSymmetricF32](#DotsSymmetricF32) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func DotsSymmetricF32WithPool(
    vectors []float32,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## DotsSymmetricF64

DotsSymmetricF64 computes the dot product between every pair of nVectors float64 vectors of depth dimensions.

```go
func DotsSymmetricF64(
    vectors []float64,
    nVectors, depth int,
    result []float64,
)
```

The vectors are stored row-major, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## DotsSymmetricF64WithPool

DotsSymmetricF64WithPool is [DotsSymmetricF64](#DotsSymmetricF64) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func DotsSymmetricF64WithPool(
    vectors []float64,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## DotsSymmetricI8

DotsSymmetricI8 computes the dot product between every pair of nVectors int8 vectors of depth dimensions.

```go
func DotsSymmetricI8(
    vectors []int8,
    nVectors, depth int,
    result []int32,
)
```

The vectors are stored row-major, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## DotsSymmetricI8WithPool

DotsSymmetricI8WithPool is [DotsSymmetricI8](#DotsSymmetricI8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func DotsSymmetricI8WithPool(
    vectors []int8,
    nVectors, depth int,
    result []int32,
    pool *WorkerPool,
)
```

## DotsSymmetricU8

DotsSymmetricU8 computes the dot product between every pair of nVectors uint8 vectors of depth dimensions.

```go
func DotsSymmetricU8(
    vectors []uint8,
    nVectors, depth int,
    result []uint32,
)
```

The vectors are stored row-major, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## DotsSymmetricU8WithPool

DotsSymmetricU8WithPool is [DotsSymmetricU8](#DotsSymmetricU8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func DotsSymmetricU8WithPool(
    vectors []uint8,
    nVectors, depth int,
    result []uint32,
    pool *WorkerPool,
)
```

## EuclideansPackedF32

EuclideansPackedF32 computes the Euclidean distance from each of rows float32 rows of a to every packed row of b.

```go
func EuclideansPackedF32(
    a []float32,
    b DotsPackedMatrix,
    result []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## EuclideansPackedF64

EuclideansPackedF64 computes the Euclidean distance from each of rows float64 rows of a to every packed row of b.

```go
func EuclideansPackedF64(
    a []float64,
    b DotsPackedMatrix,
    result []float64,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## EuclideansPackedI8

EuclideansPackedI8 computes the Euclidean distance from each of rows int8 rows of a to every packed row of b.

```go
func EuclideansPackedI8(
    a []int8,
    b DotsPackedMatrix,
    result []float32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## EuclideansPackedU8

EuclideansPackedU8 computes the Euclidean distance from each of rows uint8 rows of a to every packed row of b.

```go
func EuclideansPackedU8(
    a []uint8,
    b DotsPackedMatrix,
    result []float32,
    rows int,
)
```

Each row has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## EuclideansSymmetricF32

EuclideansSymmetricF32 computes the Euclidean distance between every pair of nVectors row-major float32 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricF32(
    vectors []float32,
    nVectors, depth int,
    result []float64,
)
```

## EuclideansSymmetricF32WithPool

EuclideansSymmetricF32WithPool is [EuclideansSymmetricF32](#EuclideansSymmetricF32) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricF32WithPool(
    vectors []float32,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## EuclideansSymmetricF64

EuclideansSymmetricF64 computes the Euclidean distance between every pair of nVectors row-major float64 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricF64(
    vectors []float64,
    nVectors, depth int,
    result []float64,
)
```

## EuclideansSymmetricF64WithPool

EuclideansSymmetricF64WithPool is [EuclideansSymmetricF64](#EuclideansSymmetricF64) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricF64WithPool(
    vectors []float64,
    nVectors, depth int,
    result []float64,
    pool *WorkerPool,
)
```

## EuclideansSymmetricI8

EuclideansSymmetricI8 computes the Euclidean distance between every pair of nVectors row-major int8 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricI8(
    vectors []int8,
    nVectors, depth int,
    result []float32,
)
```

## EuclideansSymmetricI8WithPool

EuclideansSymmetricI8WithPool is [EuclideansSymmetricI8](#EuclideansSymmetricI8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricI8WithPool(
    vectors []int8,
    nVectors, depth int,
    result []float32,
    pool *WorkerPool,
)
```

## EuclideansSymmetricU8

EuclideansSymmetricU8 computes the Euclidean distance between every pair of nVectors row-major uint8 vectors of depth dimensions, writing only entries with row <= column into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricU8(
    vectors []uint8,
    nVectors, depth int,
    result []float32,
)
```

## EuclideansSymmetricU8WithPool

EuclideansSymmetricU8WithPool is [EuclideansSymmetricU8](#EuclideansSymmetricU8) with the nVectors rows split across pool, the vectors stored row-major; only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

```go
func EuclideansSymmetricU8WithPool(
    vectors []uint8,
    nVectors, depth int,
    result []float32,
    pool *WorkerPool,
)
```

## HammingsPackedU1

HammingsPackedU1 computes the Hamming distance from each of rows binary vectors to every packed query.

```go
func HammingsPackedU1(
    vectors []byte,
    query DotsPackedMatrix,
    result []uint32,
    rows int,
)
```

Each vector has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## HammingsSymmetricU1

HammingsSymmetricU1 computes the Hamming distance between every pair of nVectors binary vectors of depth dimensions.

```go
func HammingsSymmetricU1(
    vectors []byte,
    nVectors, depth int,
    result []uint32,
)
```

The depth is a multiple of 8, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## HammingsSymmetricU1WithPool

HammingsSymmetricU1WithPool is [HammingsSymmetricU1](#HammingsSymmetricU1) with the nVectors rows split across pool.

```go
func HammingsSymmetricU1WithPool(
    vectors []byte,
    nVectors, depth int,
    result []uint32,
    pool *WorkerPool,
)
```

The depth is a multiple of 8, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## JaccardsPackedU1

JaccardsPackedU1 computes the Jaccard distance from each of rows binary vectors to every packed query.

```go
func JaccardsPackedU1(
    vectors []byte,
    query DotsPackedMatrix,
    result []float32,
    rows int,
)
```

Each vector has [DotsPackedMatrix.Depth](https://www.unum.cloud/docs/numkong/go/maxsim.md#Depth) dimensions, and result holds at least rows * [DotsPackedMatrix.Columns](#Columns) entries.

## JaccardsSymmetricU1

JaccardsSymmetricU1 computes the Jaccard distance between every pair of nVectors binary vectors of depth dimensions.

```go
func JaccardsSymmetricU1(
    vectors []byte,
    nVectors, depth int,
    result []float32,
)
```

The depth is a multiple of 8, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

## JaccardsSymmetricU1WithPool

JaccardsSymmetricU1WithPool is [JaccardsSymmetricU1](#JaccardsSymmetricU1) with the nVectors rows split across pool.

```go
func JaccardsSymmetricU1WithPool(
    vectors []byte,
    nVectors, depth int,
    result []float32,
    pool *WorkerPool,
)
```

The depth is a multiple of 8, and only entries with row <= column are written into result, which holds at least nVectors * nVectors entries.

