vector

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRRFK = 60.0

Variables

This section is empty.

Functions

func CosineSimilarity

func CosineSimilarity(query []float32, queryNorm float64, candidate []float32) (float64, error)

func DecodeFloat32

func DecodeFloat32(blob []byte) ([]float32, error)

func EncodeFloat32

func EncodeFloat32(values []float32) ([]byte, error)

func Norm

func Norm(values []float32) float64

func ValidateDimensions

func ValidateDimensions(values []float32, dimensions int) error

Types

type RRFEntry

type RRFEntry[T any] struct {
	Item  T
	Score float64
}

func ReciprocalRankFusion

func ReciprocalRankFusion[T any](rankings [][]T, ids []func(T) string, weights []float64, k float64) []RRFEntry[T]

type Scored

type Scored[T any] struct {
	Item  T
	Score float64
}

func TopK

func TopK[T any](items []Scored[T], limit int, tieLess func(left, right T) bool) []Scored[T]

Jump to

Keyboard shortcuts

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