datasketches-cpp
Classes | Public Member Functions | List of all members
update_tuple_sketch< Summary, Update, Policy, Allocator > Class Template Reference

Update Tuple sketch. More...

#include <tuple_sketch.hpp>

Inheritance diagram for update_tuple_sketch< Summary, Update, Policy, Allocator >:
tuple_sketch< Summary, std::allocator< Summary > >

Classes

class  builder
 Update Tuple sketch builder. More...
 

Public Member Functions

virtual Allocator get_allocator () const
 
virtual bool is_empty () const
 
virtual bool is_ordered () const
 
virtual uint64_t get_theta64 () const
 
virtual uint32_t get_num_retained () const
 
virtual uint16_t get_seed_hash () const
 
uint8_t get_lg_k () const
 
resize_factor get_rf () const
 
template<typename FwdUpdate >
void update (const std::string &key, FwdUpdate &&value)
 Update this sketch with a given string. More...
 
template<typename FwdUpdate >
void update (uint64_t key, FwdUpdate &&value)
 Update this sketch with a given unsigned 64-bit integer. More...
 
template<typename FwdUpdate >
void update (int64_t key, FwdUpdate &&value)
 Update this sketch with a given signed 64-bit integer. More...
 
template<typename FwdUpdate >
void update (uint32_t key, FwdUpdate &&value)
 Update this sketch with a given unsigned 32-bit integer. More...
 
template<typename FwdUpdate >
void update (int32_t key, FwdUpdate &&value)
 Update this sketch with a given signed 32-bit integer. More...
 
template<typename FwdUpdate >
void update (uint16_t key, FwdUpdate &&value)
 Update this sketch with a given unsigned 16-bit integer. More...
 
template<typename FwdUpdate >
void update (int16_t key, FwdUpdate &&value)
 Update this sketch with a given signed 16-bit integer. More...
 
template<typename FwdUpdate >
void update (uint8_t key, FwdUpdate &&value)
 Update this sketch with a given unsigned 8-bit integer. More...
 
template<typename FwdUpdate >
void update (int8_t key, FwdUpdate &&value)
 Update this sketch with a given signed 8-bit integer. More...
 
template<typename FwdUpdate >
void update (double key, FwdUpdate &&value)
 Update this sketch with a given double-precision floating point value. More...
 
template<typename FwdUpdate >
void update (float key, FwdUpdate &&value)
 Update this sketch with a given floating point value. More...
 
template<typename FwdUpdate >
void update (const void *key, size_t length, FwdUpdate &&value)
 Update this sketch with given data of any type. More...
 
void trim ()
 Remove retained entries in excess of the nominal size k (if any)
 
void reset ()
 Reset the sketch to the initial empty state.
 
compact_tuple_sketch< Summary, Allocator > compact (bool ordered=true) const
 Converts this sketch to a compact sketch (ordered or unordered). More...
 
template<typename Predicate >
compact_tuple_sketch< Summary, Allocator > filter (const Predicate &predicate) const
 Produces a Compact Tuple sketch from this sketch by applying a given predicate to each entry. More...
 
virtual iterator begin ()
 Iterator over entries in this sketch. More...
 
virtual iterator end ()
 Iterator pointing past the valid range. More...
 
virtual const_iterator begin () const
 Const iterator over entries in this sketch. More...
 
virtual const_iterator end () const
 Const iterator pointing past the valid range. More...
 
- Public Member Functions inherited from tuple_sketch< Summary, std::allocator< Summary > >
double get_estimate () const
 
double get_lower_bound (uint8_t num_std_devs, uint32_t num_subset_entries) const
 Returns the approximate lower error bound given a number of standard deviations over an arbitrary number of items stored in the sketch. More...
 
double get_lower_bound (uint8_t num_std_devs) const
 Returns the approximate lower error bound given a number of standard deviations. More...
 
double get_upper_bound (uint8_t num_std_devs, uint32_t num_subset_entries) const
 Returns the approximate upper error bound given a number of standard deviations over an arbitrary number of items stored in the sketch. More...
 
double get_upper_bound (uint8_t num_std_devs) const
 Returns the approximate upper error bound given a number of standard deviations. More...
 
bool is_estimation_mode () const
 
double get_theta () const
 
string< std::allocator< Summary > > to_string (bool print_items=false) const
 Provides a human-readable summary of this sketch as a string. More...
 

Detailed Description

template<typename Summary, typename Update = Summary, typename Policy = default_tuple_update_policy<Summary, Update>, typename Allocator = std::allocator<Summary>>
class datasketches::update_tuple_sketch< Summary, Update, Policy, Allocator >

Update Tuple sketch.

The purpose of this class is to build a Tuple sketch from input data via the update() methods. There is no constructor. Use builder instead.

