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::WeightEncoder< T > Class Template Reference

Encoder for visibility weights. More...

#include <weightencoder.h>

Public Types

typedef T value_t
 Value type of the original weights (a floating point value). More...
 
typedef unsigned symbol_t
 Value type of the symbols to which the weights are encoded. More...
 

Public Member Functions

 WeightEncoder (unsigned quantCount)
 Construct a new encoder with the given quantization count. More...
 
void Encode (value_t &scaleVal, std::vector< symbol_t > &dest, const std::vector< value_t > &input) const
 Encodes a vector of values. More...
 
void Decode (std::vector< value_t > &dest, value_t scaleVal, const std::vector< symbol_t > &input) const
 Decode a previously encoded value. More...
 

Private Attributes

unsigned _quantCount
 

Detailed Description

template<typename T>
class dyscostman::WeightEncoder< T >

Encoder for visibility weights.

It's a linear quantizer for non-negative values, with a single scaling factor. The scaling factor will be such that the max value will still fit.

Author
André Offringa

Definition at line 16 of file weightencoder.h.

Member Typedef Documentation

template<typename T >
typedef unsigned dyscostman::WeightEncoder< T >::symbol_t

Value type of the symbols to which the weights are encoded.

Definition at line 21 of file weightencoder.h.

template<typename T >
typedef T dyscostman::WeightEncoder< T >::value_t

Value type of the original weights (a floating point value).

Definition at line 19 of file weightencoder.h.

Constructor & Destructor Documentation

template<typename T >
dyscostman::WeightEncoder< T >::WeightEncoder ( unsigned  quantCount)
inlineexplicit

Construct a new encoder with the given quantization count.

Parameters
quantCountThe number of quantization levels.

Definition at line 26 of file weightencoder.h.

Member Function Documentation

template<typename T >
void dyscostman::WeightEncoder< T >::Decode ( std::vector< value_t > &  dest,
value_t  scaleVal,
const std::vector< symbol_t > &  input 
) const
inline

Decode a previously encoded value.

Parameters
destThe destination for the decoded weight values.
scaleValThe scale value for the vector of values.
inputThe input symbols to be decoded.
See Also
Encode()

Definition at line 66 of file weightencoder.h.

References dyscostman::WeightEncoder< T >::_quantCount.

template<typename T >
void dyscostman::WeightEncoder< T >::Encode ( value_t scaleVal,
std::vector< symbol_t > &  dest,
const std::vector< value_t > &  input 
) const
inline

Encodes a vector of values.

Will return a vector of symbols and a scaling value. Together, these can be used to get the original values back (with some loss due to quantization), by using Decode().

Parameters
scaleValWill receive the scale value for the vector of values
destThe destinal vector with symbols. It is assumed that it is already of the right size, i.e., equal to input.size().
inputThe input array of values to be encoded.

Find max value (implicit assumption input is not empty)

Definition at line 37 of file weightencoder.h.

References dyscostman::WeightEncoder< T >::_quantCount.

Member Data Documentation

template<typename T >
unsigned dyscostman::WeightEncoder< T >::_quantCount
private

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