Home | Develop | Download | Contact
example_ceo_model_fusion2.cpp

Programa para el testeo de las funciones.Para compilar o código example_ceo_model_fusion2.cpp:

g++ -static -o example_ceo_model_fusion2 example_ceo_model_fusion2.cpp -lpdsitmm -lpdsramm

Para executar o programa:

./example_ceo_model_fusion2

Retornando por consola:

p: 0.02 BERm: 1.465e-05
p: 0.0230044    BERm: 2.21948e-05
p: 0.02646      BERm: 3.31812e-05
p: 0.0304348    BERm: 4.9274e-05
p: 0.0350066    BERm: 7.09546e-05
p: 0.0402652    BERm: 0.000113173
p: 0.0463138    BERm: 0.000190696
p: 0.0532709    BERm: 0.000262207
p: 0.0612731    BERm: 0.000372334
p: 0.0704774    BERm: 0.000605043
p: 0.0810644    BERm: 0.000995296
p: 0.0932417    BERm: 0.00132375
p: 0.107248     BERm: 0.00179368
p: 0.123359     BERm: 0.00319277
p: 0.141889     BERm: 0.00507655
p: 0.163204     BERm: 0.00657427
p: 0.18772      BERm: 0.00890832
p: 0.215919     BERm: 0.0131849
p: 0.248353     BERm: 0.0164161
p: 0.28566      BERm: 0.0278257
p: 0.328572     BERm: 0.037707
p: 0.377929     BERm: 0.0499623
p: 0.4347       BERm: 0.0689483
p: 0.5  BERm: 0.08
example_ceo_model_fusion2.png

Código example_ceo_model_fusion2.cpp:

#include <Pds/Ra>
#include <Pds/It>
int main(void)
{
unsigned int L=100000;
// Dados do canal
double ps=0.5;
Pds::Vector f0={0.2,0.4,0.6,0.8,1};
Pds::Vector p;
Pds::Vector p_exp;
unsigned int N=24;
Pds::Vector Rho=Pds::GeomSpace(0.02,0.5,N);
Pds::Vector BER(N);
Pds::Vector BERhcond(N);
for(unsigned int n=0;n<N;n++)
{
if(n==0) L=200/1.0e-5;
else L=200/BER[n-1];
p=f0*Rho[n];
// Source Us
Pds::Vector Us(L);
Us.FillRandC(ps);
// Input channel U
Pds::Matrix U=Pds::ChannelModel::Bsc(Us,p,p_exp);
// Second fusion method: NaiveBayes
Pds::Vector Unb=Pds::Ceo::Binary::Fusion::NaiveBayes(ps,p_exp,U);
U.MakeEmpty();
// BER
BER.SetRaw(n,Us.Xor(Unb).Mean());
Unb.MakeEmpty();
// BERhcond
BERhcond.SetRaw(n,Pds::HbInv(H));
std::cout<<"p: "<<Rho[n]<<"\tBERm: "<<BER[n]<<"\n";
}
Pds::Octave::XLabel="Rho";
Pds::Octave::YLabel="BER";
Pds::Octave::Legend={"P(Hcond)","BER"};
Pds::Octave::Plot::LogLogXYXY(Rho,BERhcond,Rho,BER,"temporal.m","example_ceo_model_fusion2.png");
return 0;
}
double HcUsOmegaM(const Pds::Vector &p, double ps)
Encuentra la entropia condicionada. .
Pds::Vector NaiveBayes(double ps, Pds::Vector p, const Pds::Matrix &U, double Umbral=0.5)
Retorna una aproximación del vector a partir de las muestras en .
Pds::Matrix Bsc(const Pds::Vector &Us, const Pds::Vector &p)
Retorna el resultado de passar un vector por un banco de canales BSC de probabilidades .

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed