The vp-trees Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The vp-trees Reference Manual

This is the vp-trees Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Apr 28 13:17:50 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

vp-trees

Build Status

vp-trees is an implementation of vantage point tree data structure in Common Lisp. It allows to perform fast (O(log N) in the best case) fixed-radius near neighbors searches in some set of a metric space.

Look at the following example. Let's choose the space ℝ²[0, 1] and generate some points belonging to this space:

(defun gen-point ()
  (vector (random 1.0)
          (random 1.0)))

(defun gen-points (n)
  (loop repeat n collect (gen-point)))

Then introduce a metric on this space (usual Euclidean metric):

(defun dist (a b)
  (sqrt
   (reduce #'+
           (map 'vector (lambda (x y) (expt (- x y) 2))
                a b))))

Build a tree consisting of 1000000 elements in ℝ²[0, 1]:

(defparameter *tree*
    (vp-trees:make-vp-tree (gen-points 1000000) #'dist))

Now return points which are closer than 0.1 to the origin:

(vp-trees:search-close *tree* #(0.0 0.0) 0.1 #'dist)

The advantage of VP trees is that you don't have to stick to Euclidean metric: you may choose whatever metric you want as long as four metric axioms hold. For example, VP trees can be used for multidimensional sp


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 vp-trees

Author

Vasily Postnicov <shamaz.mazum@gmail.com>

License

2-clause BSD

Description

Perceptual hash algorithms for images

Version

0.1

Source

vp-trees.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 vp-trees.asd

Location

vp-trees.asd

Systems

vp-trees (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 vp-trees/src/package.lisp

Parent

vp-trees (system)

Location

src/package.lisp

Packages

vp-trees


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 vp-trees/src/vp-trees.lisp

Dependency

src/package.lisp (file)

Parent

vp-trees (system)

Location

src/vp-trees.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 vp-trees

Source

src/package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: make-vp-tree LIST DISTANCE &key KEY

Make vantage point tree from a set @c(list) using a distance function @c(distance). Optional @c(key) function can be specified as a mapping between elements in @c(list) and elements in your metric space, so @c(ρ(x,y) = distance (key(x), key(y))) where x and y are in the @c(list).

Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: search-close TREE ITEM THRESHOLD DISTANCE &key KEY

Find all items in the tree @c(tree) closer to @c(item) than @c(threshold). @c(item) and elements of the tree must belong to a metric space with @c(distance) as a metric function. Optional @c(key) function can be used to calculate a distance between two objects in the following way: @c(ρ(x,y) = distance (key(x), key(y))).

Package

vp-trees

Source

src/vp-trees.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Structures

Structure: vp-node ()
Package

vp-trees

Source

src/vp-trees.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

print-object (method)

Direct slots
Slot: center
Readers

vp-node-center (function)

Writers

(setf vp-node-center) (function)

Slot: radius
Type

number

Initform

0

Readers

vp-node-radius (function)

Writers

(setf vp-node-radius) (function)

Slot: inner
Type

(or null vp-trees:vp-node)

Readers

vp-node-inner (function)

Writers

(setf vp-node-inner) (function)

Slot: outer
Type

(or null vp-trees:vp-node)

Readers

vp-node-outer (function)

Writers

(setf vp-node-outer) (function)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: copy-vp-node INSTANCE
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: divide-list LIST PREDICATE

Divide a set in two halves depending on the value of predicate function

Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: make-vp-node &key (CENTER CENTER) (RADIUS RADIUS) (INNER INNER) (OUTER OUTER)
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: median LIST &optional NLEFT NRIGHT KEY

Return median value for a list

Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: pick-random LIST

Pick a random value from a list and return this value and a new list with this value removed.

Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-center INSTANCE
Function: (setf vp-node-center) VALUE INSTANCE
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-inner INSTANCE
Function: (setf vp-node-inner) VALUE INSTANCE
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-leaf-p NODE

True if this node is a leaf

Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-outer INSTANCE
Function: (setf vp-node-outer) VALUE INSTANCE
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-p OBJECT
Package

vp-trees

Source

src/vp-trees.lisp (file)

Function: vp-node-radius INSTANCE
Function: (setf vp-node-radius) VALUE INSTANCE
Package

vp-trees

Source

src/vp-trees.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   V  
Index Entry  Section

F
File, Lisp, vp-trees.asd: The vp-trees․asd file
File, Lisp, vp-trees/src/package.lisp: The vp-trees/src/package․lisp file
File, Lisp, vp-trees/src/vp-trees.lisp: The vp-trees/src/vp-trees․lisp file

L
Lisp File, vp-trees.asd: The vp-trees․asd file
Lisp File, vp-trees/src/package.lisp: The vp-trees/src/package․lisp file
Lisp File, vp-trees/src/vp-trees.lisp: The vp-trees/src/vp-trees․lisp file

V
vp-trees.asd: The vp-trees․asd file
vp-trees/src/package.lisp: The vp-trees/src/package․lisp file
vp-trees/src/vp-trees.lisp: The vp-trees/src/vp-trees․lisp file

Jump to:   F   L   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   D   F   M   P   S   V  
Index Entry  Section

(
(setf vp-node-center): Internal functions
(setf vp-node-inner): Internal functions
(setf vp-node-outer): Internal functions
(setf vp-node-radius): Internal functions

C
copy-vp-node: Internal functions

D
divide-list: Internal functions

F
Function, (setf vp-node-center): Internal functions
Function, (setf vp-node-inner): Internal functions
Function, (setf vp-node-outer): Internal functions
Function, (setf vp-node-radius): Internal functions
Function, copy-vp-node: Internal functions
Function, divide-list: Internal functions
Function, make-vp-node: Internal functions
Function, make-vp-tree: Exported functions
Function, median: Internal functions
Function, pick-random: Internal functions
Function, search-close: Exported functions
Function, vp-node-center: Internal functions
Function, vp-node-inner: Internal functions
Function, vp-node-leaf-p: Internal functions
Function, vp-node-outer: Internal functions
Function, vp-node-p: Internal functions
Function, vp-node-radius: Internal functions

M
make-vp-node: Internal functions
make-vp-tree: Exported functions
median: Internal functions

P
pick-random: Internal functions

S
search-close: Exported functions

V
vp-node-center: Internal functions
vp-node-inner: Internal functions
vp-node-leaf-p: Internal functions
vp-node-outer: Internal functions
vp-node-p: Internal functions
vp-node-radius: Internal functions

Jump to:   (  
C   D   F   M   P   S   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   C   I   O   R   S  
Index Entry  Section

C
center: Exported structures

I
inner: Exported structures

O
outer: Exported structures

R
radius: Exported structures

S
Slot, center: Exported structures
Slot, inner: Exported structures
Slot, outer: Exported structures
Slot, radius: Exported structures

Jump to:   C   I   O   R   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S   V  
Index Entry  Section

P
Package, vp-trees: The vp-trees package

S
Structure, vp-node: Exported structures
System, vp-trees: The vp-trees system

V
vp-node: Exported structures
vp-trees: The vp-trees system
vp-trees: The vp-trees package

Jump to:   P   S   V