exit.cpp
Go to the documentation of this file.
#include <itpp/comm/exit.h>
#include <itpp/stat/histogram.h> //histogram class for mutual information computation
#include <itpp/base/itcompat.h>
namespace itpp
{
double EXIT::Gaussian_Fct::operator()(double x) const
{
return (1.0/std::sqrt(_sigma*itpp::m_2pi))*std::exp(-itpp::sqr(x-(_sigma/2.0))/(2.0*_sigma))*::log2(1+std::exp(-x));
}
double EXIT::extrinsic_mutual_info(const itpp::vec &obs, const itpp::bvec &cond, const int &N)
{
//initialize histogram
itpp::Histogram<double> hist(itpp::min(obs), itpp::max(obs), N);//common definition interval for both PDFs
//conditional PDF knowing that a bit of 0 was emitted
itpp::ivec idx = itpp::find(cond==itpp::bin(0));
itpp::vec cond_obs = obs(idx);
hist.reset();//start counting
hist.update(cond_obs);
itpp::vec left_pdf = hist.get_pdf();//the pdf is computed without taking into account the interval length (step)
itpp::ivec left_int = itpp::find(left_pdf!=0);//integration interval for the left PDF
//conditional PDF knowing that a bit of 1 was emitted
idx = itpp::find(cond==itpp::bin(1));
cond_obs = obs(idx);
hist.reset();//restart counting
hist.update(cond_obs);
itpp::vec right_pdf = hist.get_pdf();
itpp::ivec right_int = itpp::find(right_pdf!=0);//integration interval for the right PDF
//mutual extrinsic information
itpp::vec left_half = itpp::elem_mult(left_pdf(left_int), itpp::log2(itpp::elem_div(2.0*left_pdf(left_int), left_pdf(left_int)+right_pdf(left_int))));
double IE = itpp::sum(left_half)-0.5*(left_half(0)+left_half(left_half.length()-1));//numerical integration without taking into account the inteval length (see conditional PDF computation)
itpp::vec right_half = itpp::elem_mult(right_pdf(right_int), itpp::log2(itpp::elem_div(2.0*right_pdf(right_int), left_pdf(right_int)+right_pdf(right_int))));
IE += itpp::sum(right_half)-0.5*(right_half(0)+right_half(right_half.length()-1));//numerical integration
IE *= 0.5;
return IE;
}
}//namespace itpp
itpp::elem_div
Mat< Num_T > elem_div(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise division of two matrices.
Definition: mat.h:1688
itpp::m_2pi
const double m_2pi
Constant 2*Pi.
Definition: misc.h:106
itpp::Histogram
Histogram computation class.
Definition: histogram.h:75
itpp::find
ivec find(const bvec &invector)
Return a integer vector with indicies where bvec == 1.
Definition: specmat.cpp:40
itpp::elem_mult
Mat< Num_T > elem_mult(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise multiplication of two matrices.
Definition: mat.h:1582
itpp::Histogram::update
void update(Num_T value)
Histogram update.
Definition: histogram.h:164
itpp::sum
T sum(const Vec< T > &v)
Sum of all elements in the vector.
Definition: matfunc.h:59
itpp::min
T min(const Vec< T > &in)
Minimum value of vector.
Definition: min_max.h:125
itpp::exp
vec exp(const vec &x)
Exp of the elements of a vector x.
Definition: log_exp.h:155
itpp::log2
vec log2(const vec &x)
log-2 of the elements
Definition: log_exp.cpp:36
itpp::max
T max(const Vec< T > &v)
Maximum value of vector.
Definition: min_max.h:45
itpp::EXIT::extrinsic_mutual_info
double extrinsic_mutual_info(const itpp::vec &obs, const itpp::bvec &cond, const int &N=100)
Computes the extrinsic mutual information.
Definition: exit.cpp:40
exit.h
Definitions for EXtrinsic Information Transfer (EXIT) chart class.
itpp::Histogram::get_pdf
vec get_pdf() const
Experimental Probability Density Function (PDF) computation.
Definition: histogram.h:201
itpp
itpp namespace
Definition: itmex.h:36
itcompat.h
IT++ compatibility types and functions.
itpp::sqr
vec sqr(const cvec &data)
Absolute square of elements.
Definition: elem_math.cpp:36
itpp::bin
Binary arithmetic (boolean) class.
Definition: binary.h:56
itpp::sqrt
vec sqrt(const vec &x)
Square root of the elements.
Definition: elem_math.h:123
histogram.h
Histogram class - header file.
itpp::Histogram::reset
void reset()
Bins reset, so accumulation can be restarted.
Definition: histogram.h:95

Generated on Thu Aug 20 2015 21:02:50 for IT++ by Doxygen 1.8.9.1