# Dense Distances

> NumKong for Go

The dense distance family includes squared Euclidean, Euclidean, and angular distance.
Each metric supports `float64`, `float32`, `int8`, and `uint8`.

```go
package main

import (
	"fmt"

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

func main() {
	a := []float64{1, 2, 3, 4}
	b := []float64{4, 3, 2, 1}

	fmt.Println(nk.SqEuclideanF64(a, b))
	fmt.Println(nk.EuclideanF64(a, b))
	fmt.Println(nk.AngularF64(a, b))
}
```

The `int8` and `uint8` families widen their outputs.
`AngularF32` and `EuclideanF32` return `float64`.
`AngularI8`, `AngularU8`, `EuclideanI8`, `EuclideanU8` return `float32`.
`SqEuclideanI8` and `SqEuclideanU8` return `uint32`.

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

## AngularF32

AngularF32 computes the angular distance between two float32 vectors.

```go
func AngularF32(a, b []float32) float64
```

Both slices must have the same length.

## AngularF64

AngularF64 computes the angular distance between two float64 vectors.

```go
func AngularF64(a, b []float64) float64
```

Both slices must have the same length.

## AngularI8

AngularI8 computes the angular distance between two int8 vectors.

```go
func AngularI8(a, b []int8) float32
```

Both slices must have the same length.

## AngularU8

AngularU8 computes the angular distance between two uint8 vectors.

```go
func AngularU8(a, b []uint8) float32
```

Both slices must have the same length.

## EuclideanF32

EuclideanF32 computes the Euclidean distance between two float32 vectors.

```go
func EuclideanF32(a, b []float32) float64
```

Both slices must have the same length.

## EuclideanF64

EuclideanF64 computes the Euclidean distance between two float64 vectors.

```go
func EuclideanF64(a, b []float64) float64
```

Both slices must have the same length.

## EuclideanI8

EuclideanI8 computes the Euclidean distance between two int8 vectors.

```go
func EuclideanI8(a, b []int8) float32
```

Both slices must have the same length.

## EuclideanU8

EuclideanU8 computes the Euclidean distance between two uint8 vectors.

```go
func EuclideanU8(a, b []uint8) float32
```

Both slices must have the same length.

## SqEuclideanF32

SqEuclideanF32 computes the squared Euclidean distance between two float32 vectors.

```go
func SqEuclideanF32(a, b []float32) float64
```

Both slices must have the same length.

## SqEuclideanF64

SqEuclideanF64 computes the squared Euclidean distance between two float64 vectors.

```go
func SqEuclideanF64(a, b []float64) float64
```

Both slices must have the same length.

## SqEuclideanI8

SqEuclideanI8 computes the squared Euclidean distance between two int8 vectors.

```go
func SqEuclideanI8(a, b []int8) uint32
```

Both slices must have the same length.

## SqEuclideanU8

SqEuclideanU8 computes the squared Euclidean distance between two uint8 vectors.

```go
func SqEuclideanU8(a, b []uint8) uint32
```

Both slices must have the same length.

