# Dot Products

> NumKong for Go

Dot products cover `float64`, `float32`, `int8`, and `uint8`.

```go
package main

import (
	"fmt"

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

func main() {
	a64 := []float64{1, 2, 3}
	b64 := []float64{4, 5, 6}
	fmt.Println(nk.DotF64(a64, b64))

	a32 := []float32{1, 2, 3}
	b32 := []float32{4, 5, 6}
	fmt.Println(nk.DotF32(a32, b32)) // widened to float64

	a8 := []int8{1, 2, 3, 4}
	b8 := []int8{4, 3, 2, 1}
	fmt.Println(nk.DotI8(a8, b8)) // widened to int32

	au := []uint8{1, 2, 3, 4}
	bu := []uint8{4, 3, 2, 1}
	fmt.Println(nk.DotU8(au, bu)) // widened to uint32
}
```

`DotF32` returns `float64`.
`DotI8` returns `int32`.
`DotU8` returns `uint32`.
Those widened outputs are deliberate.

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

## DotF32

DotF32 computes the dot product of two float32 vectors.

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

Both slices must have the same length.

## DotF64

DotF64 computes the dot product of two float64 vectors.

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

Both slices must have the same length.

## DotI8

DotI8 computes the dot product of two int8 vectors.

```go
func DotI8(a, b []int8) int32
```

Both slices must have the same length.

## DotU8

DotU8 computes the dot product of two uint8 vectors.

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

Both slices must have the same length.

