datasketches-cpp
Classes | Public Member Functions | List of all members
update_theta_sketch_alloc< Allocator > Class Template Reference

Update Theta sketch. More...

#include <theta_sketch.hpp>

Inheritance diagram for update_theta_sketch_alloc< Allocator >:
theta_sketch_alloc< std::allocator< uint64_t > > base_theta_sketch_alloc< std::allocator< uint64_t > >

Classes

class  builder
 Update Theta sketch builder. More...
 

Public Member Functions

 update_theta_sketch_alloc (const update_theta_sketch_alloc &other)=default
 Copy constructor. More...
 
 update_theta_sketch_alloc (update_theta_sketch_alloc &&other) noexcept=default
 Move constructor. More...
 
update_theta_sketch_allocoperator= (const update_theta_sketch_alloc &other)=default
 Copy assignment. More...
 
update_theta_sketch_allocoperator= (update_theta_sketch_alloc &&other)=default
 Move assignment. More...
 
virtual Allocator get_allocator () const
 
virtual bool is_empty () const
 
virtual bool is_ordered () const
 
virtual uint16_t get_seed_hash () const
 
virtual uint64_t get_theta64 () const
 
virtual uint32_t get_num_retained () const
 
uint8_t get_lg_k () const
 
resize_factor get_rf () const
 
void update (const std::string &value)
 Update this sketch with a given string. More...
 
void update (uint64_t value)
 Update this sketch with a given unsigned 64-bit integer. More...
 
void update (int64_t value)
 Update this sketch with a given signed 64-bit integer. More...
 
void update (uint32_t value)
 Update this sketch with a given unsigned 32-bit integer. More...
 
void update (int32_t value)
 Update this sketch with a given signed 32-bit integer. More...
 
void update (uint16_t value)
 Update this sketch with a given unsigned 16-bit integer. More...
 
void update (int16_t value)
 Update this sketch with a given signed 16-bit integer. More...
 
void update (uint8_t value)
 Update this sketch with a given unsigned 8-bit integer. More...
 
void update (int8_t value)
 Update this sketch with a given signed 8-bit integer. More...
 
void update (double value)
 Update this sketch with a given double-precision floating point value. More...
 
void update (float value)
 Update this sketch with a given floating point value. More...
 
void update (const void *data, size_t length)
 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_theta_sketch_alloc< Allocator > compact (bool ordered=true) const
 Converts this sketch to a compact sketch (ordered or unordered). More...
 
virtual iterator begin ()
 Iterator over hash values in this sketch. More...
 
virtual iterator end ()
 Iterator pointing past the valid range. More...
 
virtual const_iterator begin () const
 Const iterator over hash values in this sketch. More...
 
virtual const_iterator end () const
 Const iterator pointing past the valid range. More...
 
- Public Member Functions inherited from base_theta_sketch_alloc< std::allocator< uint64_t > >
double get_estimate () const
 
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) const
 Returns the approximate upper error bound given a number of standard deviations. More...
 
bool is_estimation_mode () const
 
double get_theta () const
 
virtual string< std::allocator< uint64_t > > to_string (bool print_items=false) const
 Provides a human-readable summary of this sketch as a string. More...
 

Detailed Description

template<typename Allocator = std::allocator<uint64_t>>
class datasketches::update_theta_sketch_alloc< Allocator >

Update Theta sketch.

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

Constructor & Destructor Documentation

◆ update_theta_sketch_alloc() [1/2]

update_theta_sketch_alloc ( const update_theta_sketch_alloc< Allocator > &  other)
default

Copy constructor.

Parameters
othersketch to be copied

◆ update_theta_sketch_alloc() [2/2]

update_theta_sketch_alloc ( update_theta_sketch_alloc< Allocator > &&  other)
defaultnoexcept

Move constructor.

Parameters
othersketch to be moved

Member Function Documentation

◆ operator=() [1/2]

update_theta_sketch_alloc& operator= ( const update_theta_sketch_alloc< Allocator > &  other)
default

Copy assignment.

Parameters
othersketch to be copied
Returns
reference to this sketch

◆ operator=() [2/2]

update_theta_sketch_alloc& operator= ( update_theta_sketch_alloc< Allocator > &&  other)
default

Move assignment.

Parameters
othersketch to be moved
Returns
reference to this sketch

◆ 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 base_theta_sketch_alloc< std::allocator< uint64_t > >.

◆ is_ordered()

bool is_ordered
virtual
Returns
true if retained entries are ordered

Implements base_theta_sketch_alloc< std::allocator< uint64_t > >.

◆ get_seed_hash()

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

Implements base_theta_sketch_alloc< std::allocator< uint64_t > >.

◆ get_theta64()

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

Implements base_theta_sketch_alloc< std::allocator< uint64_t > >.

◆ get_num_retained()

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

Implements base_theta_sketch_alloc< std::allocator< uint64_t > >.

◆ 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 &  value)

Update this sketch with a given string.

Parameters
valuestring to update the sketch with

◆ update() [2/12]

void update ( uint64_t  value)

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

Parameters
valueuint64_t to update the sketch with

◆ update() [3/12]

void update ( int64_t  value)

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

Parameters
valueint64_t to update the sketch with

◆ update() [4/12]

void update ( uint32_t  value)

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

For compatibility with Java implementation.

Parameters
valueuint32_t to update the sketch with

◆ update() [5/12]

void update ( int32_t  value)

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

For compatibility with Java implementation.

Parameters
valueint32_t to update the sketch with

◆ update() [6/12]

void update ( uint16_t  value)

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

For compatibility with Java implementation.

Parameters
valueuint16_t to update the sketch with

◆ update() [7/12]

void update ( int16_t  value)

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

For compatibility with Java implementation.

Parameters
valueint16_t to update the sketch with

◆ update() [8/12]

void update ( uint8_t  value)

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

For compatibility with Java implementation.

Parameters
valueuint8_t to update the sketch with

◆ update() [9/12]

void update ( int8_t  value)

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

For compatibility with Java implementation.

Parameters
valueint8_t to update the sketch with

◆ update() [10/12]

void update ( double  value)

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

For compatibility with Java implementation.

Parameters
valuedouble to update the sketch with

◆ update() [11/12]

void update ( float  value)

Update this sketch with a given floating point value.

For compatibility with Java implementation.

Parameters
valuefloat to update the sketch with

◆ update() [12/12]

void update ( const void *  data,
size_t  length 
)

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
datapointer to the data
lengthof the data in bytes

◆ compact()

compact_theta_sketch_alloc< 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

◆ begin() [1/2]

auto begin
virtual

Iterator over hash values in this sketch.

Returns
begin iterator

Implements theta_sketch_alloc< std::allocator< uint64_t > >.

◆ end() [1/2]

auto end
virtual

Iterator pointing past the valid range.

Not to be incremented or dereferenced.

Returns
end iterator

Implements theta_sketch_alloc< std::allocator< uint64_t > >.

◆ begin() [2/2]

auto begin
virtual

Const iterator over hash values in this sketch.

Returns
begin iterator

Implements theta_sketch_alloc< std::allocator< uint64_t > >.

◆ end() [2/2]

auto end
virtual

Const iterator pointing past the valid range.

Not to be incremented or dereferenced.

Returns
end iterator

Implements theta_sketch_alloc< std::allocator< uint64_t > >.


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