Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
error_metrics.hpp File Reference
#include <cassert>
#include <cmath>
#include <limits>
#include <vector>

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal

Functions

template<typename Real>
double sw::universal::rmse (const std::vector< Real > &src, const std::vector< Real > &dst)
 Root Mean Square Error between original and quantized vectors.
template<typename Real>
double sw::universal::snr (const std::vector< Real > &src, const std::vector< Real > &dst)
 Signal-to-Noise Ratio in dB: 10 * log10( E[x^2] / E[(x - Q(x))^2] ).
template<typename Real>
double sw::universal::qsnr (const std::vector< Real > &src, const std::vector< Real > &dst)
 Quantization Signal-to-Noise Ratio in dB QSNR = 10 * log10( signal_variance / noise_power ) where signal_variance = stddev^2 of the source and noise_power = E[(Q(x) - x)^2].
template<typename NumberType>
double sw::universal::rmse (const std::vector< double > &data)
 RMSE of quantizing data through NumberType.
template<typename NumberType>
double sw::universal::snr (const std::vector< double > &data)
 SNR (dB) of quantizing data through NumberType SNR = 10 * log10( E[x^2] / E[(x - Q(x))^2] ).
template<typename NumberType>
double sw::universal::qsnr (const std::vector< double > &data)
 QSNR (dB) of quantizing data through NumberType QSNR = 10 * log10( signal_variance / noise_power ).