Programa para el testeo de las funciones.Para compilar o código example_ceo_model_fusion.cpp:
g++ -static -o example_ceo_model_fusion example_ceo_model_fusion.cpp -lpdsitmm -lpdsramm
Para executar o programa:
./example_ceo_model_fusion
Retornando por consola:
p: 0.01 BERm: 0.0002181
p: 0.011053 BERm: 0.000288983
p: 0.0122168 BERm: 0.000393016
p: 0.0135031 BERm: 0.000538433
p: 0.014925 BERm: 0.000689195
p: 0.0164965 BERm: 0.00087528
p: 0.0182335 BERm: 0.0014092
p: 0.0201534 BERm: 0.00174037
p: 0.0222754 BERm: 0.00221027
p: 0.0246209 BERm: 0.00279601
p: 0.0272134 BERm: 0.00384454
p: 0.0300788 BERm: 0.00586302
p: 0.033246 BERm: 0.00762195
p: 0.0367466 BERm: 0.00830793
p: 0.0406159 BERm: 0.0110913
p: 0.0448925 BERm: 0.014807
p: 0.0496195 BERm: 0.0192493
p: 0.0548442 BERm: 0.0213667
p: 0.060619 BERm: 0.032906
p: 0.0670019 BERm: 0.035873
p: 0.0740568 BERm: 0.0435874
p: 0.0818547 BERm: 0.0634263
p: 0.0904736 BERm: 0.0716778
p: 0.1 BERm: 0.0896057
example_ceo_model_fusion.png
Código example_ceo_model_fusion.cpp:
#include <Pds/Ra>
#include <Pds/It>
int main(void)
{
unsigned int L=100000;
double ps=0.5;
Pds::Vector f0={1,2,3,4,5};
Pds::Vector p;
unsigned int N=24;
Pds::Vector Rho=Pds::GeomSpace(0.01,0.1,N);
Pds::Vector BER(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];
Pds::Vector Us(L);
Us.FillRandC(ps);
U.MakeEmpty();
BER.SetRaw(n,Us.Xor(Unb).Mean());
Unb.MakeEmpty();
std::cout<<"p: "<<Rho[n]<<"\tBERm: "<<BER[n]<<"\n";
}
Pds::Octave::XLabel="Rho";
Pds::Octave::YLabel="BER";
Pds::Octave::Legend={"Rho","BER"};
Pds::Octave::Plot::LogLogXYXY(Rho,Rho,Rho,BER,"temporal.m","example_ceo_model_fusion.png");
return 0;
}
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 .