namespace sdsl{
/*!
	\mainpage sdsl - Succinct Data Structure Library 
	\author Simon Gog (firstname.lastname\@uni-ulm.de)

	\section new_in_09_sec New stuff in version 0.9
		- Time and space efficient construction of compressed suffix trees (see method sdsl::construct_cst)
		- Two new lcp construction algorithms (see method sdsl::construct_lcp_go and sdsl::construct_lcp_go2)
		- Class \link sdsl::cst_sct3 \endlink, for a compressed suffix tree using \f$4n\f$ bits in practice for the navigation structure (see CST++ paper, SPIRE 2010)
		- Class \link sdsl::lcp_fc_wrapper \endlink which uses information from cst_sct3 navigation structure to compress the lcp array. 
		- All compressed suffix trees support now the following methods:
		   - id(node_type v) returns an id for node v of the tree. This is useful if you have to store additional information
		     for the node in a separat array. The method will give you the right index for each node.
		   - wl(node_type v, const unsigned char c) returns the Weiner Link for the node v and the character c.
		   - sl(node_type v) returns the suffix link of node v.

		- Class \link sdsl::int_wavelet_tree \endlink is a wavelet trees for integer array which supports 2d-range-queries.
		  

	\section intro_sec Introduction
		Before we will introduce the library itself let us explain what 
		a succinct data structure is.
		A data structure is called <i>succinct</i> when it has the following properties: 
		  - The space occupied by the data structure is close to the information theoretic lower bound and
		  - the desired operations (like access to an element) can be executed efficiently (in constant or logarithmic time complexity).

		\par Example
		A classic example is a bit vector \f$ b=\{0,1\}^n \f$ with the rank operation \f$ rank(b,i) \f$ (\f$ 0< i\leq n \f$).  p
		The operation rank is defined as the number of bits set to one in the prefix from position \f$ 0\f$ to \f$ i-1 \f$.\n
		Let let \f$ b = 01100000010101\f$ a bit vector of size 14. 
		Some rank values are \f$ rank(b,1)=0, rank(b,2)=1, rank(b,3)=2, \f$ or \f$rank(b,14)=5\f$. \n \n
		The naive solution to answer the rank queries is to store all the rank \f$ rank(b,i)\f$  value for each 
		bit \f$i\f$. But this solution requires \f$O(n\cdot log n)\f$ additional bits as each rank value requires \f$\log n\f$ bits. 
		There are solutions which only need \f$o(n)\f$ bits of additional space while supporting the rank operation
	    on \f$b\f$ in constant time. We refer to the article 
		<A HREF="http://portal.acm.org/citation.cfm?id=1216372">Compressed full-text indexes</A> from Gonzalo Navarro and 
	    Veli Mäkinen for the solution and a good overview on the topic of succinct data structures and compressed indices. 	


		The sdsl provides very efficient and space optimized C++ classes for the basic data structures like \link sdsl::bit_vector bit vectors\endlink,
		a generic \link sdsl::int_vector vector for integers of fixed width\endlink (in contrast to byte aliged vectors of 
		fixed width 8, 16, 32, and 64 ), and support for \link sdsl::rank_support rank \endlink and \link sdsl::select_support select \endlink
		on bit vectors. The code for the above example looks like this:
		\code
#inlcude <sdsl/vectors.hpp>
#inlcude <iostream>

using namespace std;
using namespace sdsl;

int main(){
	bit_vector b(14,0); // Create bit_vector of size 14, default value equals 0.
	b[1] = b[2] = b[9] = b[11] = b[13] = 1; // Set bits.
	rank_support_v<> rank_support(&b); // Create rank support for b.
	// Query rank support.
	for(size_t i=0; i<b.size(); ++i)
   		cout << "rank(b,"<< i << ") = " << rank_support.rank(i) <<endl;
}
		\endcode
This piece of code already shows that most of the data structures are conform with concepts of the  
<A HREF="http://www.sgi.com/tech/stl"> standard template library</a> (stl). E.g. 
\link sdsl::bit_vector bit_vector \endlink and \link sdsl::int_vector int_vector \endlink 
are stl 
 <A HREF="http://www.sgi.com/tech/stl/RandomAccessContainer.html">random access container</A>
compliant.


The library not only contains basic data structures. We also provide advanced data structures like
compressed suffix arrays (e.g. \link sdsl::csa_sada_prac \endlink) and compressed suffix trees 
(e.g. \link sdsl::cst_sct, sdsl::cst_sct2, sdsl::cst_sct3, sdsl::cst_sada \endlink).
Most data structures are speed optimized. For example our implementation of 
 Sadakane's suffix array is up to 50 percent faster on iterating through all its elements
as the original  
implementation of Sadakane from the <A HREF="http://pizzachili.dcc.uchile.cl">pizza and chili website</A>.



\ref install_page \n
\ref data_structure_page \n
\ref algorithms_page \n
\ref coders_page \n
\ref bitmagic_page \n
\ref tests_page \n

\page install_page Installation
\section install Installation

After you have downloaded the package \p sdsl-0.6.tar.gz . Unpack the archive
\code
tar -xvzf sdsl-0.6.tar.gz
\endcode 
Change to the \p sdsl-0.6/  directory where you can make the library with the following commands (replace \p /path/to/install and \p /path/to/install/exec  with the path you would like to install the library). We use the boost test library for the self tests of the library. You could specifiy if you would like to include these tests with the argument \p enable-unittest :
\code
./configure --prefix=/path/to/install/ --exec-prefix=/path/to/install/exec --enable-unittest=yes|no
\endcode

\note If you don't have installed the <A HREF="http://www.boost.org">boost test library</A> (version >= 1.35.0 ), you should 
      set the option \p --enable-unittest=no  when calling the \p ./configure command. 

You could make and install the library with the following command:
\code
make install
\endcode

You will find the executables for the exmaple programs in the directory \p /path/to/install/share/bin/example . The header files
will be installed in the directory \p /path/to/install/include/sdsl and the library will be located at 
\p /path/to/install/exec/lib/ . 

\section comp_you_progs_sec Writing and compiling your own programs

First, include the desired sdsl header(s). See the file list for details about the headers.
\code
#include <sdsl/vectors.hpp>
\endcode

Second, you will either have to import the namespace \p sdsl 
\code
using namespace sdsl;
\endcode
or use the namespace prefix \p sdsl for every element. Let's write some code:
\code
int main(){
	int_vector<> iv(10);
  	for(size_t i=0; i < iv.size(); ++i)
		iv[i] = i;
}
\endcode

The last step is the compilation of your program. You could compile it with the following options.
\code
g++ <your-program-name>.cpp  -I/path/to/install/include  -o <your-program-name> /path/to/install/exec/lib/libsdsl-1.0.a 
\endcode

\page data_structure_page Data Structures	  
		
\section data_sec Data structures

\subsection vector_sec Vectors
		<table>
			<tr><td>Class</td><td>mutable</td><td>stl concept</td><td>additional methods</td></tr>
			<tr><td>sdsl::bit_vector</td><td>yes</td><td>RandomAccessContainer</td><td>resize</td></tr>
			<tr><td>sdsl::int_vector</td><td>yes</td><td>RandomAccessContainer</td><td>resize</td></tr>
			<tr><td>sdsl::enc_vector</td><td>no </td><td>RandomAccessContainer</td><td>-</td></tr>
		</table>

\par Code example
		\code 
sdsl::bit_vector b; // create bit_vector of size 0
sdsl::int_vector<> v; // create int_vector of size 0
sdsl::int_vector<64> v64; // create vector with fixed integer width=64 and size 0
b.resize(10000); // resize b to 10000 elements = 10000 bits
// set all bits to zero
for(size_t i=0; i<b.size(); ++i)
	b[i] = 0;
v.setIntWidth(10);
v.resize(3);
v[0] = 135;
v64.resize(3);
v64[0] = 135;
if ( v[0] == v64[0] ){
	std::cout << "v[0] equals v64[0]" << std::endl;
}
		\endcode

\subsection comp_suffix_array_sec Compressed Suffix Arrays 		

<table>
	<tr><td>Class</td><td>mutable</td><td>stl concept</td><td>additional methods</td></tr>
	<tr><td>sdsl::csa_sada_theo</td><td>no</td><td>RandomAccessContainer</td><td>-</td></tr>
	<tr><td>sdsl::csa_sada_prac</td><td>no</td><td>RandomAccessContainer</td><td>-</td></tr>
</table>

\par Code example
\code
const char * text = "swissmissmissing";
// create compressed suffix array of the text
csa_sada_theo<> csa1(text);
cout << text << endl;
cout << "---" << endl;
cout << "   i SA[i] T_{SA[i]}" << endl;
// print out the result using the [] operator
for(size_t i=0; i<csa1.size(); ++i){
	cout<< setw(4) << i << " " << setw(5) <<csa1[i]<<" "<< text+csa1[i] <<endl;
}
cout<<endl;
\endcode

\subsection comp_suffix_trees_sec Compressed Suffix Trees
See the class group \ref cst for documentation of the implemented \f$\CST\f$s.

\page coders_page Self-delimiting coders		
\section coder_sec Coder 
We have implemented three coders for self-delimiting codes:
			- Elias \f$ \delta \f$ -coder (see sdsl::coder::elias_delta),
			- Fibonacci coder (see sdsl::coder::fibonacci), and
			- Ternary coder (see sdsl::coder::ternary).


Here are the code lengths needed to encode an integer \f$x\f$.
		<table>
			<tr><td>Coder</td><td>Size to represent x</td></tr>
			<tr><td>sds::coder::elias_delta</td><td>\f$\log x+2\log\log x\f$  </td></tr>
			<tr><td>sds::coder::fibonacci</td><td>\f$1+\log_{\Phi} x \approx 1+1.44\log x\f$  </td></tr>
			<tr><td>sds::coder::ternary</td><td>\f$2+\log_3{4}\log x \approx 2+1.26\log x\f$  </td></tr>
		</table>

\page algorithms_page Algorithms		
	\section algorithm_sec Algorithms	

\page bitmagic_page BitMagic	
	\section bit_magic_sec BitMagic 
		sdsl::bit_magic

\page tests_page Tests		
	\section Tests
		\subsection correctness_test Correctness Tests
		\subsection performance_test Performance Tests

*/
}
