Skip to content

Commit

Permalink
Removed testutils, removed get_-prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
simongog committed Mar 12, 2013
1 parent e6ba078 commit bfdc8a6
Show file tree
Hide file tree
Showing 27 changed files with 289 additions and 418 deletions.
4 changes: 2 additions & 2 deletions examples/hugepages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ using namespace std;

template<class tCsa>
void do_something(const tCsa &csa){
stop_watch sw;
util::stop_watch sw;
uint64_t sum=0;
sw.start();
for(size_t i=0; i<csa.size() and i<10000000;++i){
sum+=csa.psi(i);
}
sw.stop();
cout << sw.get_real_time() << endl;
cout << sw.real_time() << endl;
cout<<"sum="<<sum<<endl;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/import_non_sdsl_data2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char* argv[]){
util::load_vector_from_file(v, argv[1], 4);

cout << "v.size() = " << v.size() << endl;
cout << "v.get_int_width() = " << (int)v.get_int_width() << endl;
cout << "v.width() = " << (int)v.width() << endl;
cout << "v =";
size_t max_out = 10;
if ( argc > 2 ){
Expand Down
2 changes: 1 addition & 1 deletion examples/int_vector_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace sdsl;
int main(int argc, char* argv[]){
int_vector<> v;
util::load_from_file(v, argv[1]);
cout<<"loaded vector of size "<<v.size()<<" and "<<(int)v.get_int_width()<<"-bit integers from file";
cout<<"loaded vector of size "<<v.size()<<" and "<<(int)v.width()<<"-bit integers from file";
cout<<" "<<argv[1]<<endl;
if ( v.size() == 0 )
return 0;
Expand Down
44 changes: 31 additions & 13 deletions extras/cheatsheet/sdsl-cheatsheet.tex
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ \subsection{Dynamic vector}
\end{tabular}

\textit{Public~methods:} \code{operator[i]}, \code{resize(n)},
\code{}
\code{size()}, \code{data()}

\subsection{Manipulating vectors}
\code{util::set\_random\_bits(v)}
Expand Down Expand Up @@ -323,17 +323,19 @@ \subsection{Compressed Suffix Trees (CST)}
\code{child(v,c)}, \code{edge(v, d)}, \code{lca(v,w)},
\code{depth(v)}, \code{node\_depth}, \code{sl(v)},
\code{wl(v,c)}, \code{sn(v)}, \code{id(v)}, \code{inv\_id(i)},
\code{node(lb, rb)}.\\
\code{node(lb, rb)}, \code{nodes()}, \code{size()},
\code{begin()}, \code{end()}, \code{begin\_bottom\_up()},
\code{end\_bottom\_up}.\\
\textit{Public~members:} \code{csa}, \code{lcp}.

\subsection{Range Minimum/Maximum Query (RMQ)}
\begin{tabular}{@{}ll@{}}
\href{\sdslgit/include/sdsl/rmq_support_sparse_table.hpp}{\sdslrmqsupportsparsetable} &
$n\Order{\log n}$ word structure.\\
$\Order{n \log^2 n}$.\\
\href{\sdslgit/include/sdsl/rmq_succinct_sada.hpp}{\sdslrmqsuccinctsada} &
$4n+o(n)$ bit \\
\href{\sdslgit/include/sdsl/rmq_succinct_sct.hpp}{\sdslrmqsuccinctsct} &
$2n+o(n)$ bit based on Super-Cartesian-Tree\\
$2n+o(n)$ bit \\
\end{tabular}

\section{Constructing data structures}
Expand Down Expand Up @@ -384,8 +386,8 @@ \subsection{Store \sdsl\ structures}


\section{Utility methods}
\code{util::get\_pid()}, % reomve get?
\code{util::get\_id()}, % remove get?
\code{util::pid()},
\code{util::id()},
\code{util::to\_string(x)},
\code{util::to\_latex\_string(x)}

Expand All @@ -404,14 +406,14 @@ \section{Construction}
\code{util::store\_to\_cache(x, key, config)}

\section{Helper}
\code{stop\_watch}\\
\code{util::stop\_watch}\\
\textit{Public methods:} \code{start()}, \code{stop()},
\code{get\_user\_time()}, % get rid of prefix "get_" ???
\code{get\_sys\_time()},
\code{get\_real\_time()},
\code{get\_abs\_user\_time()},
\code{get\_abs\_sys\_time()},
\code{get\_abs\_real\_time()},
\code{user\_time()},
\code{sys\_time()},
\code{real\_time()},
\code{abs\_user\_time()},
\code{abs\_sys\_time()},
\code{abs\_real\_time()},


\code{paths\_from\_config\_file(file, prefix)}
Expand All @@ -424,6 +426,22 @@ \section{Performance}
TODO: insert time space graph for different
construction processes.

\section{Bitmagic}
Let \code{x} be a 64-bit word. Positions in
$x$ start from $0$.
\settowidth{\MyLen}{\code{num\_bytes=1} }
\begin{tabular}{@{}p{\the\MyLen}%
@{}p{\linewidth-\the\MyLen}@{}}
%\begin{tabular}{@{}ll@{}}
\textit{Method} & \textit{Description} \\
\code{b1Cnt(x)} & Count the number of set bits in \code{x}.\\
\code{i1BP(x,i)} & Get the position of the $i$-th set bit in \code{x},
$i~\in~[0,\code{b1Cnt(x)}\!-\!1)$.
\end{tabular}

\section{Debugging}
Mention: gdb config file, verbose

\section{Acknowledgements}
Yuta Mori for implementing libdivsufsort, which
is used to construct SAs.
Expand Down
2 changes: 1 addition & 1 deletion include/sdsl/construct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ template<class Index>
void construct(Index& idx, const std::string &file, cache_config& config, uint8_t num_bytes, wt_tag){
int_vector<Index::alphabet_category::WIDTH> text;
util::load_vector_from_file(text, file, num_bytes);
std::string tmp_key = util::to_string(util::get_pid())+"_"+util::to_string(util::get_id());
std::string tmp_key = util::to_string(util::pid())+"_"+util::to_string(util::id());
std::string tmp_file_name = util::cache_file_name(tmp_key, config);
util::store_to_file(text, tmp_file_name);
util::clear(text);
Expand Down
2 changes: 1 addition & 1 deletion include/sdsl/lcp_support_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _lcp_support_tree
template<uint8_t int_width>
_lcp_support_tree(int_vector_file_buffer<int_width>& lcp_buf, const Cst* cst = NULL) {
m_cst = cst;
std::string id = util::to_string(util::get_pid())+"_"+util::to_string(util::get_id()).c_str() + "_fc_lcp";
std::string id = util::to_string(util::pid())+"_"+util::to_string(util::id()).c_str() + "_fc_lcp";
{
int_vector<int_width> temp_lcp;
algorithm::construct_first_child_lcp(lcp_buf, temp_lcp, (int_vector_size_type) 0);
Expand Down
4 changes: 2 additions & 2 deletions include/sdsl/lcp_support_tree2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class _lcp_support_tree2
int_vector_file_buffer<Cst::csa_type::alphabet_type::int_width>& bwt_buf,
const cst_type* cst = NULL) {
m_cst = cst;
std::string small_lcp_file_name = util::to_string(util::get_pid())+"_"+util::to_string(util::get_id()).c_str() + "_fc_lf_lcp_sml";
std::string big_lcp_file_name = util::to_string(util::get_pid())+"_"+util::to_string(util::get_id()).c_str() + "_fc_lf_lcp_big";
std::string small_lcp_file_name = util::to_string(util::pid())+"_"+util::to_string(util::id()).c_str() + "_fc_lf_lcp_sml";
std::string big_lcp_file_name = util::to_string(util::pid())+"_"+util::to_string(util::id()).c_str() + "_fc_lf_lcp_big";

algorithm::construct_first_child_and_lf_lcp<SampleDens>(lcp_buf, bwt_buf, small_lcp_file_name, big_lcp_file_name, m_big_lcp);
// construct wavelet tree huffman from file buffer
Expand Down
2 changes: 1 addition & 1 deletion include/sdsl/lcp_wt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ template<uint8_t width>
template<uint8_t int_width>
lcp_wt<width>::lcp_wt(int_vector_file_buffer<int_width>& lcp_buf)
{
std::string temp_file = "/tmp/lcp_sml" + util::to_string(util::get_pid()) + "_" + util::to_string(util::get_id()) ;// TODO: remove absolute file name
std::string temp_file = "/tmp/lcp_sml" + util::to_string(util::pid()) + "_" + util::to_string(util::id()) ;// TODO: remove absolute file name
// write_R_output("lcp","construct sml","begin");
typename int_vector<>::size_type l=0, max_l=0, big_sum=0, n = lcp_buf.int_vector_size;
{
Expand Down
4 changes: 2 additions & 2 deletions include/sdsl/temp_write_read_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class temp_write_read_buffer
m_buf = buffer_type(buf_size, 0, width); // initialize buffer
m_in_buf_idx = 0;
m_buf_cnt = 0;
m_file_name = dir + "temp_write_read_buffer_" + util::to_string(util::get_pid())+"_"
+ util::to_string(util::get_id())+"_"
m_file_name = dir + "temp_write_read_buffer_" + util::to_string(util::pid())+"_"
+ util::to_string(util::id())+"_"
+ util::to_string(m_buffer_id);
m_buffer_id++; // increase the object counter
m_output_exists = false;
Expand Down
24 changes: 13 additions & 11 deletions include/sdsl/test_index_performance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program. If not, see http://www.gnu.org/licenses/ .
*/
/*! \file test_index_performance.hpp
* \brief test_index_performance.hpp contains a set of functions which test the speed of operations of compressed suffix arrays and compressed suffix trees
* \brief test_index_performance.hpp contains a set of benchmark methods
* \author Simon Gog
*/
#ifndef INCLUDE_SDSL_TEST_INDEX_PERFORMANCE
Expand Down Expand Up @@ -270,16 +270,18 @@ void test_pattern_matching(const Csa& csa,
write_R_output("csa","extract patterns","begin",times,0);

size_type file_size = 0;
char* ccc = NULL;
if ((file_size=file::read_text(file_name, ccc)) == 0) {
throw std::logic_error("file " + std::string(file_name) + " has size 0 or could not be read");
}

for (size_type i=0; i<rands.size(); ++i) {
for (size_type j=rands[i]; j < rands[i] + pattern_len; ++j)
patterns[i*pattern_len + (j-rands[i])] = ccc[j];
}
delete [] ccc;
{
int_vector<8> text;
if ( util::load_vector_from_file(text, file_name, 1) ){
for (size_type i=0; i<rands.size(); ++i) {
for (size_type j=rands[i]; j < rands[i] + pattern_len; ++j)
patterns[i*pattern_len + (j-rands[i])] = text[j];
}
} else {
std::cerr << "ERROR: test_pattern_matching: could not open";
std::cerr << "file `" << file_name << "`" << std::endl;
}
}
write_R_output("csa","extract patterns","end",times,0);

size_type cnt=0;
Expand Down
163 changes: 0 additions & 163 deletions include/sdsl/testutils.hpp

This file was deleted.

Loading

0 comments on commit bfdc8a6

Please sign in to comment.