The Library
Help/Info
Current Release
Sourceforge











Last Modified:
May 12, 2008

Algorithms



This page documents library components that are all basically just implementations of mathematical functions or algorithms without any really significant data structures associated with them. So this includes things like checksums, cryptographic hashes, machine learning algorithms, sorting, etc...


Objects
Global Functions
[top]

assignment



This object models an assignment of random variables to particular values. It is used with the joint_probability_table and conditional_probability_table objects to represent assignments of various random variables to actual values.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1, 2

[top]

bayesian_network_gibbs_sampler



This object performs Markov Chain Monte Carlo sampling of a bayesian network using the Gibbs sampling technique.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

bayesian_network_join_tree



This object represents an implementation of the join tree algorithm (a.k.a. the junction tree algorithm) for inference in bayesian networks.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1, 2, 3

[top]

bayes_node



This object represents a node in a bayesian network. It is intended to be used inside the directed_graph object to represent bayesian networks.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1, 2

[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 multiplcations 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]

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]

conditional_probability_table



This object represents a conditional probability table.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_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]

crc32



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

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

Implementations:
crc32_kernel_1:
This implementation uses the polynomial 0xedb88320.
kernel_1a
is a typedef for crc32_kernel_1
[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]

decision_function



This object represents a binary decision function for use with support vector machines.

Specification: dlib/svm/function_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[top]

edge



This function takes a 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]

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_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]

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]

joint_probability_table



This object represents a joint probability table.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h

[top]

krls



This is an implementation of the kernel recursive least squares algorithm described in the paper The Kernel Recursive Least Squares Algorithm by Yaakov Engel.

The long and short of this algorithm is that it is an online kernel based regression algorithm. You give it samples (x,y) and it learns the function f(x) == y. For a detailed description of the algorithm read the above paper.



Specification: dlib/svm/krls_abstract.h
File to include: dlib/svm.h

[top]

linear_kernel



This object represents a linear function kernel for use with support vector machines.

Specification: dlib/svm/kernel_abstract.h
File to include: dlib/svm.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]

median



This function takes three paramaters 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]

mlp



This object represents a multilayer layer perceptron network that is trained using the back propagation algorithm. The training algorithm also incorporates the momentum method. That is, each round of back propagation training also adds a fraction of the previous update. This fraction is controlled by the momentum term set in the constructor.

Specification: dlib/mlp/mlp_kernel_abstract.h
File to include: dlib/mlp.h
Code Examples: 1

Implementations:
mlp_kernel_1:
This is implemented in the obvious way.
kernel_1a
is a typedef for mlp_kernel_1
kernel_1a_c
is a typedef for kernel_1a that checks its preconditions.
[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]

nearest_point



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

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

[top]

node_cpt_filled_out



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily verify that a node in a bayesian network has its conditional_probability_table completely filled out.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

node_first_parent_assignment



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain an assignment that contains all the parents of a node in a bayesian network.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

node_is_evidence



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily determine if a bayes_node is evidence when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h

[top]

node_next_parent_assignment



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily loop through all the parent assignments of a node in a bayesian network.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

node_num_values



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the number of values of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h

[top]

node_probability



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the probability of a bayes_node given its parents when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h

[top]

node_value



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the value of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.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]

polynomial_kernel



This object represents a polynomial kernel for use with support vector machines.

Specification: dlib/svm/kernel_abstract.h
File to include: dlib/svm.h

[top]

probabilistic_decision_function



This object represents a binary decision function for use with support vector machines. It returns an estimate of the probability that a given sample is in the +1 class.

Specification: dlib/svm/function_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[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]

radial_basis_kernel



This object represents a radial basis function kernel for use with support vector machines.

Specification: dlib/svm/kernel_abstract.h
File to include: dlib/svm.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

Implementations:
rand_kernel_1:
This implementation is done using the Mersenne Twister algorithm.
kernel_1a
is a typedef for rand_kernel_1

Extensions to rand


rand_float:
This extension gives rand the ability to generate random floating point numbers.

Specification: dlib/rand/rand_float_abstract.h

Implementations:
rand_float_1:
The implementation is obvious. Click on the link if you want to see.
float_1a
is a typedef for rand_kernel_1a extended by rand_float_1
[top]

randomize_samples



Randomizes the order of samples in a column vector containing sample data.

Specification: dlib/svm/svm_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[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]

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_node_as_evidence



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the evidence flag of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

set_node_as_nonevidence



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily remove the evidence flag of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

set_node_num_values



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the number of values of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

set_node_probability



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the probability of a bayes_node given its parents when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[top]

set_node_value



This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily modify the value of a bayes_node when it is inside a directed_graph object.

Specification: dlib/bayes_utils/bayes_utils_abstract.h
File to include: dlib/bayes_utils.h
Code Examples: 1

[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]

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]

svm_nu_cross_validate



Performs k-fold cross validation using the svm_nu_train() function.

Specification: dlib/svm/svm_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[top]

svm_nu_train



Trains a nu support vector classifier and outputs a decision_function.

The implementation of the nu-svm training algorithm used by this library is based on the following excellent papers:

Specification: dlib/svm/svm_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[top]

svm_nu_train_prob



Trains a nu support vector classifier and outputs a probabilistic_decision_function.

This function uses the svm_nu_train function and creates the probability model using the technique described in the paper:
Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods by John C. Platt. Match 26, 1999


Specification: dlib/svm/svm_abstract.h
File to include: dlib/svm.h
Code Examples: 1

[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 choral graph.

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

[top]

vector



This object represents a three dimensional vector.

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