# 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...

Tools
bigint
crc32
rand
running_stats
vector_normalizer
mlp
Optimization
derivative make_line_search_function poly_min_extrap line_search find_min_quasi_newton find_min_conjugate_gradient find_min_quasi_newton2 find_min_conjugate_gradient2
Quantum Computing
quantum_register gate
Geometry
rectangle vector point centered_rect translate_rect resize_rect resize_rect_width resize_rect_height move_rect nearest_point
Bayes Utilities
assignment joint_probability_table conditional_probability_table bayes_node bayesian_network_gibbs_sampler bayesian_network_join_tree Bayes Node Utilities set_node_value node_value node_is_evidence set_node_as_evidence set_node_as_nonevidence set_node_num_values node_num_values node_probability set_node_probability node_first_parent_assignment node_next_parent_assignment node_cpt_filled_out
Graph Utilities
graph_contains_directed_cycle graph_contains_undirected_cycle create_moral_graph triangulate_graph_and_find_cliques graph_contains_length_one_cycle find_connected_nodes graph_is_connected is_clique is_maximal_clique copy_graph_structure edge is_join_tree create_join_tree
Kernel_Methods
Kernels radial_basis_kernel polynomial_kernel sigmoid_kernel linear_kernel Function_Objects decision_function distance_function probabilistic_decision_function normalized_function pick_initial_centers krls kcentroid linearly_independent_subset_finder kkmeans svm_nu_trainer rvm_trainer rvm_regression_trainer rbf_network_trainer train_probabilistic_decision_function cross_validate_trainer test_binary_decision_function cross_validate_trainer_threaded rank_features reduced_decision_function_trainer reduced reduced_decision_function_trainer2 reduced2
randomize_samples
is_binary_classification_problem
hsort_array
isort_array
put_in_range
md5
median
qsort_array
square_root
Set Utilities
set_intersection_size set_intersection set_union set_difference
bayesian_network_join_tree
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
This object represents an implementation of the join tree algorithm (a.k.a. the junction tree algorithm) for inference in bayesian networks.
bayes_net_ex.cpp.html
bayes_net_gui_ex.cpp.html
bayes_net_from_disk_ex.cpp.html
bayesian_network_gibbs_sampler
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
This object performs Markov Chain Monte Carlo sampling of a bayesian network using the Gibbs sampling technique.
bayes_net_ex.cpp.html
bayes_node
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
This object represents a node in a bayesian network. It is intended to be used inside the directed_graph object to represent bayesian networks.
bayes_net_ex.cpp.html
bayes_net_gui_ex.cpp.html
conditional_probability_table
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
This object represents a conditional probability table.
joint_probability_table
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
This object represents a joint probability table.
derivative
dlib/optimization.h
dlib/optimization/optimization_abstract.h
This is a function that takes another function as input and returns a function object that numerically computes the derivative of the input function.
make_line_search_function
dlib/optimization.h
dlib/optimization/optimization_abstract.h
This is a function that takes another function f(x) as input and returns a function object l(z) = f(start + z*direction).
pick_initial_centers
dlib/svm.h
dlib/svm/kkmeans_abstract.h
This is a function that you can use to seed data clustering algorithms like the kkmeans clustering method. What it does is pick reasonable starting points for clustering by basically trying to find a set of points that are all far away from each other.
kkmeans_ex.cpp.html
poly_min_extrap
dlib/optimization.h
dlib/optimization/optimization_abstract.h
This function finds the 3rd degree polynomial that interpolates a set of points and returns you the minimum of that polynomial.
line_search
dlib/optimization.h
dlib/optimization/optimization_abstract.h
Performs a line search on a given function and returns the input that makes the function significantly smaller.
find_min_quasi_newton
dlib/optimization.h
dlib/optimization/optimization_abstract.h
Performs an unconstrained minimization of the potentially nonlinear function f() using the BFGS quasi newton method.
find_min_conjugate_gradient
dlib/optimization.h
dlib/optimization/optimization_abstract.h
Performs an unconstrained minimization of the potentially nonlinear function f() using a conjugate gradient method.
find_min_quasi_newton2
dlib/optimization.h
dlib/optimization/optimization_abstract.h
Performs an unconstrained minimization of the potentially nonlinear function f() using the BFGS quasi newton method. This version doesn't take a gradient function of f() but instead numerically approximates the gradient.
find_min_conjugate_gradient2
dlib/optimization.h
dlib/optimization/optimization_abstract.h
Performs an unconstrained minimization of the potentially nonlinear function f() using a conjugate gradient method. This version doesn't take a gradient function of f() but instead numerically approximates the gradient.
assignment
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
bayes_net_gui_ex.cpp.html
set_node_probability
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
node_first_parent_assignment
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_gui_ex.cpp.html
node_next_parent_assignment
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_gui_ex.cpp.html
node_cpt_filled_out
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_gui_ex.cpp.html
node_probability
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
node_num_values
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
set_node_num_values
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
set_node_as_nonevidence
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
set_node_as_evidence
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
node_is_evidence
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
node_value
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
set_node_value
dlib/bayes_utils.h
dlib/bayes_utils/bayes_utils_abstract.h
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.
bayes_net_ex.cpp.html
bigint
dlib/bigint.h
dlib/bigint/bigint_kernel_abstract.h
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 :)
bigint_kernel_1
dlib/bigint/bigint_kernel_1.h
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
bigint_kernel_2
dlib/bigint/bigint_kernel_2.h
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
crc32
dlib/crc32.h
dlib/crc32/crc32_kernel_abstract.h
This object represents the CRC-32 algorithm for calculating checksums.
crc32_kernel_1
dlib/crc32/crc32_kernel_1.h
This implementation uses the polynomial 0xedb88320.
kernel_1a
is a typedef for crc32_kernel_1
rand
dlib/rand.h
dlib/rand/rand_kernel_abstract.h
This object represents a pseudorandom number generator.
rand_kernel_1
dlib/rand/rand_kernel_1.h
This implementation is done using the Mersenne Twister algorithm.
kernel_1a
is a typedef for rand_kernel_1
rand_float
dlib/rand/rand_float_abstract.h
This extension gives rand the ability to generate random floating point numbers.
rand_float_1
dlib/rand/rand_float_1.h
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
rectangle
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
This object represents a rectangular region inside a Cartesian coordinate system. It allows you to easily represent and manipulate rectangles.
mlp
dlib/mlp.h
dlib/mlp/mlp_kernel_abstract.h
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.
mlp_ex.cpp.html
mlp_kernel_1
dlib/mlp/mlp_kernel_1.h
This is implemented in the obvious way.
kernel_1a
is a typedef for mlp_kernel_1
vector
dlib/geometry.h
dlib/geometry/vector_abstract.h
This object represents a two or three dimensional vector.
point
dlib/geometry.h
dlib/geometry/vector_abstract.h
This object represents a point inside a Cartesian coordinate system.
krls
dlib/svm.h
dlib/svm/krls_abstract.h
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.

krls_ex.cpp.html
krls_filter_ex.cpp.html
kkmeans
dlib/svm.h
dlib/svm/kkmeans_abstract.h
This is an implementation of a kernelized k-means clustering algorithm. It performs k-means clustering by using the kcentroid object.
kkmeans_ex.cpp.html
vector_normalizer
dlib/statistics.h
dlib/statistics/statistics_abstract.h
This object represents something that can learn to normalize a set of column vectors. In particular, normalized column vectors should have zero mean and a variance of one.

Also, if desired, this object can use principal component analysis for the purposes of reducing the number of elements in a vector.
svm_ex.cpp.html
running_stats
dlib/statistics.h
dlib/statistics/statistics_abstract.h
This object represents something that can compute the running mean and variance of a stream of real numbers.
kcentroid_ex.cpp.html
linearly_independent_subset_finder
dlib/svm.h
dlib/svm/linearly_independent_subset_finder_abstract.h

This is an implementation of an online algorithm for recursively finding a set of linearly independent vectors in a kernel induced feature space. To use it you decide how large you would like the set to be and then you feed it sample points.

Each time you present it with a new sample point it either keeps the current set of independent points unchanged, or if the new point is "more linearly independent" than one of the points it already has, it replaces the weakly linearly independent point with the new one.

This object uses the Approximately Linearly Dependent metric described in the paper The Kernel Recursive Least Squares Algorithm by Yaakov Engel to decide which points are more linearly independent than others.

kcentroid
dlib/svm.h
dlib/svm/kcentroid_abstract.h
This is an implementation of an online algorithm for recursively estimating the centroid of a sequence of training points. It uses the sparsification technique described in the paper The Kernel Recursive Least Squares Algorithm by Yaakov Engel.

This object then allows you to compute the distance between the center of mass and any test points. So you can use this object to predict how similar a test point is to the data this object has been trained on (larger distances from the centroid indicate dissimilarity/anomalous points).

kcentroid_ex.cpp.html
train_probabilistic_decision_function
dlib/svm.h
dlib/svm/svm_abstract.h

Trains a probabilistic_decision_function using some sort of trainer object such as the svm_nu_trainer or rbf_network_trainer.

The probability model is created by 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

svm_ex.cpp.html
rbf_network_trainer
dlib/svm.h
dlib/svm/rbf_network_abstract.h
Trains a radial basis function network and outputs a decision_function.
rvm_regression_trainer
dlib/svm.h
dlib/svm/rvm_abstract.h

Trains a relevance vector machine for solving regression problems. Outputs a decision_function that represents the learned regression function.

The implementation of the RVM training algorithm used by this library is based on the following paper:

> Tipping, M. E. and A. C. Faul (2003). Fast marginal likelihood maximisation for sparse Bayesian models. In C. M. Bishop and B. J. Frey (Eds.), Proceedings of the Ninth International Workshop on Artificial Intelligence and Statistics, Key West, FL, Jan 3-6.

rvm_regression_ex.cpp.html
rvm_trainer
dlib/svm.h
dlib/svm/rvm_abstract.h

Trains a relevance vector machine for solving binary classification problems. Outputs a decision_function that represents the learned classifier.

The implementation of the RVM training algorithm used by this library is based on the following paper:

> Tipping, M. E. and A. C. Faul (2003). Fast marginal likelihood maximisation for sparse Bayesian models. In C. M. Bishop and B. J. Frey (Eds.), Proceedings of the Ninth International Workshop on Artificial Intelligence and Statistics, Key West, FL, Jan 3-6.

rvm_ex.cpp.html
svm_nu_trainer
dlib/svm.h
dlib/svm/svm_abstract.h

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:

- Chang and Lin, Training {nu}-Support Vector Classifiers: Theory and Algorithms
- Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for support vector machines, 2001. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm

svm_ex.cpp.html
normalized_function
dlib/svm.h
dlib/svm/function_abstract.h
This object represents a container for another function object and an instance of the vector_normalizer object.

It automatically normalizes all inputs before passing them off to the contained function object.
svm_ex.cpp.html
probabilistic_decision_function
dlib/svm.h
dlib/svm/function_abstract.h
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.
svm_ex.cpp.html
distance_function
dlib/svm.h
dlib/svm/function_abstract.h
This object represents a point in kernel induced feature space. You may use this object to find the distance from the point it represents to points in input space.
decision_function
dlib/svm.h
dlib/svm/function_abstract.h
This object represents a decision or regression function that was learned by a kernel based learning algorithm.
svm_ex.cpp.html
linear_kernel
dlib/svm.h
dlib/svm/kernel_abstract.h
This object represents a linear function kernel for use with kernel learning machines.
sigmoid_kernel
dlib/svm.h
dlib/svm/kernel_abstract.h
This object represents a sigmoid kernel for use with kernel learning machines.
polynomial_kernel
dlib/svm.h
dlib/svm/kernel_abstract.h
This object represents a polynomial kernel for use with kernel learning machines.
radial_basis_kernel
dlib/svm.h
dlib/svm/kernel_abstract.h
This object represents a radial basis function kernel for use with kernel learning machines.
svm_ex.cpp.html
is_binary_classification_problem
dlib/svm.h
dlib/svm/svm_abstract.h
This function simply takes two vectors, the first containing feature vectors and the second containing labels, and reports back if the two could possibly contain data for a well formed classification problem.
randomize_samples
dlib/svm.h
dlib/svm/svm_abstract.h
Randomizes the order of samples in a column vector containing sample data.
svm_ex.cpp.html
rank_features
dlib/svm.h
dlib/svm/feature_ranking_abstract.h
Finds a ranking of the top N (a user supplied parameter) features in a set of data from a two class classification problem. It does this by computing the distance between the centroids of both classes in kernel defined feature space. Good features are then ones that result in the biggest separation between the two centroids.
rank_features_ex.cpp.html
reduced
dlib/svm.h
dlib/svm/reduced_abstract.h
This is a convenience function for creating reduced_decision_function_trainer objects.
reduced_decision_function_trainer
dlib/svm.h
dlib/svm/reduced_abstract.h
This is a trainer object that is meant to wrap other trainer objects that create decision_function objects. It performs post processing on the output decision_function objects with the intent of representing the decision_function with fewer support vectors.
reduced2
dlib/svm.h
dlib/svm/reduced_abstract.h
This is a convenience function for creating reduced_decision_function_trainer2 objects.
svm_ex.cpp.html
reduced_decision_function_trainer2
dlib/svm.h
dlib/svm/reduced_abstract.h

