unsigned numberOfTexts;
// Length of the longest text
ulong maxTextLength;
+ ulong numberOfSamples;
#ifdef TCB_TEST_BWT
DynFMI *dynFMI;
/**
* Init text collection
*
- * See CSA.h for more details.
*/
-TextCollectionBuilder::TextCollectionBuilder(unsigned samplerate)
+TextCollectionBuilder::TextCollectionBuilder(unsigned samplerate, ulong estimatedInputLength)
: p_(new struct TCBuilderRep())
{
p_->n = 0;
p_->samplerate = samplerate;
p_->numberOfTexts = 0;
+ p_->numberOfSamples = 0;
- // Current params: 8 bytes, 15 MB, no samples
- p_->sa = new CSA::RLCSABuilder(8, 0, 15 * 1024 * 1024);
+ // Current params: 8 bytes, no samples, buffer size n/10 bytes.
+ p_->sa = new CSA::RLCSABuilder(8, 0, estimatedInputLength/10);
assert(p_->sa->isOk());
#ifdef TCB_TEST_BWT
{
p_->n += m;
p_->numberOfTexts ++;
+ p_->numberOfSamples += (m-1)/p_->samplerate;
#ifdef TCB_TEST_BWT
p_->dynFMI->addText(text, m);
#endif
-
p_->sa->insertSequence((char*)text, m-1, 0);
assert(p_->sa->isOk());
}
for (ulong i = 0; i < p_->n; ++i)
if (bwt[i] != bwtTest[i])
{
- std::cout << "i = " << i << ", bwt = " << (unsigned)bwt[i] << ", " << (unsigned)bwtTest[i] << std::endl;
+ std::cout << "i = " << i << ", bwt = " << (unsigned)bwt[i] << ", "
+ << (unsigned)bwtTest[i] << std::endl;
assert(0);
}
delete [] bwtTest;
#endif // TCB_TEST_BWT
}
- TextCollection *result = new TCImplementation(bwt, (ulong)length, p_->samplerate, p_->numberOfTexts, p_->maxTextLength);
+ TextCollection *result = new TCImplementation(bwt, (ulong)length,
+ p_->samplerate, p_->numberOfTexts, p_->maxTextLength, p_->numberOfSamples);
return result;
}