The Library
Help/Info
Current Release









Last Modified:
Apr 30, 2012

Algorithms



This page documents library components that are all basically just implementations of mathematical functions or algorithms that don't fit in any of the other pages of the dlib documentation. So this includes things like checksums, cryptographic hashes, sorting, etc.


Tools
Statistics
Hashing
Filtering
[top]

bigint



This object represents an arbitrary precision unsigned integer. It's pretty simple. It's interface is just like a normal int, you don't have to tell it how much memory to use or anything unusual. It just goes :)

Specification: dlib/bigint/bigint_kernel_abstract.h
File to include: dlib/bigint.h

Implementations:
bigint_kernel_1:
This implementation is done using an array of unsigned shorts. It is also reference counted. For further details see the above link. Also note that kernel_2 should be faster in almost every case so you should really just use that version of the bigint object.
kernel_1a
is a typedef for bigint_kernel_1
kernel_1a_c
is a typedef for kernel_1a that checks its preconditions.
bigint_kernel_2:
This implementation is basically the same as kernel_1 except it uses the Fast Fourier Transform to perform multiplications much faster.
kernel_2a
is a typedef for bigint_kernel_2
kernel_2a_c
is a typedef for kernel_2a that checks its preconditions.
[top]

border_enumerator



This object is an enumerator over the border points of a rectangle.

Specification: dlib/geometry/border_enumerator_abstract.h
File to include: dlib/geometry.h

[top]

center



Returns the center point of a rectangle.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

centered_rect



There are various overloads of this function but the basic idea is that it returns a rectangle with a given width and height and centered about a given point.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

copy_graph



This function takes a graph or directed_graph and makes a copy of it.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

copy_graph_structure



This function takes a graph or directed_graph and copies its structure to another graph or directed_graph object. The only restriction is that you can't copy the structure of a graph into a directed_graph. The three other possible combinations are allowed however.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

correlation



This is a function for computing the correlation between matching elements of two std::vectors.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

covariance



This is a function for computing the covariance between matching elements of two std::vectors.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

crc32



This object represents the CRC-32 algorithm for calculating checksums.

Specification: dlib/crc32/crc32_kernel_abstract.h
File to include: dlib/crc32.h

[top]

create_join_tree



This function takes a graph object and creates a join tree for that graph. Or in other words, this function finds a tree decomposition of the given graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

create_moral_graph



This function takes a directed_graph and returns the moralized version of the graph in the form of a graph object.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

create_random_projection_hash



Creates a random projection based locality sensitive hashing function.

Specification: dlib/lsh/create_random_projection_hash_abstract.h
File to include: dlib/lsh.h

[top]

dcenter



Returns the center point of a rectangle. This is a version of center() which returns a double version of the point rather than one which uses integers to represent the result. Therefore, it is slightly more accurate.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

disjoint_subsets



This object represents a set of integers which is partitioned into a number of disjoint subsets. It supports the two fundamental operations of finding which subset a particular integer belongs to as well as merging subsets.

Specification: dlib/disjoint_subsets/disjoint_subsets_abstract.h
File to include: dlib/disjoint_subsets.h

[top]

distance_to_rect_edge



This function takes a rectangle and a point and returns the Manhattan distance between the rectangle's edge and the point.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

edge



This function takes a graph or directed_graph object and a pair of indices. It returns a reference to the edge object between the two nodes with the given indices.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

find_connected_nodes



This function takes a node from a graph or directed_graph object and a set of unsigned longs. It finds all the nodes in the given graph that are connected to the given node by an undirected path and returns them in the set (also note that the original query node is also returned in this set).

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

gate



This object represents a quantum gate that operates on a quantum_register.

Specification: dlib/quantum_computing/quantum_computing_abstract.h
File to include: dlib/quantum_computing.h
Code Examples: 1

[top]

get_rect



This is a simple template function that returns a rectangle representing the size of a 2D container (e.g. matrix or array2d).

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

graph_contains_directed_cycle



This function checks a directed_graph for directed cycles.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

graph_contains_length_one_cycle



This function takes a graph or directed_graph object and returns true if and only if the graph contains a node that has an edge that links back to itself.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

graph_contains_undirected_cycle



This function checks a directed_graph for undirected cycles.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

graph_has_symmetric_edges



This function checks if a directed_graph has a pair of nodes with just one edge between them. If so then it does not have symmetric edges.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

graph_is_connected



This function takes a graph or directed_graph object and determines if the graph is connected. That is, it returns true if and only if there is an undirected path between any two nodes in the given graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

grow_rect



This function takes a rectangle object, grows its borders by a given amount, and returns the result.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

hash



This is a set of convenience functions for invoking murmur_hash3 on std::strings, std::vectors, std::maps, or dlib::matrix objects.

As an aside, the hash() for matrix objects is defined here. It has the same interface as all the others.



Specification: dlib/general_hash/hash_abstract.h
File to include: dlib/hash.h

[top]

hsort_array



hsort_array is an implementation of the heapsort algorithm. It will sort anything that has an array like operator[] interface.

Specification: dlib/sort.h
File to include: dlib/sort.h

[top]

isort_array



isort_array is an implementation of the insertion sort algorithm. It will sort anything that has an array like operator[] interface.

Specification: dlib/sort.h
File to include: dlib/sort.h

[top]

is_clique



This function takes a graph and a set of node index values and checks if the specified set of nodes is a clique in the graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

is_join_tree



This function takes two graph objects and checks if the second of the two graphs is a valid join tree (aka tree decomposition) of the first graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

is_maximal_clique



This function takes a graph and a set of node index values and checks if the specified set of nodes is a maximal clique in the graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

kalman_filter



This object implements the Kalman filter, which is a tool for recursively estimating the state of a process given measurements related to that process. To use this tool you will have to be familiar with the workings of the Kalman filter. An excellent introduction can be found in the paper:
An Introduction to the Kalman Filter by Greg Welch and Gary Bishop


Specification: dlib/filtering/kalman_filter_abstract.h
File to include: dlib/filtering.h

[top]

md5



This is an implementation of The MD5 Message-Digest Algorithm as described in rfc1321.

Specification: dlib/md5/md5_kernel_abstract.h
File to include: dlib/md5.h

[top]

mean_sign_agreement



This is a function for computing the probability that matching elements of two std::vectors have the same sign.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

mean_squared_error



This is a function for computing the mean squared error between matching elements of two std::vectors.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

median



This function takes three parameters and finds the median of the three. The median is swapped into the first parameter and the first parameter ends up in one of the other two, unless the first parameter was the median to begin with of course.

Specification: dlib/algs.h
File to include: dlib/algs.h

[top]

move_rect



This function takes a rectangle and moves it so that it's upper left corner occupies the given location.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

murmur_hash3



This function takes a block of memory and returns a 32bit hash. The hashing algorithm used is Austin Appleby's excellent MurmurHash3.

Specification: dlib/general_hash/murmur_hash3_abstract.h
File to include: dlib/hash.h

[top]

murmur_hash3_128bit



This function takes a block of memory and returns a 128bit hash. The hashing algorithm used is Austin Appleby's excellent MurmurHash3.

Specification: dlib/general_hash/murmur_hash3_abstract.h
File to include: dlib/hash.h

[top]

nearest_point



This function takes a rectangle and a point and returns the point in the given rectangle that is nearest to the given point.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

point



This object represents a point inside a Cartesian coordinate system.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

point_rotator



This is an object that rotates a 2D vector or point object about the origin.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

point_transform



This is an object that rotates a 2D vector or point object about the origin and then adds a displacement vector.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

point_transform_affine



This is an object that applies an affine transformation to a vector or point.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

projection_hash



This is a tool for hashing elements of a vector space into the integers. It is intended to represent locality sensitive hashing functions such as the popular random projection hashing method.

Specification: dlib/lsh/projection_hash_abstract.h
File to include: dlib/lsh.h

[top]

put_in_range



This is a simple function that takes a range and a value and returns the given value if it is within the range. If it isn't in the range then it returns the end of range value that is closest.

Specification: dlib/algs.h
File to include: dlib/algs.h

[top]

qsort_array



qsort_array is an implementation of the QuickSort algorithm. It will sort anything that has an array like operator[] interface. If the quick sort becomes unstable then it switches to a heap sort. This way sorting is guaranteed to take at most N*log(N) time.

Specification: dlib/sort.h
File to include: dlib/sort.h

[top]

quantum_register



This object represents a set of quantum bits. It can be used with the quantum gate object to simulate quantum algorithms.

Specification: dlib/quantum_computing/quantum_computing_abstract.h
File to include: dlib/quantum_computing.h
Code Examples: 1

[top]

rand



This object represents a pseudorandom number generator.

Specification: dlib/rand/rand_kernel_abstract.h
File to include: dlib/rand.h

[top]

randomly_sample_image_features



Given a feature extractor such as the hog_image, this routine selects a random subsample of local image feature vectors from a set of images.

Specification: dlib/statistics/image_feature_sampling_abstract.h
File to include: dlib/statistics.h

[top]

randomly_subsample



This is a set of convenience functions for creating random subsets of data.

Specification: dlib/statistics/random_subset_selector_abstract.h
File to include: dlib/statistics.h

[top]

random_subset_selector



This object is a tool to help you select a random subset of a large body of data. In particular, it is useful when the body of data is too large to fit into memory.

Specification: dlib/statistics/random_subset_selector_abstract.h
File to include: dlib/statistics.h

[top]

rectangle



This object represents a rectangular region inside a Cartesian coordinate system. It allows you to easily represent and manipulate rectangles.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

resize_rect



This function takes a rectangle and returns a new rectangle with the given size but with the same upper left corner as the original rectangle.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

resize_rect_height



This function takes a rectangle and returns a new rectangle with the given height but otherwise with the same edge points as the original rectangle.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

resize_rect_width



This function takes a rectangle and returns a new rectangle with the given width but otherwise with the same edge points as the original rectangle.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

rls_filter



This object is a tool for doing time series prediction using linear recursive least squares. In particular, this object takes a sequence of points from the user and, at each step, attempts to predict the value of the next point.

Specification: dlib/filtering/rls_filter_abstract.h
File to include: dlib/filtering.h

[top]

rotate_point



This is a function that rotates a 2D vector or point object about a given point.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

rotation_matrix



This is a method for creating 2D rotation matrices.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h

[top]

running_covariance



This object is a simple tool for computing the mean and covariance of a sequence of vectors.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

running_scalar_covariance



This object is a simple tool for computing the covariance of a sequence of scalar values.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

running_stats



This object represents something that can compute the running mean and variance of a stream of real numbers.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h
Code Examples: 1

[top]

r_squared



This is a function for computing the R squared coefficient between matching elements of two std::vectors.

Specification: dlib/statistics/statistics_abstract.h
File to include: dlib/statistics.h

[top]

set_difference



This function takes two set objects and gives you their difference.

Specification: dlib/set_utils/set_utils_abstract.h
File to include: dlib/set_utils.h

[top]

set_intersection



This function takes two set objects and gives you their intersection.

Specification: dlib/set_utils/set_utils_abstract.h
File to include: dlib/set_utils.h

[top]

set_intersection_size



This function takes two set objects and tells you how many items they have in common.

Specification: dlib/set_utils/set_utils_abstract.h
File to include: dlib/set_utils.h

[top]

set_union



This function takes two set objects and gives you their union.

Specification: dlib/set_utils/set_utils_abstract.h
File to include: dlib/set_utils.h

[top]

shrink_rect



This function takes a rectangle object, shrinks its borders by a given amount, and returns the result.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

square_root



square_root is a function which takes an unsigned long and returns the square root of it or if the root is not an integer then it is rounded up to the next integer.

Specification: dlib/algs.h
File to include: dlib/algs.h

[top]

translate_rect



This function takes a rectangle and moves it by a given number of units along the x and y axis relative to where it was before the move.

Specification: dlib/geometry/rectangle_abstract.h
File to include: dlib/geometry.h

[top]

triangulate_graph_and_find_cliques



This function takes a graph and turns it into a chordal graph. It also returns a set that contains all the cliques present in the chordal graph.

Specification: dlib/graph_utils/graph_utils_abstract.h
File to include: dlib/graph_utils.h

[top]

vector



This object represents a two or three dimensional vector.

Specification: dlib/geometry/vector_abstract.h
File to include: dlib/geometry.h