casacore
Loading...
Searching...
No Matches
dyscostman::StochasticEncoder< ValueType >::Dictionary Class Reference

Public Types

typedef value_t * iterator
typedef const value_t * const_iterator

Public Member Functions

 Dictionary ()
 Dictionary (size_t size)
void reserve (size_t size)
void resize (size_t size)
const_iterator lower_bound (value_t val) const
 Returns an iterator pointing to the first element in the dictionary that is not less than (i.e.
const_iterator lower_bound_fast (value_t val) const
 Returns an iterator pointing to the first element in the dictionary that is not less than (i.e.
const_iterator lower_bound_slow (value_t val) const
 Below is the first failed result of an attempt to beat the STL in performance.
iterator begin ()
const_iterator begin () const
const_iterator end () const
symbol_t symbol (const_iterator iter) const
symbol_t largest_symbol () const
value_t value (const_iterator iter) const
value_t value (symbol_t sym) const
value_t largest_value () const
value_t smallest_value () const
size_t size () const
size_t capacity (size_t) const

Private Attributes

aocommon::UVector< value_t > _values

Detailed Description

template<typename ValueType = float>
class dyscostman::StochasticEncoder< ValueType >::Dictionary

Definition at line 152 of file stochasticencoder.h.

Member Typedef Documentation

◆ const_iterator

template<typename ValueType = float>
typedef const value_t* dyscostman::StochasticEncoder< ValueType >::Dictionary::const_iterator

Definition at line 155 of file stochasticencoder.h.

◆ iterator

template<typename ValueType = float>
typedef value_t* dyscostman::StochasticEncoder< ValueType >::Dictionary::iterator

Definition at line 154 of file stochasticencoder.h.

Constructor & Destructor Documentation

◆ Dictionary() [1/2]

template<typename ValueType = float>
dyscostman::StochasticEncoder< ValueType >::Dictionary::Dictionary ( )
inline

Definition at line 157 of file stochasticencoder.h.

References _values.

◆ Dictionary() [2/2]

template<typename ValueType = float>
dyscostman::StochasticEncoder< ValueType >::Dictionary::Dictionary ( size_t size)
inlineexplicit

Definition at line 159 of file stochasticencoder.h.

References _values, and size().

Member Function Documentation

◆ begin() [1/2]

template<typename ValueType = float>
iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::begin ( )
inline

Definition at line 232 of file stochasticencoder.h.

References _values.

Referenced by symbol().

◆ begin() [2/2]

template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::begin ( ) const
inline

Definition at line 233 of file stochasticencoder.h.

References _values.

◆ capacity()

template<typename ValueType = float>
size_t dyscostman::StochasticEncoder< ValueType >::Dictionary::capacity ( size_t ) const
inline

Definition at line 242 of file stochasticencoder.h.

References _values.

◆ end()

template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::end ( ) const
inline

Definition at line 234 of file stochasticencoder.h.

References _values.

◆ largest_symbol()

template<typename ValueType = float>
symbol_t dyscostman::StochasticEncoder< ValueType >::Dictionary::largest_symbol ( ) const
inline

Definition at line 236 of file stochasticencoder.h.

References _values.

◆ largest_value()

template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::largest_value ( ) const
inline

Definition at line 239 of file stochasticencoder.h.

References _values.

◆ lower_bound()

template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::lower_bound ( value_t val) const
inline

Returns an iterator pointing to the first element in the dictionary that is not less than (i.e.

greater or equal to) value.

This implementation is like lower_bound_fast(), but additionally assumes the dictionary has at least two elements, avoiding one comparison.

Definition at line 173 of file stochasticencoder.h.

References _values.

◆ lower_bound_fast()

template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::lower_bound_fast ( value_t val) const
inline

Returns an iterator pointing to the first element in the dictionary that is not less than (i.e.

greater or equal to) value.

This implementation turns out to be slightly faster than the STL implementation. It performs 10.7 MB/s, vs. 9.0 MB/s for the STL. 18% faster. Using "unsigned" instead of "size_t" is 5% slower. (It's not a fair STL comparison, because this implementation does not check for empty vector).

Definition at line 200 of file stochasticencoder.h.

References _values.

◆ lower_bound_slow()

template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::lower_bound_slow ( value_t val) const
inline

Below is the first failed result of an attempt to beat the STL in performance.

It turns out to be 13% slower for larger dictionaries, compared to the STL implementation that is used in the class above. It performs 7.9 MB/s. 26% compared to the 'fastest' lower_bound.

This is a bit inefficient, but (p + q)/2 was not allowed, because operator+(ptr,ptr) is not allowed.

Definition at line 218 of file stochasticencoder.h.

References _values.

◆ reserve()

template<typename ValueType = float>
void dyscostman::StochasticEncoder< ValueType >::Dictionary::reserve ( size_t size)
inline

Definition at line 161 of file stochasticencoder.h.

References _values, and size().

◆ resize()

template<typename ValueType = float>
void dyscostman::StochasticEncoder< ValueType >::Dictionary::resize ( size_t size)
inline

Definition at line 163 of file stochasticencoder.h.

References _values, and size().

◆ size()

template<typename ValueType = float>
size_t dyscostman::StochasticEncoder< ValueType >::Dictionary::size ( ) const
inline

Definition at line 241 of file stochasticencoder.h.

References _values.

Referenced by Dictionary(), reserve(), and resize().

◆ smallest_value()

template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::smallest_value ( ) const
inline

Definition at line 240 of file stochasticencoder.h.

References _values.

◆ symbol()

template<typename ValueType = float>
symbol_t dyscostman::StochasticEncoder< ValueType >::Dictionary::symbol ( const_iterator iter) const
inline

Definition at line 235 of file stochasticencoder.h.

References begin().

◆ value() [1/2]

template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::value ( const_iterator iter) const
inline

Definition at line 237 of file stochasticencoder.h.

◆ value() [2/2]

template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::value ( symbol_t sym) const
inline

Definition at line 238 of file stochasticencoder.h.

References _values.

Member Data Documentation

◆ _values


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