SZaru::TopEstimator< Value > Class Template Reference

Statistical samplings that record the 'top N' data items. More...

#include <szaru.h>

List of all members.

Classes

struct  Elem
 Combination of a value & weight. More...

Public Member Functions

virtual void AddElem (const std::string &elm)=0
 Add a new element to this entry.
virtual void AddWeightedElem (const std::string &elem, Value weight)=0
 Add a new element with weight to this entry.
virtual void Estimate (std::vector< Elem > &topElems)=0
 Estimate the number of top entries.
virtual uint64_t TotElems () const =0
 Get the number of elements added to this entry in the table.
template<>
TopEstimator< int32_t > * Create (uint32_t numTops)
template<>
TopEstimator< int64_t > * Create (uint32_t numTops)
template<>
TopEstimator< double > * Create (uint32_t numTops)

Static Public Member Functions

static TopEstimatorCreate (uint32_t numTops)
 Create a TopEstimator object.

Detailed Description

template<typename Value>
class SZaru::TopEstimator< Value >

Statistical samplings that record the 'top N' data items.

Note: Currently only 3 types (int32_t, int64_t, double) can be set to Value template.

Statistical samplings that record the 'top N' data items based on CountSketch algorithm from "Finding Frequent Items in Data Streams", Moses Charikar, Kevin Chen and Martin Farach-Colton, 2002.


Member Function Documentation

template<typename Value>
virtual void SZaru::TopEstimator< Value >::AddElem ( const std::string &  elm  )  [pure virtual]

Add a new element to this entry.

Parameters:
elm element to add
template<typename Value>
virtual void SZaru::TopEstimator< Value >::AddWeightedElem ( const std::string &  elem,
Value  weight 
) [pure virtual]

Add a new element with weight to this entry.

Parameters:
elm element to add
weight weight of element
template<typename Value>
static TopEstimator* SZaru::TopEstimator< Value >::Create ( uint32_t  numTops  )  [static]

Create a TopEstimator object.

Parameters:
numTops number of top elements to be estimate.
template<typename Value>
virtual void SZaru::TopEstimator< Value >::Estimate ( std::vector< Elem > &  topElems  )  [pure virtual]

Estimate the number of top entries.

Parameters:
topElems estimated top entries
template<typename Value>
virtual uint64_t SZaru::TopEstimator< Value >::TotElems (  )  const [pure virtual]

Get the number of elements added to this entry in the table.

Returns:
the number of added elements

The documentation for this class was generated from the following file:
 All Classes Functions
Generated on Sat Nov 13 18:14:59 2010 for SZaru by  doxygen 1.6.3