hnsw

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

README

go-hnsw

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hnsw

type Hnsw struct {
	sync.RWMutex
	M  int
	M0 int

	DelaunayType int

	DistFunc func([]float32, []float32) float32

	LevelMult float64
	// contains filtered or unexported fields
}

func Load

func Load(filename string) (*Hnsw, int64, error)

Load opens a index file previously written by Save(). Returnes a new index and the timestamp the file was written

func New

func New(M int, efConstruction int, first Point) *Hnsw

func (*Hnsw) Add

func (h *Hnsw) Add(q Point, id uint32)

func (*Hnsw) Benchmark

func (h *Hnsw) Benchmark(q Point, ef int, K int) float64

Benchmark test precision by comparing the results of SearchBrute and Search

func (*Hnsw) Grow

func (h *Hnsw) Grow(size int)
func (h *Hnsw) Link(first, second uint32, level int)

func (*Hnsw) Save

func (h *Hnsw) Save(filename string) error

Save writes to current index to a gzipped binary data file

func (*Hnsw) Search

func (h *Hnsw) Search(q Point, ef int, K int) *distqueue.DistQueueClosestLast

func (*Hnsw) SearchBrute

func (h *Hnsw) SearchBrute(q Point, K int) *distqueue.DistQueueClosestLast

SearchBrute returns the true K nearest neigbours to search point q

func (*Hnsw) Stats

func (h *Hnsw) Stats() string

type Point

type Point []float32

func (Point) Size

func (a Point) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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