Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

5 Computer Science Concepts Available in

Boost

What is Boost?
Boost is a set of third party libraries for C++ that is portable and peer-reviewed. The libraries included in
Boost provide functionality for:
linear algebra operations,
pseudorandom number generators,
multithreaded programs,
date tine, and
regular expression.
In addition to the five libraries listed above Boost also contains another 121 libraries. The libraries dis-
cussed in this description are some of the most useful libraries included in Boost.

uBLAS Library
Linear Algebra is an area of mathematics that studies lines, planes, and subspaces.
Linear Algebra has a variety of uses in the Computer Science/Engineering field.
Such uses include: (1) speech recognition, (2) graph analysis, (3) machine learning,
and (4) parallel computing. The Boost uBLAS Library provides templated C++ clas-
ses for:
Vectors Matrices
Dense Dense
Unit Identity
Triangular
Sparse
Banded
Symmetric
Hermitian
Sparse

This library also covers basic linear algebra operations on vectors and matrices.
These operations include (1) reductions, (2) addition, (3) subtraction, (4) multiplica-
tion with a scalar, (5) inner products, and (6) outer products.
Random Library
A Random Number Generator (RNG) is a function object that is used to create a se-
quence of numbers that cannot be reasonably predicted. RNGs can be used in com-
puter programming to create test data when verifying a programs functionality. The
Boost Random Library provides a variety of generators and distributions to produce
random numbers with specific properties.
Generators implement algorithms as class templates with template value param-
eters. When using generators in your program avoid frequently initialization. Ini-
tializing generators can be costly since they have a large amount of internal state,
and require a user determined seed.
Distributions determine the probability that a value will appear in the sequence
of randomly generated numbers. The Boost Random Library includes the follow-
ing distributions: (1) uniform, (2) Bernoulli, (3) Poisson, and (4) normal.

Thread Library
A thread is the smallest executable unit of a process, a program that has been loaded
into memory. Multithreaded programing enables computers to process multiple
threads concurrently. Below is a diagram depicting the differences between a single
threaded and multithreaded program.

Source: http://www.csc.villanova.edu/~mdamian/threads/posixthreads.html

As shown in the diagram above, multithreaded programs can have multiple threads
of execution processing concurrently. The Boost Thread library allows programmers
to use multiple threads of execution with shared data in C++ code. The library in-
cludes functions for managing the threads, functions for synchronizing data between
multiple threads, and functions allowing thread local storage (TLS).
Regex Library
A regular expressions (regex) are a sequence of characters that can be used when
processing text to match patterns. Regex can be used in computer programming
to provide search functionality for your application. An example of regex would
be the search function provided in Microsoft Word. Regex can also be used to
verify user inputs. While there are traditional C/C++ regex libraries, the Boost
Regex Library provides greater functionality. For example, the Boost Regex Li-
brary provides functions that are able to cope with wide character strings, and
functions for search and replace operations. The basic_regex class is the key class
provided by this library and can be thought of as a string plus the actual state-
machine required by the regular expression algorithms. Below is an example of
how the Boost Regex library can be used to validate an email address.
bool validate_email_format(const std::string *s) {
static const boost::regex
e(/[\w._%+-]+@[\w.-].[a-zA-Z]{2,4}/);
return regex_match(s,e);
}

Source: http://www.computerhope.com/jargon/r/regex.htm

Date Time Library


Date time libraries are an integral part of a majority of programing projects. The
Boost Date Time library provides date and time primitives that allow program-
mers to create customized policies for their applications. The Boost Date Time
Library supports three basic time representations:
1. Time Point A location in the time continuum
2. Time Duration A length of time unattached to any point in the time
continuum.
3. Time Interval A duration of time attached to a specific point in the time
continuum.
Each of the representations listed has a resolution, smallest representable
duration, associated with it. The Boost Date Time Library also includes time
systems. Time systems provide the three basic time representations with the rules
for labeling and calculating time points. A Calendar System is an instance of a
time system where the maximum resolution is one day. The Boost Date Time
Library is compatible with Coordinated Universal Time (UTC), a widely used
time system as well as the Gregorian system, the most widely used calendar
system.

You might also like