casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
dyscostman::StochasticEncoder< ValueType >::Dictionary Class Reference

Public Types

typedef value_titerator
 
typedef const value_tconst_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. More...
 
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. More...
 
const_iterator lower_bound_slow (value_t val) const
 Below is the first failed result of an attempt to beat the STL in performance. More...
 
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

ao::uvector< value_t_values
 

Detailed Description

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

Definition at line 161 of file stochasticencoder.h.

Member Typedef Documentation

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

Definition at line 164 of file stochasticencoder.h.

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

Definition at line 163 of file stochasticencoder.h.

Constructor & Destructor Documentation

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

Definition at line 166 of file stochasticencoder.h.

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

Definition at line 168 of file stochasticencoder.h.

Member Function Documentation

template<typename ValueType = float>
iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::begin ( )
inline
template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::begin ( ) const
inline
template<typename ValueType = float>
size_t dyscostman::StochasticEncoder< ValueType >::Dictionary::capacity ( size_t  ) const
inline
template<typename ValueType = float>
const_iterator dyscostman::StochasticEncoder< ValueType >::Dictionary::end ( ) const
inline
template<typename ValueType = float>
symbol_t dyscostman::StochasticEncoder< ValueType >::Dictionary::largest_symbol ( ) const
inline
template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::largest_value ( ) const
inline
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 182 of file stochasticencoder.h.

References dyscostman::StochasticEncoder< ValueType >::Dictionary::_values, and ao::uvector< Tp, Alloc >::size().

Referenced by dyscostman::StochasticEncoder< ValueType >::Encode(), and dyscostman::StochasticEncoder< ValueType >::EncodeWithDithering().

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 209 of file stochasticencoder.h.

References dyscostman::StochasticEncoder< ValueType >::Dictionary::_values, and ao::uvector< Tp, Alloc >::size().

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 227 of file stochasticencoder.h.

References dyscostman::StochasticEncoder< ValueType >::Dictionary::_values, ao::uvector< Tp, Alloc >::begin(), and ao::uvector< Tp, Alloc >::size().

template<typename ValueType = float>
void dyscostman::StochasticEncoder< ValueType >::Dictionary::reserve ( size_t  size)
inline
template<typename ValueType = float>
void dyscostman::StochasticEncoder< ValueType >::Dictionary::resize ( size_t  size)
inline
template<typename ValueType = float>
size_t dyscostman::StochasticEncoder< ValueType >::Dictionary::size ( ) const
inline
template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::smallest_value ( ) const
inline
template<typename ValueType = float>
symbol_t dyscostman::StochasticEncoder< ValueType >::Dictionary::symbol ( const_iterator  iter) const
inline
template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::value ( const_iterator  iter) const
inline
template<typename ValueType = float>
value_t dyscostman::StochasticEncoder< ValueType >::Dictionary::value ( symbol_t  sym) const
inline

Member Data Documentation

template<typename ValueType = float>
ao::uvector<value_t> dyscostman::StochasticEncoder< ValueType >::Dictionary::_values
private

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