Aleph Library introduction and installation yPBL cookbook

by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
28

Table of contents
Abstract
Keywords
Contributors
Releases
Introduction
Definitions
Data Structures and Algorithms
Aleph-w Library
Clang
Recipes
Recipe1: Installing Aleph-w Library
Step1: Installing g-!"#
Step$: Installing the clang system
Step%: Installing the aleph library
Recipe$: Adding Aleph-w Library to a &t'ro(ect
Step1: )pen a *tcreator pro(ect
Step$: +dit the "pro file
Recommended documentation
,1- Aleph-w library
Feedback
1/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Abstract
.his coo/boo/ is intended to illustrate a Library that offers a solution for Data Structures and
Algorithms with high performance"
In this coo/boo/0 we pro1ide two main recipes" .he first recipe aims at illustrating
how to install and configure Aleph-w Library" .he second one describes how
to add the Aleph-w Library to a &t'ro(ect"
Keywords
Aleph-w,C0 Data structures, Algorithms.
2/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Contributors
Authors Reviewers
Angelica Aaya
!ohanna Raiundo
Ronald "ulbaran
Angelica Aaya
!ohanna Raiundo
Ronald "ulbaran
#/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Releases
Releases Date Author(s) Description Status*
2"1 Angelica
Amaya03ohanna
Raimundo0Ronald
Sulbaan
Abstract and recipes proposal to
re1iewers
Re1iewed
2"$ Angelica
Amaya03ohanna
Raimundo0Ronald
Sulbaan
Introduction and definitions
Recipe 1
Recipe $
Re1iewed
Re1iewed
Re1iewed
1"2 Angelica
Amaya03ohanna
Raimundo0Ronald
Sulbaan
'ublic release of 4 1"2
5 Status: Started0 .oRe1iew0 Re1iewed0 Re1ised0 'ublished
$/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Introduction
Software engineering is the study of ways in which to create large and comple6 computer
applications and that generally in1ol1e many programmers and designers" At the heart of
software engineering is with the o1erall design of the applications and on the creation of a design
that is based on the needs and re*uirements of end users" 7hile software engineering in1ol1es
the full life cycle of a software pro(ect0 is includes many different components - specification0
re*uirements gathering0 design0 1erification0 coding0 testing0 *uality assurance0 user acceptance
testing0 production0 and ongoing maintenance"
8a1ing an in-depth understanding on e1ery component of software engineering is not mandatory0
howe1er0 it is important to understand that the sub(ect of data structures and algorithms is
concerned with the coding phase" .he use of data structures and algorithms is the nuts-and-blots
used by programmers to store and manipulate data"
Aleph-w is a library of abstract data types and algorithms around a wide range of fundamental
data structures and computing issues
.he remainder of this coo/boo/ is organi9ed as follows" :irst0 some definitions are intended to
pro1ide a basic understanding of Data Structures0 Algorithms and the used tools" .hen0 se1eral
recipes will show you how to implement and used Aleph-w library"
.his coo/boo/ is dedicated to Linu6 users"
Definitions
Data Structures and Algorithms
A data structure is an arrangement of data in a computer;s memory or e1en dis/ storage" An
e6ample of se1eral common data structures are arrays0 lin/ed lists0 *ueues0 stac/s0 binary trees0
and hash tables" Algorithms0 on the other hand0 are used to manipulate the data contained in these
data structures as in searching and sorting"
<any algorithms apply directly to a specific data structures" 7hen wor/ing with certain data
structures you need to /now how to insert new data0 search for a specified item0 and deleting a
specific item"
Commonly used algorithms include are useful for:
• Searching for a particular data item =or record>"
• Sorting the data" .here are many ways to sort data" Simple sorting0 Ad1anced sorting
• Iterating through all the items in a data structure" =4isiting each item in turn so as to
display it or perform some other action on these items>
%/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Aleph%& Library
Aleph-w is a library of data structures and algorithms implemented in and for C"
It contains the main data structures: single and double lists0 special arrays =dynamic and of bits>0
many types of trees: multitrees0 binary search trees0 a1l0 red-blac/0 randomi9ed0 treaps0 splay
and other interesting types"
Se1eral types of hash tables are implemented: separated chaining0 open adressing with linear
probing and double function hash? this last one has a garbage colector mechanism that allows to
free deleted entries" Dynamic linear hash tables are implemented too"
.he main algorithms on graphs are implemented in an easy way and with good performance
features" @etwor/ :low =ma6imum and min cost>0 cut points0 topological sort0 spanning trees0
min paths" etc" .he graphs are generic in the sense that they can contain data independent of the
algorithm"
Se1eral containers of the C S.L library are implemented with Aleph-w" .heir performance is
better than A@B implementation
'lang
Clang is a compiler front end for the C0 C0 )b(ecti1e-C and )b(ecti1e-C programming
languages" It uses LL4< as its bac/ end and has been part of the LL4< release cycle since
LL4< $"C"
It is designed to offer a complete replacement to the A@B Compiler Collection =ACC>" It is
open-source0 de1eloped by Apple? other companies such as Aoogle are in1ol1ed" Its source code
is a1ailable under the Bni1ersity of IllinoisD@CSA License"
.he Clang pro(ect includes the Clang front end and the Clang static analy9er and se1eral code
analysis tools"
&/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Recipes
Recipe1: Installing Alephw !ibrary
In order to carry out this recipe you will need:
• .he g compiler EF !"#"
• .he clang system EF %"!"
• .he Aleph-w library EF 1"Ga"$ that can be downloaded from ,,1- Aleph-w library-
Step1: Installing g""#$%
:irstly0 you need to open a terminal and type:
sudo apt-get install g-!." and press enter /ey"
:inally0 run g--1ersion and to confirm that the g-!"# is
installed"
It;s important that you see the number !"# for the g 1ersion number"
Step&: Installing the clang system
#irst$ you need to open a terminal and type:
sudo gedit %etc%apt%sources.list (Hou can use gedit or any other te6t editor)
Second$ add the folowing lines to the sources"list file depending on your linu6 system:
#or Debian$
wheezy (Debian stable) - Last update : Sat, 28 Dec 2013 15:2:! "#$ % &e'isi(n: 1)808*
deb http://llvm.org/apt/wheezy/ llvm-toolchain-wheezy main
deb-src http://llvm.org/apt/wheezy/ llvm-toolchain-wheezy main
'/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
sid (unstable) - Last update : +(n, 23 ,un 201 11:3:1* "#$ % &e'isi(n: 2118)
deb http://llvm.org/apt/unstable/ llvm-toolchain main
deb-src http://llvm.org/apt/unstable/ llvm-toolchain main
# 3.4
deb http://llvm.org/apt/unstable/ llvm-toolchain-3.4 main
deb-src http://llvm.org/apt/unstable/ llvm-toolchain-3.4 main
#or &buntu$
-.ecise (12/0) - Last update : #ue, 1! ,un 201 00:3):1! "#$ % &e'isi(n: 21105*
deb http://llvm.org/apt/precise/ llvm-toolchain-precise main
deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise main
# 3.4
deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main
deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main
# Common
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
0uantal (12/10) - Last update : +(n, 1* ,un 201 13:2:0* "#$ % &e'isi(n: 1)80!!
deb http://llvm.org/apt/quantal/ llvm-toolchain-quantal main
deb-src http://llvm.org/apt/quantal/ llvm-toolchain-quantal main
# 3.4
deb http://llvm.org/apt/quantal/ llvm-toolchain-quantal-3.4 main
deb-src http://llvm.org/apt/quantal/ llvm-toolchain-quantal-3.4 main
# Common
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu quantal main
&a.in1 (13/0) - Last update : #ue, 1! ,un 201 05:01:23 "#$ % &e'isi(n: 211088
deb http://llvm.org/apt/raring/ llvm-toolchain-raring main
deb-src http://llvm.org/apt/raring/ llvm-toolchain-raring main
# 3.4
deb http://llvm.org/apt/raring/ llvm-toolchain-raring-3.4 main
deb-src http://llvm.org/apt/raring/ llvm-toolchain-raring-3.4 main
# Common
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu raring main
Saucy (13/10) - Last update : +(n, 23 ,un 201 1!:5*:31 "#$ % &e'isi(n: 211))
deb http://llvm.org/apt/saucy/ llvm-toolchain-saucy main
deb-src http://llvm.org/apt/saucy/ llvm-toolchain-saucy main
# 3.4
deb http://llvm.org/apt/saucy/ llvm-toolchain-saucy-3.4 main
deb-src http://llvm.org/apt/saucy/ llvm-toolchain-saucy-3.4 main
#.usty (1/0) - Last update : +(n, 23 ,un 201 1*:5):0* "#$ % &e'isi(n: 211))
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
# 3.4
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.4 main
8/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.4 main
'hird$
(nstall (stable branch)
• .o retrie1e the archi1e signature:
type in a terminal sudo wget -) - http$%%ll*m.org%apt%ll*m-snapshot.gpg.+ey,sudo apt-
+ey add -
• .o install (ust clang0 lldb and ll1m =%"! release>:
type in a terminal sudo apt-get install clang--.! lldb--.! ll*m--.!
Step': Installing the aleph library
:irstly0 you need to open the Ima/efile file that is inside the folder of the Aleph-w library and
(ust delete or comment lines if you wish to use gnu or clang suite0 in this case we are going to use
clang suite:
Second:
.ype in a terminal : sudo .ind % -name /ccon.ig.h/ -e0ec echo 12 34 and press enter"
(/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
Select the path that contains c%!."
5%usr%include%i-"6-linu0-gnu%c%!."7
.hird:
loo/ for the line that contains 5(89L&D:S ; -(.%7 in the Ima/efile file and change it by
I(89L&D:S ; -(.% -(%usr%include%i-"6-linu0-gnu%c%!."7 obtained before"
:ourth:
)pen a terminal cd to aleph directory and run: 0m+m.
run ma+e libAleph.a and wait for the compilation"
Recipe&: Adding Alephw !ibrary to a (t)ro*ect
In order to carry out this recipe you will need:
• .he &tCreator and &tLibraries"
1)/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
• .he Aleph-w library EF1"Ga"$"
Step1: +pen a ,tcreator pro*ect
)pen *tcreator0 go to :ile and create or open a new pro(ect"
Step&: -dit the $pro file
)pen the 5"pro file and add the following lines:
!"#$%C&&'(")* +, -std,c++--
C./'0) +, c++--
0/C(12$3"45+,$(AlephPath)
(06* ,-($(AlephPath)7
-lnana -lc -lm -lgsl -lgslcblas -lgmp -lmp8r -lasprint8
Recommended documentation
.1/ Alephw library
http://sourceforge.net/projects/aleph-w/
11/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl
Aleph Library introduction and installation yPBL cookbook
by Angelica Amaya, Johanna Raimundo and Ronald Sulbaran
last update: 23!"2!#$
0eedbac1
Comments and suggestions: angelica.guldris@gmail.com0 johap7@hotmail.com0
ronalanto2%Jhotmail"com
12/12
yPBL methodology cookbook
http :// homepages .laas .fr /eexposit /ypbl