Member Function Documentation

◆ get_allocator()

A get_allocator
virtual

◆ is_empty()

bool is_empty
virtual
Returns
true if this sketch represents an empty set (not the same as no retained entries!)

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ is_ordered()

bool is_ordered
virtual
Returns
true if retained entries are ordered

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ get_theta64()

uint64_t get_theta64
virtual
Returns
theta as a positive integer between 0 and LLONG_MAX

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ get_num_retained()

uint32_t get_num_retained
virtual
Returns
the number of retained entries in the sketch

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ get_seed_hash()

uint16_t get_seed_hash
virtual
Returns
hash of the seed that was used to hash the input

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ get_lg_k()

uint8_t get_lg_k
Returns
configured nominal number of entries in the sketch

◆ get_rf()

auto get_rf
Returns
configured resize factor of the sketch

◆ update() [1/12]

void update ( const std::string &  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given string.

Parameters
keystring to update the sketch with
valueto update the sketch with

◆ update() [2/12]

void update ( uint64_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given unsigned 64-bit integer.

Parameters
keyuint64_t to update the sketch with
valueto update the sketch with

◆ update() [3/12]

void update ( int64_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given signed 64-bit integer.

Parameters
keyint64_t to update the sketch with
valueto update the sketch with

◆ update() [4/12]

void update ( uint32_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given unsigned 32-bit integer.

For compatibility with Java implementation.

Parameters
keyuint32_t to update the sketch with
valueto update the sketch with

◆ update() [5/12]

void update ( int32_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given signed 32-bit integer.

For compatibility with Java implementation.

Parameters
keyint32_t to update the sketch with
valueto update the sketch with

◆ update() [6/12]

void update ( uint16_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given unsigned 16-bit integer.

For compatibility with Java implementation.

Parameters
keyuint16_t to update the sketch with
valueto update the sketch with

◆ update() [7/12]

void update ( int16_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given signed 16-bit integer.

For compatibility with Java implementation.

Parameters
keyint16_t to update the sketch with
valueto update the sketch with

◆ update() [8/12]

void update ( uint8_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given unsigned 8-bit integer.

For compatibility with Java implementation.

Parameters
keyuint8_t to update the sketch with
valueto update the sketch with

◆ update() [9/12]

void update ( int8_t  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given signed 8-bit integer.

For compatibility with Java implementation.

Parameters
keyint8_t to update the sketch with
valueto update the sketch with

◆ update() [10/12]

void update ( double  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given double-precision floating point value.

For compatibility with Java implementation.

Parameters
keydouble to update the sketch with
valueto update the sketch with

◆ update() [11/12]

void update ( float  key,
FwdUpdate &&  value 
)
inline

Update this sketch with a given floating point value.

For compatibility with Java implementation.

Parameters
keyfloat to update the sketch with
valueto update the sketch with

◆ update() [12/12]

void update ( const void *  key,
size_t  length,
FwdUpdate &&  value 
)

Update this sketch with given data of any type.

This is a "universal" update that covers all cases above, but may produce different hashes. Be very careful to hash input values consistently using the same approach both over time and on different platforms and while passing sketches between C++ environment and Java environment. Otherwise two sketches that should represent overlapping sets will be disjoint For instance, for signed 32-bit values call update(int32_t) method above, which does widening conversion to int64_t, if compatibility with Java is expected

Parameters
keypointer to the data
lengthof the data in bytes
valueto update the sketch with

◆ compact()

compact_tuple_sketch< S, A > compact ( bool  ordered = true) const

Converts this sketch to a compact sketch (ordered or unordered).

Parameters
orderedoptional flag to specify if an ordered sketch should be produced
Returns
compact sketch

◆ filter()

compact_tuple_sketch<Summary, Allocator> filter ( const Predicate &  predicate) const

Produces a Compact Tuple sketch from this sketch by applying a given predicate to each entry.

Parameters
predicateshould return true for the entries to keep
Returns
compact sketch with the entries retained according to the predicate

◆ begin() [1/2]

auto begin
virtual

Iterator over entries in this sketch.

Returns
begin iterator

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ end() [1/2]

auto end
virtual

Iterator pointing past the valid range.

Not to be incremented or dereferenced.

Returns
end iterator

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ begin() [2/2]

auto begin
virtual

Const iterator over entries in this sketch.

Returns
begin const iterator

Implements tuple_sketch< Summary, std::allocator< Summary > >.

◆ end() [2/2]

auto end
virtual

Const iterator pointing past the valid range.

Not to be incremented or dereferenced.

Returns
end const iterator

Implements tuple_sketch< Summary, std::allocator< Summary > >.


The documentation for this class was generated from the following files: