Module

Annoy.Unsafe

Package
purescript-annoy
Repository
Kamirus/purescript-annoy

#unsafeNew Source

unsafeNew :: forall r h. Int -> String -> Eff (st :: ST h | r) (STPrimAnnoy h)

unsafeNew f metric Creates new STPrimAnnoy that stores vector of f dimensions with metric. Does not validate input.

#unsafeAddItem Source

unsafeAddItem :: forall r h. STPrimAnnoy h -> Int -> Array Number -> Eff (st :: ST h | r) Unit

Inserts vector at given index. No checks for: not frozen STPrimAnnoy, matching dimension, negative index.

#unsafeBuild Source

unsafeBuild :: forall r h. STPrimAnnoy h -> Int -> Eff (st :: ST h | r) Unit

Builds a forest of given number of trees. After calling, no more items can be added.

#save Source

save :: forall r h. STPrimAnnoy h -> String -> Eff (fs :: FS, st :: ST h | r) Boolean

Saves the index to disk.

#unsafeLoad Source

unsafeLoad :: forall r h. STPrimAnnoy h -> String -> Eff (fs :: FS, st :: ST h | r) Boolean

Loads an index from disk.

#unload Source

unload :: forall r h. STPrimAnnoy h -> Eff (fs :: FS, st :: ST h | r) Unit

#unsafeGetItem Source

unsafeGetItem :: forall r h. STPrimAnnoy h -> Int -> Eff (st :: ST h | r) (Array Number)

Returns vector under given index. No bounds checks are performed.

#unsafeGetNNsByItem Source

unsafeGetNNsByItem :: forall r h. STPrimAnnoy h -> Int -> Int -> Int -> Eff (st :: ST h | r) (Array Int)

unsafeGetNNsByItem a i n search_k Returns n closest items to the i-th vector. No bounds checks are performed.

#unsafeGetNNsByItem_ Source

unsafeGetNNsByItem_ :: forall r h. STPrimAnnoy h -> Int -> Int -> Int -> Eff (st :: ST h | r) { distances :: Array Int, neighbors :: Array Int }

Like unsafeGetNNsByItem but returns also distances

#unsafeGetNNsByVector Source

unsafeGetNNsByVector :: forall r h. STPrimAnnoy h -> Array Number -> Int -> Int -> Eff (st :: ST h | r) (Array Int)

unsafeGetNNsByVector a v n search_k Like above but query by vector v instead of index.

#unsafeGetNNsByVector_ Source

unsafeGetNNsByVector_ :: forall r h. STPrimAnnoy h -> Array Number -> Int -> Int -> Eff (st :: ST h | r) { distances :: Array Int, neighbors :: Array Int }

Like unsafeGetNNsByVector but returns also distances

#getNItems Source

getNItems :: forall r h. STPrimAnnoy h -> Eff (st :: ST h | r) Int

Returns number of (allocated!) elements in Annoy.

#unsafeGetDistance Source

unsafeGetDistance :: forall r h. STPrimAnnoy h -> Int -> Int -> Eff (st :: ST h | r) Number

Returns the distance between items at positions i and j. No bounds checks are performed.