Giter Site home page Giter Site logo

kdtree's Introduction

There are many k-d tree implementations available, including many good implementations for C++. This particular implementation offers two primary advantages over many others.

First, it presents a container adaptor interface that is idiomatic of C++ STL and will be familiar to users of, for instance, the std::heap adaptor. It can operate over any data storage mechanism that provides iterators satisfying the RandomAccessIterator concept. It requires a mutable container and makes heavy use of std::nth_element to perform the bulk of the k-d tree construction effort in place. Likewise, via template parameters, it can operator on any underlying type that provides iterators satisfying the RandomAccessIterator concept to represent the k-dimensional space. For simplicity of usage, a point type is provided that is a compositional facade over std::array, thus offering contiguous storage requiring no additional dynamic allocations. For high-dimensional use cases, a container with dynamically allocated storage, such as std::vector, may allow for faster tree construction through less expensive point swaps.

Second, and relatedly, it is written to be extremely memory efficient and to enjoy efficiency gains from locality of reference and superior cache utilization. The underlying coordinate type is a template of the provided point type and allows for the selection of the most memory-efficient appropriate type. With respect to the minimal storage necessary to represent the points themselves, overhead during tree construction and search algorithm execution is limited to incidental automatic storage of primitive types, and the O(log(n)) stack depth necessary for the recursions, typically no more than a few KB of overhead for even extremely large data sets. Several potential algorithmic optimizations remain to be applied, but performance is nonetheless favorable compared to several tested implementations.

BUILDING
========
1. Enter project top-level directory, and type 'make'.
2. At the moment, there is no 'install' target, so include files incorporating the main header-only k-d tree library must use one of various methods to directly reference the header file by path (e.g. compiler -I flag, full #include path).

kdtree's People

Contributors

rlichtenwalter avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

yangzhengshi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.