datasketches-cpp
Loading...
Searching...
No Matches
compact_array_tuple_sketch< Array, Allocator > Class Template Reference

Compact array tuple sketch. More...

#include <array_tuple_sketch.hpp>

Inheritance diagram for compact_array_tuple_sketch< Array, Allocator >:
compact_tuple_sketch< Array, typename Array::allocator_type > tuple_sketch< Array, typename Array::allocator_type >

Public Member Functions

template<typename Sketch>
 compact_array_tuple_sketch (const Sketch &other, bool ordered=true)
 Copy constructor.
uint8_t get_num_values () const
void serialize (std::ostream &os) const
 This method serializes the sketch into a given stream in a binary form.
vector_bytes serialize (unsigned header_size_bytes=0) const
 This method serializes the sketch as a vector of bytes.
Public Member Functions inherited from compact_tuple_sketch< Array, typename Array::allocator_type >
 compact_tuple_sketch (const Base &other, bool ordered)
 Copy constructor.
compact_tuple_sketch & operator= (const compact_tuple_sketch &other)=default
 Copy assignment.
void serialize (std::ostream &os, const SerDe &sd=SerDe()) const
 This method serializes the sketch into a given stream in a binary form.
Public Member Functions inherited from tuple_sketch< Array, typename Array::allocator_type >
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.
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.
bool is_estimation_mode () const
double get_theta () const
string< typename Array::allocator_type > to_string (bool print_items=false) const
 Provides a human-readable summary of this sketch as a string.

Static Public Member Functions

static compact_array_tuple_sketch deserialize (std::istream &is, uint64_t seed=DEFAULT_SEED, const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given stream.
static compact_array_tuple_sketch deserialize (const void *bytes, size_t size, uint64_t seed=DEFAULT_SEED, const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given array of bytes.

Detailed Description

template<typename Array, typename Allocator = typename Array::allocator_type>
class datasketches::compact_array_tuple_sketch< Array, Allocator >

Compact array tuple sketch.

Constructor & Destructor Documentation

◆ compact_array_tuple_sketch()

template<typename Array, typename Allocator = typename Array::allocator_type>
template<typename Sketch>
compact_array_tuple_sketch ( const Sketch & other,
bool ordered = true )

Copy constructor.

Constructs a compact sketch from another sketch (update or compact)

Parameters
othersketch to be constructed from
orderedif true make the resulting sketch ordered

Member Function Documentation

◆ get_num_values()

template<typename Array, typename Allocator>
uint8_t get_num_values ( ) const
Returns
number of double values in array

◆ serialize() [1/2]

template<typename Array, typename Allocator>
void serialize ( std::ostream & os) const

This method serializes the sketch into a given stream in a binary form.

Parameters
osoutput stream

◆ serialize() [2/2]

template<typename Array, typename Allocator>
auto serialize ( unsigned header_size_bytes = 0) const

This method serializes the sketch as a vector of bytes.

An optional header can be reserved in front of the sketch. It is a blank space of a given size.

Parameters
header_size_bytesspace to reserve in front of the sketch
Returns
serialized sketch as a vector of bytes

◆ deserialize() [1/2]

template<typename Array, typename Allocator>
compact_array_tuple_sketch< Array, Allocator > deserialize ( std::istream & is,
uint64_t seed = DEFAULT_SEED,
const Allocator & allocator = Allocator() )
static

This method deserializes a sketch from a given stream.

Parameters
isinput stream
seedthe seed for the hash function that was used to create the sketch
allocatorinstance of an Allocator
Returns
an instance of the sketch

◆ deserialize() [2/2]

template<typename Array, typename Allocator>
compact_array_tuple_sketch< Array, Allocator > deserialize ( const void * bytes,
size_t size,
uint64_t seed = DEFAULT_SEED,
const Allocator & allocator = Allocator() )
static

This method deserializes a sketch from a given array of bytes.

Parameters
bytespointer to the array of bytes
sizethe size of the array
seedthe seed for the hash function that was used to create the sketch
allocatorinstance of an Allocator
Returns
an instance of the sketch

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