Module

Annoy.ST

Package
purescript-annoy
Repository
Kamirus/purescript-annoy

#build Source

build :: forall o t s. Nat s => Pos t => { trees :: t | o } -> (forall h. Eff (st :: ST h) (STAnnoy h s)) -> Annoy s

build { trees } m executes m which creates Annoy and adds vectors, then builds it using trees (more info in original annoy)

a = build { trees: d1 } (do
  a <- new { size: d2 , metric: Manhattan }
  push (1.0 +> 2.0 +> empty) a
  push (3.0 +> 4.0 +> empty) a
  push (5.0 +> 6.0 +> empty) a
  pure a)

#build_ Source

build_ :: forall o s. Nat s => { trees :: Int | o } -> (forall h. Eff (st :: ST h) (STAnnoy h s)) -> Maybe (Annoy s)

Similar to build but trees argument is an Int, so return type is Maybe

#new Source

new :: forall o s r h. Nat s => { metric :: Metric, size :: s | o } -> Eff (st :: ST h | r) (STAnnoy h s)

new { size , metric } creates mutable annoy that stores vectors of size and uses given metric

#push Source

push :: forall s r h. Nat s => STAnnoy h s -> Vec s Number -> Eff (st :: ST h | r) Unit

push annoy v adds vector v at index 'len' which is equal to the number of currently stored vectors

#unsafeFreeze Source

unsafeFreeze :: forall s r h. STAnnoy h s -> Eff (st :: ST h | r) (Annoy s)