This is a trainer object that is meant to wrap other trainer objects that create decision_function objects. It performs post processing on the output decision_function objects with the intent of representing the decision_function with fewer support vectors.

It begins by performing the same post processing as the reduced_decision_function_trainer object but it also performs a global gradient based optimization to further improve the results.

svm_ex.cpp.html
test_binary_decision_function
dlib/svm.h
dlib/svm/svm_abstract.h
Tests a decision_function that represents a binary decision function and returns the test accuracy.

cross_validate_trainer_threaded
dlib/svm_threaded.h
dlib/svm/svm_threaded_abstract.h
Performs k-fold cross validation on a user supplied trainer object such as the svm_nu_trainer or rbf_network_trainer. This function does the same thing as cross_validate_trainer except this function also allows you to specify how many threads of execution to use. So you can use this function to take advantage of a multi-core system to perform cross validation faster.
cross_validate_trainer
dlib/svm.h
dlib/svm/svm_abstract.h
Performs k-fold cross validation on a user supplied trainer object such as the svm_nu_trainer or rbf_network_trainer.
svm_ex.cpp.html
hsort_array
dlib/sort.h
dlib/sort.h
hsort_array is an implementation of the heapsort algorithm. It will sort anything that has an array like operator[] interface.
put_in_range
dlib/algs.h
dlib/algs.h
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.
isort_array
dlib/sort.h
dlib/sort.h
isort_array is an implementation of the insertion sort algorithm. It will sort anything that has an array like operator[] interface.
qsort_array
dlib/sort.h
dlib/sort.h
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.
md5
dlib/md5.h
dlib/md5/md5_kernel_abstract.h
This is an implementation of The MD5 Message-Digest Algorithm as described in rfc1321.
median
dlib/algs.h
dlib/algs.h
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.
square_root
dlib/algs.h
dlib/algs.h
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.
edge
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
is_join_tree
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
create_join_tree
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
graph_contains_directed_cycle
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
This function checks a directed_graph for directed cycles.
set_intersection
dlib/set_utils.h
dlib/set_utils/set_utils_abstract.h
This function takes two set objects and gives you their intersection.
set_union
dlib/set_utils.h
dlib/set_utils/set_utils_abstract.h
This function takes two set objects and gives you their union.
set_difference
dlib/set_utils.h
dlib/set_utils/set_utils_abstract.h
This function takes two set objects and gives you their difference.
set_intersection_size
dlib/set_utils.h
dlib/set_utils/set_utils_abstract.h
This function takes two set objects and tells you how many items they have in common.
triangulate_graph_and_find_cliques
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
create_moral_graph
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
This function takes a directed_graph and returns the moralized version of the graph in the form of a graph object.
graph_contains_length_one_cycle
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
find_connected_nodes
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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).
graph_is_connected
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
is_clique
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
copy_graph_structure
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
is_maximal_clique
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
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.
nearest_point
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
This function takes a rectangle and a point and returns the point in the given rectangle that is nearest to the given point.
move_rect
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
This function takes a rectangle and moves it so that it's upper left corner occupies the given location.
resize_rect_height
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
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.
resize_rect_width
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
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.
resize_rect
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
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.
translate_rect
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
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.
quantum_register
dlib/quantum_computing.h
dlib/quantum_computing/quantum_computing_abstract.h
This object represents a set of quantum bits. It can be used with the quantum gate object to simulate quantum algorithms.
quantum_computing_ex.cpp.html
gate
dlib/quantum_computing.h
dlib/quantum_computing/quantum_computing_abstract.h
This object represents a quantum gate that operates on a quantum_register.
quantum_computing_ex.cpp.html
centered_rect
dlib/geometry.h
dlib/geometry/rectangle_abstract.h
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.
graph_contains_undirected_cycle
dlib/graph_utils.h
dlib/graph_utils/graph_utils_abstract.h
This function checks a directed_graph for undirected cycles.