{
// printf("i = %lu, c = %c, sp = %lu, ep = %lu\n", i, pattern[i], sp, ep);
c = (int)pattern[--i];
- uint result = alphabetrank->rank(c,ep);
+ uint result = alphabetrank->rankLessThan(c,ep);
if (result == ~0u)
ep = 0;
else
// delete [] bwt;
//alphabetrank = new RLWaveletTree(bwt, n); // Deletes bwt!
// std::cerr << "heap usage: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
-// std::cerr << "max heap usage before WT: " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
+// std::cerr << "max heap usage before WT: " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
// HeapProfiler::ResetMaxHeapConsumption(); // FIXME remove
alphabet_mapper * am = new alphabet_mapper_none();
static_bitsequence_builder * bmb = new static_bitsequence_builder_rrr02(8); // FIXME samplerate?
-// static_bitsequence_builder * bmb = new static_bitsequence_builder_brw32(16); // FIXME samplerate?
wt_coder * wtc = new wt_coder_binary(bwt,n,am);
alphabetrank = new static_sequence_wvtree(bwt,n,wtc,bmb,am);
delete bmb;
bwt = 0; // already deleted
-// std::cerr << "heap usage: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
+// std::cerr << "heap usage after WT: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
// std::cerr << "max heap usage after WT: " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
}
// Build up arrays for text length and starting positions
// FIXME Temp, remove
- //BlockArray* textLength = new BlockArray(numberOfTexts, Tools::CeilLog2(maxTextLength));
BlockArray* textStartPos = new BlockArray(numberOfTexts, Tools::CeilLog2(this->n));
- //(*textLength)[0] = l;
(*textStartPos)[0] = 0;
// Construct samples
ulongmax--;
uint alphabetrank_i_tmp =0;
- //positions:
- for (ulong i=n-1;i<ulongmax;i--) { // TODO bad solution with ulongmax?
- // i substitutes SA->GetPos(i)
+ for (ulong i=n-1;i<ulongmax;i--) {
+ // i substitutes SA->GetPos(i)
x=(i==n-1)?0:i+1;
if (x % samplerate == 0 && posOfSuccEndmarker - x > samplerate) {
// Store text length and text start position:
if (textId < (DocId)numberOfTexts - 1)
{
- //(*textLength)[textId + 1] = posOfSuccEndmarker - x;
(*textStartPos)[textId + 1] = x; // x is the position of end-marker.
posOfSuccEndmarker = x;
}
// LF-mapping from '\0' does not work with this (pseudo) BWT (see details from Wolfgang's thesis).
p = textId; // Correct LF-mapping to the last char of the previous text.
}
- else
+ else // Now c != '\0', do LF-mapping:
p = C[c]+alphabetrank_i_tmp-1;
}
assert(textId == 0);
// FIXME Temp, remove
delete tmpSuffix;
delete positions;
-// delete textLength;
delete textStartPos;
+ // std::cerr << "heap usage before Doc: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
+
uint *tmp = new uint[numberOfTexts]; // FIXME Silly...
-// cout << "Doc: ";
for (unsigned i = 0; i < numberOfTexts; ++i)
{
tmp[i] = ((*endmarkerDocId)[i] + 1) % numberOfTexts;
- // cout << tmp[i] << ", ";
+// cout << tmp[i] << ",";
}
-// cout << endl;
+ cout << endl;
delete endmarkerDocId;
+
alphabet_mapper * am = new alphabet_mapper_none();
static_bitsequence_builder * bmb = new static_bitsequence_builder_brw32(16); // FIXME samplerate?
- wt_coder * wtc = new wt_coder_binary(tmp, numberOfTexts, am);
- Doc = new static_sequence_wvtree(tmp, numberOfTexts, wtc, bmb, am);
+ Doc = new static_sequence_wvtree_noptrs(tmp, numberOfTexts, bmb, am);
delete bmb;
delete [] tmp;
- /* document_result res = Doc->access(1, 2, 0, 1);
- cout << "result: ";
+// std::cerr << "heap usage after Doc: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " Mbytes" << std::endl;
+
+ /*document_result res = Doc->access(3, 3, 0, 3);
+ cout << "Access result: ";
for (document_result::iterator it = res.begin(); it != res.end(); ++it)
cout << *it << ", ";
- cout << endl;*/
+ cout << endl;
+ exit(0);*/
}