本文整理汇总了C++中libmaus::autoarray::AutoArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoArray::size方法的具体用法?C++ AutoArray::size怎么用?C++ AutoArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libmaus::autoarray::AutoArray
的用法示例。
在下文中一共展示了AutoArray::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tptr
package_type * getPackage()
{
libmaus::parallel::ScopePosixSpinLock llock(lock);
if ( ! freelistFill )
{
uint64_t const newlistsize = packages.size() ? 2*packages.size() : 1;
libmaus::autoarray::AutoArray<package_ptr_type> newpackages(newlistsize);
libmaus::autoarray::AutoArray<package_type *> newfreelist(newlistsize);
for ( uint64_t i = 0; i < packages.size(); ++i )
{
newpackages[i] = UNIQUE_PTR_MOVE(packages[i]);
}
for ( uint64_t i = packages.size(); i < newpackages.size(); ++i )
{
package_ptr_type tptr(new package_type);
newpackages[i] = UNIQUE_PTR_MOVE(tptr);
newfreelist[freelistFill++] = newpackages[i].get();
}
packages = newpackages;
freelist = newfreelist;
}
return freelist[--freelistFill];
}
示例2: operator
void operator()(CompactFastQContainerDictionaryCreator::codelenrun_type const rt, uint64_t const codelen)
{
if ( rt == codelenrun_first )
{
if ( shortptr >= shortthres )
{
numlong++;
shortptr = 0;
}
longptr += codelen;
shortptr += codelen;
numshort++;
}
else
{
if ( shortptr >= shortthres )
{
assert ( longidx < longptrs.size() );
desigwc.writeBit(longidx != 0);
longptrs[longidx++] = longptr;
shortptr = 0;
}
else
{
desigwc.writeBit(0);
}
assert ( shortidx < shortptrs.size() );
shortptrs[shortidx++] = shortptr;
longptr += codelen;
shortptr += codelen;
}
}
示例3: serialise
void serialise(stream_type & stream) const
{
::libmaus::util::NumberSerialisation::serialiseNumber(stream,D.size());
for ( uint64_t i = 0; i < D.size(); ++i )
::libmaus::util::NumberSerialisation::serialiseNumber(stream,D[i]);
}
示例4: merge
void merge(DArray const & o)
{
if ( o.D.size() != D.size() )
{
::libmaus::exception::LibMausException se;
se.getStream() << "DArray::merge(): array sizes are not compatible." << std::endl;
se.finish();
throw se;
}
for ( uint64_t i = 0; i < D.size(); ++i )
D[i] += o.D[i];
}
示例5: computeSegmentAccu
::libmaus::autoarray::AutoArray< std::pair<uint64_t,uint64_t> > computeSegmentAccu()
{
uint64_t const numint = index.size();
::libmaus::autoarray::AutoArray<uint64_t> preaccu(numint+1);
uint64_t k = 0;
for ( uint64_t i = 0; i < index.size(); ++i )
preaccu[k++] = index[i].size();
preaccu.prefixSums();
::libmaus::autoarray::AutoArray< std::pair<uint64_t,uint64_t> > accu(numint);
for ( uint64_t i = 1; i < preaccu.size(); ++i )
accu[i-1] = std::pair<uint64_t,uint64_t>(
std::pair<uint64_t,uint64_t>(preaccu[i-1],preaccu[i])
);
return accu;
}
示例6: UNIQUE_PTR_MOVE
::libmaus::util::Histogram::unique_ptr_type libmaus::util::Utf8String::getHistogram(::libmaus::autoarray::AutoArray<uint8_t> const & A)
{
#if defined(_OPENMP)
uint64_t const numthreads = omp_get_max_threads();
#else
uint64_t const numthreads = 1;
#endif
::libmaus::autoarray::AutoArray<uint64_t> const partstarts = computePartStarts(A,numthreads);
uint64_t const numparts = partstarts.size()-1;
::libmaus::util::Histogram::unique_ptr_type hist(new ::libmaus::util::Histogram);
::libmaus::parallel::OMPLock lock;
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for ( int64_t t = 0; t < static_cast<int64_t>(numparts); ++t )
{
::libmaus::util::Histogram::unique_ptr_type lhist(new ::libmaus::util::Histogram);
uint64_t codelen = 0;
uint64_t const tcodelen = partstarts[t+1]-partstarts[t];
::libmaus::util::GetObject<uint8_t const *> G(A.begin()+partstarts[t]);
while ( codelen != tcodelen )
(*lhist)(::libmaus::util::UTF8::decodeUTF8(G,codelen));
lock.lock();
hist->merge(*lhist);
lock.unlock();
}
return UNIQUE_PTR_MOVE(hist);
}
示例7: operator
/**
* increment frequency of i by 1
*
* @param i index whose frequency is to be incremented
**/
void operator()(uint64_t const i)
{
if ( i < low.size() )
low[i]++;
else
all[i]++;
}
示例8: add
/**
* add v to frequency of i
*
* @param i index of value to increase
* @param v value to add
**/
void add(uint64_t const i, uint64_t const v)
{
if ( i < low.size() )
low[i] += v;
else
all[i] += v;
}
示例9: computeBlockIntervals
::libmaus::autoarray::AutoArray < std::pair<uint64_t,uint64_t> > computeBlockIntervals() const
{
uint64_t numblocks = 0;
for ( uint64_t i = 0; i < index.size(); ++i )
numblocks += index[i].size();
::libmaus::autoarray::AutoArray < uint64_t > lblocksizes = ::libmaus::autoarray::AutoArray < uint64_t >(numblocks+1);
uint64_t * outptr = lblocksizes.begin();
for ( uint64_t i = 0; i < blocksizes.size(); ++i )
for ( uint64_t j = 0; j < blocksizes[i].size(); ++j )
*(outptr++) = blocksizes[i][j];
lblocksizes.prefixSums();
::libmaus::autoarray::AutoArray < std::pair<uint64_t,uint64_t> > blockintervals(numblocks);
for ( uint64_t i = 1; i < lblocksizes.size(); ++i )
blockintervals[i-1] = std::pair<uint64_t,uint64_t>(lblocksizes[i-1],lblocksizes[i]);
return blockintervals;
}
示例10: createFinalStream
uint64_t createFinalStream(stream_type & out)
{
flush();
uint64_t p = 0;
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,symbols); // n
p += root->serialize(out); // huffman code tree
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,contexts.size()); // number of bit vectors
std::vector<uint64_t> nodeposvec;
for ( uint64_t i = 0; i < contexts.size(); ++i )
{
nodeposvec.push_back(p);
uint64_t const blockswritten = contexts[i]->blockswritten;
uint64_t const datawordswritten = 6*blockswritten;
uint64_t const allwordswritten = 8*blockswritten;
contexts[i].reset();
tmpcnt.closeOutputTempFile(i);
// bits written
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,64*datawordswritten);
// auto array header (words written)
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,allwordswritten);
//std::string const filename = outputfilenames[i];
//::libmaus::aio::CheckedInputStream istr(filename);
std::istream & istr = tmpcnt.openInputTempFile(i);
// std::ifstream istr(filename.c_str(),std::ios::binary);
// std::cerr << "Copying " << allwordswritten << " from stream " << filename << std::endl;
::libmaus::util::GetFileSize::copy (istr, out, allwordswritten, sizeof(uint64_t));
p += allwordswritten * sizeof(uint64_t);
tmpcnt.closeInputTempFile(i);
// remove(filename.c_str());
}
uint64_t const indexpos = p;
p += ::libmaus::util::NumberSerialisation::serialiseNumberVector(out,nodeposvec);
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,indexpos);
out.flush();
return p;
}
示例11: cleanup
void cleanup()
{
for ( uint64_t i = 0; i < alloclist.size(); ++i )
delete alloclist[i];
alloclist = libmaus::autoarray::AutoArray<element_type *>(0);
freelist = libmaus::autoarray::AutoArray<element_type *>(0);
freelistfill = 0;
}
示例12: compress
virtual size_t compress(char const * input, size_t inputLength, libmaus::autoarray::AutoArray<char> & output)
{
uint64_t compressBound = SnappyCompress::compressBound(inputLength);
if ( output.size() < compressBound )
output = libmaus::autoarray::AutoArray<char>(compressBound,false);
return SnappyCompress::rawcompress(input,inputLength,output.begin());
}
示例13: A
BamSeqEncodeTable()
: A(256)
{
char const * s = "=ACMGRSVTWYHKDBN";
for ( uint64_t i = 0; i < A.size(); ++i )
A[i] = strlen(s);
for ( uint64_t i = 0; i < strlen(s); ++i )
A [ s[i] ] = i;
}
示例14: flush
void flush()
{
for ( uint64_t i = 0; i < contexts.size(); ++i )
{
contexts[i]->writeBit(0);
contexts[i]->flush();
// std::cerr << "Flushed context " << i << std::endl;
}
}
示例15: tTi
BgzfDeflateParallel(std::ostream & rdeflateout, uint64_t const rnumthreads, uint64_t const rnumbuffers, int const level, std::ostream * rdeflateindexostr = 0)
: deflategloblist(), deflatecontext(deflategloblist,rdeflateout,rnumbuffers,level,BgzfDeflateParallelContext::getDefaultDeflateGetCur(),rdeflateindexostr), T(rnumthreads)
{
for ( uint64_t i = 0; i < T.size(); ++i )
{
BgzfDeflateParallelThread::unique_ptr_type tTi(new BgzfDeflateParallelThread(deflatecontext));
T[i] = UNIQUE_PTR_MOVE(tTi);
T[i]->start();
}
}