How To Install libkdtree++-dev on Ubuntu 18.04

In this tutorial we learn how to install libkdtree++-dev on Ubuntu 18.04. libkdtree++-dev is C++ template container implementation of kd-tree sorting

Introduction

In this tutorial we learn how to install libkdtree++-dev on Ubuntu 18.04.

What is libkdtree++-dev

libkdtree++-dev is:

libkdtree++ is a C++ template container implementation of k-dimensional space sorting, using a kd-tree. It:

  • supports an unlimited number of dimensions (in theory)
  • can store any data structure, provided the data structure provides operator[0 - k-1] to access the individual dimensional components (arrays, std::vector already do) and a std::less implementation for the type of dimensional components
  • has support for custom allocators
  • implements iterators
  • provides standard find as well as range queries
  • has amortised O(lg n) time (O(n lg n) worst case) on most operations (insert/erase/find optimised) and worst-case O(n) space
  • provides a means to rebalance and thus optimise the tree
  • exists in its own namespace
  • uses STL coding style, basing a lot of the code on stl_tree.h

libkdtree++ only exists as a -dev package as it’s only a bunch of C++ header files. Therefore, no static or shared library is necessary, allowing for ultimate flexibility.

There are three methods to install libkdtree++-dev on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libkdtree++-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libkdtree++-dev using apt-get by running the following command:

sudo apt-get -y install libkdtree++-dev

Install libkdtree++-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libkdtree++-dev using apt by running the following command:

sudo apt -y install libkdtree++-dev

Install libkdtree++-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libkdtree++-dev using aptitude by running the following command:

sudo aptitude -y install libkdtree++-dev

How To Uninstall libkdtree++-dev on Ubuntu 18.04

To uninstall only the libkdtree++-dev package we can use the following command:

sudo apt-get remove libkdtree++-dev

Uninstall libkdtree++-dev And Its Dependencies

To uninstall libkdtree++-dev and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libkdtree++-dev

Remove libkdtree++-dev Configurations and Data

To remove libkdtree++-dev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libkdtree++-dev

Remove libkdtree++-dev configuration, data, and all of its dependencies

We can use the following command to remove libkdtree++-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libkdtree++-dev

References

Summary

In this tutorial we learn how to install libkdtree++-dev package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.