From: <gsa...@us...> - 2010-10-20 14:23:31
|
Revision: 354 http://stdair.svn.sourceforge.net/stdair/?rev=354&view=rev Author: gsabatier Date: 2010-10-20 14:23:22 +0000 (Wed, 20 Oct 2010) Log Message: ----------- First step in tutorial writting Modified Paths: -------------- trunk/stdair/doc/local/users_guide.doc trunk/stdair/doc/tutorial/sources.mk trunk/stdair/doc/tutorial/src/sources.mk trunk/stdair/doc/tutorial/tutorial.doc Added Paths: ----------- trunk/stdair/doc/tutorial/completeex.doc trunk/stdair/doc/tutorial/invobject.doc trunk/stdair/doc/tutorial/rootinvobject.doc trunk/stdair/doc/tutorial/rootobject.doc trunk/stdair/doc/tutorial/src/completeex.cpp trunk/stdair/doc/tutorial/src/completeex.ref trunk/stdair/doc/tutorial/src/invobject.cpp trunk/stdair/doc/tutorial/src/invobject.ref trunk/stdair/doc/tutorial/src/rootinvobject.cpp trunk/stdair/doc/tutorial/src/rootinvobject.ref trunk/stdair/doc/tutorial/src/rootobject.cpp trunk/stdair/doc/tutorial/src/rootobject.ref Removed Paths: ------------- trunk/stdair/doc/tutorial/bpsk.doc trunk/stdair/doc/tutorial/convcode.doc trunk/stdair/doc/tutorial/interleaver.doc trunk/stdair/doc/tutorial/itfile.doc trunk/stdair/doc/tutorial/ldpc_bersim_awgn.doc trunk/stdair/doc/tutorial/ldpc_gen_codes.doc trunk/stdair/doc/tutorial/matlab_itpp.doc trunk/stdair/doc/tutorial/mimoconv.doc trunk/stdair/doc/tutorial/mog.doc trunk/stdair/doc/tutorial/qpsk_simulation.doc trunk/stdair/doc/tutorial/rayleigh.doc trunk/stdair/doc/tutorial/reedsolomon.doc trunk/stdair/doc/tutorial/spread.doc trunk/stdair/doc/tutorial/src/bpsk.cpp trunk/stdair/doc/tutorial/src/bpsk.ref trunk/stdair/doc/tutorial/src/convcode.cpp trunk/stdair/doc/tutorial/src/convcode.ref trunk/stdair/doc/tutorial/src/interleaver.cpp trunk/stdair/doc/tutorial/src/interleaver.ref trunk/stdair/doc/tutorial/src/ldpc_bersim_awgn.cpp trunk/stdair/doc/tutorial/src/ldpc_gen_codes.cpp trunk/stdair/doc/tutorial/src/mimoconv.cpp trunk/stdair/doc/tutorial/src/mog.cpp trunk/stdair/doc/tutorial/src/qpsk_simulation.cpp trunk/stdair/doc/tutorial/src/qpsk_simulation.ref trunk/stdair/doc/tutorial/src/rayleigh.cpp trunk/stdair/doc/tutorial/src/read_it_file.cpp trunk/stdair/doc/tutorial/src/reedsolomon.cpp trunk/stdair/doc/tutorial/src/reedsolomon.ref trunk/stdair/doc/tutorial/src/spread.cpp trunk/stdair/doc/tutorial/src/spread.ref trunk/stdair/doc/tutorial/src/timer.cpp trunk/stdair/doc/tutorial/src/timer.ref trunk/stdair/doc/tutorial/src/vector_and_matrix.cpp trunk/stdair/doc/tutorial/src/vector_and_matrix.ref trunk/stdair/doc/tutorial/src/write_it_file.cpp trunk/stdair/doc/tutorial/timer.doc trunk/stdair/doc/tutorial/vector_and_matrix.doc Modified: trunk/stdair/doc/local/users_guide.doc =================================================================== --- trunk/stdair/doc/local/users_guide.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/local/users_guide.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -27,14 +27,11 @@ \section introduction Introduction -The \c itbase library is the core of \c IT++ and it contains classes and -functions for mathematics with scalars, vectors, and matrices. This document -does not cover all the aspects of the \c itbase library. It does however -explain the most important things you need to know in order to start using -IT++. Once you are more familiar with the \c itbase library you will find -the online reference manual more useful. +The \c StdAir library contains classes for airline business management. +This document does not cover all the aspects of the \c StdAir library. It +does however explain the most important things you need to know in order + to start using \c StdAir. - \section predefined_types Predefined Data Types Deleted: trunk/stdair/doc/tutorial/bpsk.doc =================================================================== --- trunk/stdair/doc/tutorial/bpsk.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/bpsk.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,15 +0,0 @@ -/*! -\page bpsk BPSK modulation over an AWGN channel - -As a first example we will generate a sequence of 500000 random bits {0,1} and -BPSK modulate these. Thereafter the BPSK signals will be transmitted over -an AWGN channel with a signal-to-noise ratio \f$E_b/N_0 = 0\f$ dB. The received signal -is then decoded and the number of bit errors are calculated. - -\include bpsk.cpp - -When you run this program, the output will look something like this: - -\include bpsk.ref - -*/ Added: trunk/stdair/doc/tutorial/completeex.doc =================================================================== --- trunk/stdair/doc/tutorial/completeex.doc (rev 0) +++ trunk/stdair/doc/tutorial/completeex.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,12 @@ +/*! +\page completeex Constructing a complete Bom tree + +In this example we are constructing a complete Bom tree: + +\include completeex.cpp + +When you run this program, the output will look: + +\include completeex.ref + +*/ Deleted: trunk/stdair/doc/tutorial/convcode.doc =================================================================== --- trunk/stdair/doc/tutorial/convcode.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/convcode.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,12 +0,0 @@ -/*! -\page convcode Simulation of a convolutional encoder and decoder - -In this example we will show how to use the convolutional encoder/decoder class in it++. The Viterbi decoder uses the soft received values. - -\include convcode.cpp - -When you run this program, the output will look something like this: - -\include convcode.ref - -*/ Deleted: trunk/stdair/doc/tutorial/interleaver.doc =================================================================== --- trunk/stdair/doc/tutorial/interleaver.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/interleaver.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,12 +0,0 @@ -/*! -\page interleaver Interleaving and de-interleaving of data - -This example shows how to use one of the interleaving classes. - -\include interleaver.cpp - -When you run this program, the output will look like this: - -\include interleaver.ref - -*/ Added: trunk/stdair/doc/tutorial/invobject.doc =================================================================== --- trunk/stdair/doc/tutorial/invobject.doc (rev 0) +++ trunk/stdair/doc/tutorial/invobject.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,12 @@ +/*! +\page invobject Creating an Inventory object + +In this example we are constructing an airline inventory whose code is "BA": + +\include invobject.cpp + +When you run this program, the output will look: + +\include invobject.ref + +*/ Deleted: trunk/stdair/doc/tutorial/itfile.doc =================================================================== --- trunk/stdair/doc/tutorial/itfile.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/itfile.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,34 +0,0 @@ -/*! -\page itfile Writing and reading data from files - -Here we will use the \c it_file class to store some data. The program \c -write_it_file.cpp looks as follows: - -\include write_it_file.cpp - -When you run this program you will obtain a file called \c it_file_test.it -in your current directory. You can read the file into Matlab/Octave to view -the data by using the following commands: - -\code -itload('it_file_test.it') -figure(1); clf; -plot(a) -\endcode - -Note: Make sure that <tt>$PREFIX/share/itpp</tt> is in your Matlab/Octave -path and that you run the code above from the directory where \c -it_file_test.it is located (\c $PREFIX is the IT++ installation prefix; -<tt>/usr/local</tt> by default). - -The IT++ program \c read_it_file.cpp that reads the file and prints its -content can look like this: - -\include read_it_file.cpp - -Here is the output of the program: - -\verbatim -a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] -\endverbatim -*/ Deleted: trunk/stdair/doc/tutorial/ldpc_bersim_awgn.doc =================================================================== --- trunk/stdair/doc/tutorial/ldpc_bersim_awgn.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/ldpc_bersim_awgn.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,16 +0,0 @@ -/*! -\page ldpc_bersim_awgn Simulation of LDPC codes the AWGN channel - -This program simulates the performance of LDPC codes on the AWGN channel. Since the channel is symmetric, the zero codeword is used. - -\include ldpc_bersim_awgn.cpp -To simulate the code "RU_10000.it" over a range of SNR (see \ref ldpc_gen_codes for how to generate codec) -\code -./ldpc_bersim_awgn RU_10000.it -\endcode - -To simulate at Eb/N0=1.1 dB -\code -./ldpc_bersim_awgn RU_10000.it 1.1 -\endcode -*/ Deleted: trunk/stdair/doc/tutorial/ldpc_gen_codes.doc =================================================================== --- trunk/stdair/doc/tutorial/ldpc_gen_codes.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/ldpc_gen_codes.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,6 +0,0 @@ -/*! -\page ldpc_gen_codes Generation of LDPC codes - -\include ldpc_gen_codes.cpp - -*/ Deleted: trunk/stdair/doc/tutorial/matlab_itpp.doc =================================================================== --- trunk/stdair/doc/tutorial/matlab_itpp.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/matlab_itpp.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,89 +0,0 @@ -/*! -\page matlab_itpp Conversion table between IT++ syntax and Matlab/Octave - -Here we provide a conversion table between Matlab/Octave and IT++ -syntax. This table is intended to help with the transition from -Matlab/Octave programming to IT++, but it is not an exhaustive list of -possible operations. - -<br><br> -In what follows, -<ul> -<li>a, b denote vectors (assumed to be column vectors in Matlab/Octave notation),</li> -<li>A, B denote matrices, </li> -<li>x is a scalar,</li> -<li>k, l, n are indices</li> -</ul> -<br> -<b>Vector indexing and manipulation:</b> -\code -a.length() // length(a) -a(0) // a(1) -a(1) // a(2) -a(k-1) // a(k) -a(k-1)=x; or a.set(k-1,x); // a(k)=x; -a.left(k) // a(1:k) -a.right(k) // a(end-k+1:end) -a.mid(k,l) // a(k:k+l-1) -a.del(k); // a=[a(1:k-1); a(k+1:end)]; -concat(a,b) // [a; b] (or [a.' b.'].') -a.clear(); // a=zeros(size(a)); (or a=complex(zeros(size(a)));) -to_cmat(a) // complex(a) (assuming a real-valued) -\endcode -Note that indexing in IT++ starts at 0, whereas indexing in Matlab starts at 1. Also -note that Matlab/Octave does distinguish between column and row -vectors, whereas IT++ does not. -<br><br> -<b>Matrix indexing and manipulation:</b> -\code -A.rows() // size(A,1) -A.cols() // size(A,2) -A(k-1,l-1) // A(k,l) -A.set(k-1,l-1,x); // A(k,l)=x; -A.get_col(k-1) // A(:,k) -A.get_row(k-1) // A(k,:) -A.set_col(k-1,a); // A(:,k)=a; -A.set_row(k-1,a); // A(k,:)=a; -A.append_row(a); // A=[A; a.']; -A.append_col(a); // A=[A a]; -A.transpose() // A.' -A.hermitian_transpose() // A' -A.clear(); // A=zeros(size(A)); (or A=complex(zeros(size(A)));) -to_cmat(A) // complex(A) (assuming a real-valued) -\endcode -<br><br> -<b>Some vector and matrix algebra:</b> -\code -a+b // a+b -a-b // a-b -elem_mult(a,b) // a.*b (elementwise product) -a*b // a.'*b (inner product) -conj(a)*b // a'*b (inner product) -outer_product(a,b) // a*b.' (outer product) -elem_div(a,b) // a./b -A+B; // A+B; -A-B; // A-B; -A*B; // A*B; -elem_mul(A,B) // A.*B -elem_div(A,B) // A./B -A\b; // ls_solve_od(A,b); (assuming the system is overdetermined) -\endcode -<br><br> -<b>Special matrices and vectors:</b> -\code -zeros(n,n) // zeros(n,n) -zeros_c(n,n) // complex(zeros(n,n)) -eye(n) // eye(n) -eye_c(n) // complex(eye(n)) -linspace(alpha,beta,n) // linspace(alpha,beta,n) -\endcode -<br><br> -<b>Hardcoded initializations:</b> -\code -mat X="1.1 1.2; 2.1; 2.2"; // X=[1.1 1.2; 2.1 2.2]; -ivec a="1 2 3 4 5"; // a=[1; 2; 3; 4; 5]; (or a=[1 2 3 4 5].';) -ivec a="1:-3:-8"; // a=1:-3:-8; -\endcode - - -*/ Deleted: trunk/stdair/doc/tutorial/mimoconv.doc =================================================================== --- trunk/stdair/doc/tutorial/mimoconv.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/mimoconv.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,24 +0,0 @@ -/*! -\page mimoconv MIMO (spatial multiplexing) with convolutional coding - -This example demonstrates how to use the \c Modulator_ND (MIMO) class -for soft-output demodulation. The program simulates a simple -convolutionally coded spatial-multiplexing (V-BLAST style) MIMO system -with maximum-likelihood, alternatively zero-forcing, demodulation and -soft Viterbi decoding, but no iteration between the demodulator and -the decoder. - -\include mimoconv.cpp - -To run the program, - -\code -mimoconv nTx nRx nC Tc -\endcode -where -- nTx=number of transmit antennas -- nRx=number of receive antennas -- nC=constellation (1=QPSK, 2=16-QAM, 3=64-QAM) -- Tc=coherence time (channel uses) - -*/ Deleted: trunk/stdair/doc/tutorial/mog.doc =================================================================== --- trunk/stdair/doc/tutorial/mog.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/mog.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,11 +0,0 @@ -/*! -\page mog Using Mixture of Gaussians (MOG) module to model data - -This example demonstrates how to find the parameters of -a MOG model via using the kmeans and EM based optimisers. -Synthetic data is utilised. - -\include mog.cpp - - -*/ Deleted: trunk/stdair/doc/tutorial/qpsk_simulation.doc =================================================================== --- trunk/stdair/doc/tutorial/qpsk_simulation.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/qpsk_simulation.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,32 +0,0 @@ -/*! -\page qpsk_simulation Simulation of QPSK modulation on an AWGN channel - -In this example we will introduce a few new features compared to the BPSK example. We will use the it_ifile class to store the results of the simulation. We will use the Real_Timer class to measure the execution time of our program. Furthermore we will use one of the channel classes, the AWGN_Channel. We will also show how to read the results in to Matlab with the load_it function. The program is as follows: - -\include qpsk_simulation.cpp - -When you run this program, the output will look something like this: - -\include qpsk_simulation.ref - -Now it is time to plot the simulation results in Matlab and compare with theory using the Matlab code below. -The results will be stored in a file called "qpsk_result_file.it". Make sure load_it.m is in your Matlab path -(look in $(ITXX_HOME)/matlab) and that you run the example code below from the directory where qpsk_result_file.it is located - -\code -figure(1); clf; -load_it qpsk_result_file.it -h1 = semilogy(EbN0dB,ber,'*-r'); hold on -ebn0db = 0:.1:10; -ebn0 = 10.^(ebn0db/10); -Pb = 0.5 * erfc(sqrt(ebn0)); -h2 = semilogy(ebn0db,Pb); -set(gca,'fontname','times','fontsize',16); -xlabel('{\it E_b} / {\it N}_0 [dB]'); -ylabel('BER') -title('QPSK on an AWGN Channel'); -legend([h1 h2],'Simulation','Theory'); -grid on; -\endcode - -*/ Deleted: trunk/stdair/doc/tutorial/rayleigh.doc =================================================================== --- trunk/stdair/doc/tutorial/rayleigh.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/rayleigh.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,24 +0,0 @@ -/*! -\page rayleigh Generating a correlated Rayleigh fading process - -In this example we will generate a correlated Rayleigh fading process with a -normaized Doppler frequency equal to 0.1. The normalized Doppler is defined -as the multiplication of the maximum Doppler frequency by the sampling time -(i.e. \f$f_d = F_d T_s\f$). - -\include rayleigh.cpp - -You can use Matlab or Octave to examine the channel fading process that is -stored int the output file \c rayleigh_test.it. Try the followigh code to -view a part of the fading process: - -\code -itload("rayleigh_test.it") -figure(1); clf; -semilogy(abs(ch_coeffs(1:200))) -\endcode - -Note: Make sure that the folder <tt>$PREFIX/share/itpp</tt> is included your -Matlab/Octave path variable (\c $PREFIX is the IT++ installation prefix: -<tt>/usr/local</tt> by default). -*/ Deleted: trunk/stdair/doc/tutorial/reedsolomon.doc =================================================================== --- trunk/stdair/doc/tutorial/reedsolomon.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/reedsolomon.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,12 +0,0 @@ -/*! -\page reedsolomon Simulation of a Reed-Solomon Block Code - -A Reed-Solomon code is a \f$q^m\f$-ary BCH code of length \f$q^m-1\f$. The generator polynomial for a \f$t\f$-error correcting code is \f$g(x) = (x-\alpha) (x-\alpha^1) \ldots (x-\alpha^{2t-1})\f$. The decoder uses the Berlkamp-Massey algorithm for decoding as described in: S. B. Wicker, "Error Control Systems for digital communication and storage," Prentice Hall. The following example simulates a binary (i.e. \f$q=2\f$) Reed-Solomon code with parameters \f$m\f$ and \f$t\f$: - -\include reedsolomon.cpp - -A typical run of this program can look like this: - -\include reedsolomon.ref - -*/ Added: trunk/stdair/doc/tutorial/rootinvobject.doc =================================================================== --- trunk/stdair/doc/tutorial/rootinvobject.doc (rev 0) +++ trunk/stdair/doc/tutorial/rootinvobject.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,12 @@ +/*! +\page rootinvobject Linking an inventory object with the Bom root object + +In this example we are linking an airline inventory whose code is "BA" with the Bom root object. + +\include rootinvobject.cpp + +When you run this program, the output will look: + +\include rootinvobject.ref + +*/ Added: trunk/stdair/doc/tutorial/rootobject.doc =================================================================== --- trunk/stdair/doc/tutorial/rootobject.doc (rev 0) +++ trunk/stdair/doc/tutorial/rootobject.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,12 @@ +/*! +\page rootobject Creating a Bom root object + +In this example we are constructing a Bom root object (i,e a root for all classes in the project): + +\include rootobject.cpp + +When you run this program, the output will look: + +\include rootobject.ref + +*/ Modified: trunk/stdair/doc/tutorial/sources.mk =================================================================== --- trunk/stdair/doc/tutorial/sources.mk 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/sources.mk 2010-10-20 14:23:22 UTC (rev 354) @@ -1,17 +1,5 @@ doc_tutorial_sources = \ - $(top_srcdir)/doc/tutorial/bpsk.doc \ - $(top_srcdir)/doc/tutorial/convcode.doc \ - $(top_srcdir)/doc/tutorial/interleaver.doc \ - $(top_srcdir)/doc/tutorial/itfile.doc \ - $(top_srcdir)/doc/tutorial/qpsk_simulation.doc \ - $(top_srcdir)/doc/tutorial/rayleigh.doc \ - $(top_srcdir)/doc/tutorial/reedsolomon.doc \ - $(top_srcdir)/doc/tutorial/spread.doc \ - $(top_srcdir)/doc/tutorial/timer.doc \ - $(top_srcdir)/doc/tutorial/tutorial.doc \ - $(top_srcdir)/doc/tutorial/vector_and_matrix.doc \ - $(top_srcdir)/doc/tutorial/mimoconv.doc \ - $(top_srcdir)/doc/tutorial/matlab_itpp.doc \ - $(top_srcdir)/doc/tutorial/mog.doc \ - $(top_srcdir)/doc/tutorial/ldpc_gen_codes.doc \ - $(top_srcdir)/doc/tutorial/ldpc_bersim_awgn.doc + $(top_srcdir)/doc/tutorial/invobject.doc \ + $(top_srcdir)/doc/tutorial/rootobject.doc \ + $(top_srcdir)/doc/tutorial/rootinvobject.doc \ + $(top_srcdir)/doc/tutorial/completeex.doc Deleted: trunk/stdair/doc/tutorial/spread.doc =================================================================== --- trunk/stdair/doc/tutorial/spread.doc 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/spread.doc 2010-10-20 14:23:22 UTC (rev 354) @@ -1,14 +0,0 @@ -/*! -\page spread Simulation of a Multicode CDMA system on an AWGN channel - -In this example we will introduce the multi-code spreading class \c Multicode_Spread_2d. This is the most general spreading class availiable in it++. Different spreading codes may be assigned to the I and Q branches. The number of multiple spreading codes and the spreading factor is determined by the number of rows and collumns respectively that is used when calling the member function set_codes. In this example we will use four Hadamard sequenced of length four, and the same spreading sequences will be used for the I and Q brances. - -\include spread.cpp - -A typical run of this program will look like this: - -\include spread.ref - -Use copy-and-paste to insert the variables \c EbN0dB and \c ber into Matlab and plot the result. - -*/ Deleted: trunk/stdair/doc/tutorial/src/bpsk.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/bpsk.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/bpsk.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,54 +0,0 @@ -#include <itpp/itcomm.h> - -using namespace itpp; - -//These lines are needed for use of cout and endl -using std::cout; -using std::endl; - -int main() -{ - //Scalars - int N; - double N0; - - //Vectors - bvec bits, dec_bits; - vec symbols, rec; - - //Classes - BPSK bpsk; //The BPSK modulator/debodulator class - BERC berc; //The Bit Error Rate Counter class - - //Init - N = 500000; //The number of bits to simulate - N0 = 1; //0 dB SNR - - //Randomize the random number generator - RNG_randomize(); - - //Generate the bits: - bits = randb(N); - - //Do the BPSK modulation - bpsk.modulate_bits(bits, symbols); - - //Add the AWGN - rec = symbols + sqrt(N0/2)* randn(N); - - //Decode the received bits - bpsk.demodulate_bits(rec, dec_bits); - - //Count the number of errors - berc.count(bits,dec_bits); - - //Print the results - cout << "There were " << berc.get_errors() << " received bits in error." << endl; - cout << "There were " << berc.get_corrects() << " correctly received bits." << endl; - cout << "The error probability was " << berc.get_errorrate() << endl; - cout << "The theoretical error probability is " << 0.5*erfc(1.0) << endl; - - //Exit program: - return 0; - -} Deleted: trunk/stdair/doc/tutorial/src/bpsk.ref =================================================================== --- trunk/stdair/doc/tutorial/src/bpsk.ref 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/bpsk.ref 2010-10-20 14:23:22 UTC (rev 354) @@ -1,4 +0,0 @@ -There were 39224 received bits in error. -There were 460776 correctly received bits. -The error probability was 0.078448 -The theoretical error probability is 0.0786496 Added: trunk/stdair/doc/tutorial/src/completeex.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/completeex.cpp (rev 0) +++ trunk/stdair/doc/tutorial/src/completeex.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,328 @@ +// StdAir +#include <stdair/bom/BomManager.hpp> +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/Inventory.hpp> +#include <stdair/bom/InventoryTypes.hpp> +#include <stdair/bom/FlightDate.hpp> +#include <stdair/bom/FlightDateTypes.hpp> +#include <stdair/bom/LegDate.hpp> +#include <stdair/bom/LegDateTypes.hpp> +#include <stdair/bom/LegCabin.hpp> +#include <stdair/bom/LegCabinTypes.hpp> +#include <stdair/bom/SegmentDate.hpp> +#include <stdair/bom/SegmentDateTypes.hpp> +#include <stdair/bom/SegmentCabin.hpp> +#include <stdair/bom/SegmentCabinTypes.hpp> +#include <stdair/bom/FareFamily.hpp> +#include <stdair/bom/FareFamilyTypes.hpp> +#include <stdair/bom/BookingClass.hpp> +#include <stdair/bom/BookingClassTypes.hpp> +#include <stdair/factory/FacBomManager.hpp> + +//These lines are needed for use of cout and endl +using std::cout; +using std::endl; + +int main() +{ + // ///////////// Step 0.0: Initialisation //////////// + // Create the root of the Bom tree (i.e., a BomRoot object) + stdair::BomRoot& lBomRoot = + stdair::FacBom<stdair::BomRoot>::instance().create(); + + // Step 0.1: Inventory level + // Create an Inventory for BA + const stdair::InventoryKey lBAKey ("BA"); + stdair::Inventory& lBAInv = + stdair::FacBom<stdair::Inventory>::instance().create (lBAKey); + stdair::FacBomManager::instance().addToList (lBomRoot, lBAInv); + + // Create an Inventory for AF + const stdair::InventoryKey lAFKey ("AF"); + stdair::Inventory& lAFInv = + stdair::FacBom<stdair::Inventory>::instance().create (lAFKey); + stdair::FacBomManager::instance().addToList (lBomRoot, lAFInv); + + // ////// BA /////// + // Step 0.2: Flight-date level + // Create a FlightDate (BA15/10-JUN-2010) for BA's Inventory + stdair::FlightNumber_T lFlightNumber = 15; + stdair::Date_T lDate (2010, 6, 10); + stdair::FlightDateKey lFlightDateKey (lFlightNumber, lDate); + + stdair::FlightDate& lBA15_20100610_FD = + stdair::FacBom<stdair::FlightDate>::instance().create (lFlightDateKey); + stdair::FacBomManager::instance().addToList (lBAInv, lBA15_20100610_FD); + + // Step 0.3: Segment-date level + // Create a first SegmentDate (LHR-SYD) for BA's Inventory + const stdair::AirportCode_T lLHR ("LHR"); + const stdair::AirportCode_T lSYD ("SYD"); + stdair::SegmentDateKey lSegmentDateKey (lLHR, lSYD); + + stdair::SegmentDate& lLHRSYDSegment = + stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lLHRSYDSegment); + + // Create a second SegmentDate (LHR-BKK) for BA's Inventory + const stdair::AirportCode_T lBKK ("BKK"); + lSegmentDateKey = stdair::SegmentDateKey (lLHR, lBKK); + + stdair::SegmentDate& lLHRBKKSegment = + stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lLHRBKKSegment); + + // Create a third SegmentDate (BKK-SYD) for BA's Inventory + lSegmentDateKey = stdair::SegmentDateKey (lBKK, lSYD); + + stdair::SegmentDate& lBKKSYDSegment = + stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, + lBKKSYDSegment); + + // Step 0.4: Leg-date level + // Create a first LegDate (LHR) for BA's Inventory + stdair::LegDateKey lLegDateKey (lLHR); + + stdair::LegDate& lLHRLeg = + stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, lLHRLeg); + + // Create a second LegDate (BKK) + lLegDateKey = stdair::LegDateKey (lBKK); + + stdair::LegDate& lBKKLeg = + stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); + stdair::FacBomManager::instance().addToList (lBA15_20100610_FD, lBKKLeg); + + // Step 0.5: segment-cabin level + // Create a SegmentCabin (Y) for the Segment LHR-BKK of BA's Inventory + const stdair::CabinCode_T lY ("Y"); + stdair::SegmentCabinKey lYSegmentCabinKey (lY); + + stdair::SegmentCabin& lLHRBKKSegmentYCabin = + stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); + stdair::FacBomManager::instance().addToList (lLHRBKKSegment, + lLHRBKKSegmentYCabin); + + // Create a SegmentCabin (Y) of the Segment BKK-SYD; + stdair::SegmentCabin& lBKKSYDSegmentYCabin = + stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); + stdair::FacBomManager::instance().addToList (lBKKSYDSegment, + lBKKSYDSegmentYCabin); + + // Create a SegmentCabin (Y) of the Segment LHR-SYD; + stdair::SegmentCabin& lLHRSYDSegmentYCabin = + stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); + stdair::FacBomManager::instance().addToList (lLHRSYDSegment, + lLHRSYDSegmentYCabin); + + // Step 0.6: leg-cabin level + // Create a LegCabin (Y) for the Leg LHR-BKK on BA's Inventory + stdair::LegCabinKey lYLegCabinKey (lY); + + stdair::LegCabin& lLHRLegYCabin = + stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); + stdair::FacBomManager::instance().addToList (lLHRLeg, lLHRLegYCabin); + + // Create a LegCabin (Y) for the Leg BKK-SYD + stdair::LegCabin& lBKKLegYCabin = + stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); + stdair::FacBomManager::instance().addToList (lBKKLeg, lBKKLegYCabin); + + // Step 0.7: fare family level + // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv + const stdair::FamilyCode_T l1 ("1"); + stdair::FareFamilyKey l1FareFamilyKey (l1); + + stdair::FareFamily& lLHRBKKSegmentYCabin1Family = + stdair::FacBom<stdair::FareFamily>::instance().create(l1FareFamilyKey); + stdair::FacBomManager::instance().addToList (lLHRBKKSegmentYCabin, + lLHRBKKSegmentYCabin1Family); + + // Create a FareFamily (1) for the Segment BKK-SYD, cabin Y on BA's Inv + stdair::FareFamily& lBKKSYDSegmentYCabin1Family = + stdair::FacBom<stdair::FareFamily>::instance().create(l1FareFamilyKey); + stdair::FacBomManager::instance().addToList (lBKKSYDSegmentYCabin, + lBKKSYDSegmentYCabin1Family); + + // Create a FareFamily (1) for the Segment LHR-SYD, cabin Y on BA's Inv + stdair::FareFamily& lLHRSYDSegmentYCabin1Family = + stdair::FacBom<stdair::FareFamily>::instance().create(l1FareFamilyKey); + stdair::FacBomManager::instance().addToList (lLHRSYDSegmentYCabin, + lLHRSYDSegmentYCabin1Family); + + // Step 0.8: booking class level + // Create a BookingClass (Q) for the Segment LHR-BKK, cabin Y, fare family 1 on BA's Inv + const stdair::ClassCode_T lQ ("Q"); + stdair::BookingClassKey lQBookingClassKey (lQ); + + stdair::BookingClass& lLHRBKKSegmentYCabin1FamilyQClass = + stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); + stdair::FacBomManager::instance().addToList (lLHRBKKSegmentYCabin1Family, + lLHRBKKSegmentYCabin1FamilyQClass); + + // Create a BookingClass (Q) for the Segment BKK-SYD, cabin Y, fare family 1 on BA's Inv + stdair::BookingClass& lBKKSYDSegmentYCabin1FamilyQClass = + stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); + stdair::FacBomManager::instance().addToList (lBKKSYDSegmentYCabin1Family, + lBKKSYDSegmentYCabin1FamilyQClass); + + // Create a BookingClass (Q) for the Segment LHR-SYD, cabin Y, fare family 1 on BA's Inv + stdair::BookingClass& lLHRSYDSegmentYCabin1FamilyQClass = + stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); + stdair::FacBomManager::instance().addToList (lLHRSYDSegmentYCabin1Family, + lLHRSYDSegmentYCabin1FamilyQClass); + + // ////// AF /////// + // Step 0.2: Flight-date level + // Create a FlightDate (AF102/20-MAR-2010) for AF's Inventory + lFlightNumber = 102; + lDate = stdair::Date_T (2010, 3, 20); + lFlightDateKey = stdair::FlightDateKey (lFlightNumber, lDate); + + stdair::FlightDate& lAF102_20100320_FD = + stdair::FacBom<stdair::FlightDate>::instance().create (lFlightDateKey); + stdair::FacBomManager::instance().addToList (lAFInv, lAF102_20100320_FD); + + // Step 0.3: Segment-date level + // Create a SegmentDate (CDG-SFO) for AF's Inventory + const stdair::AirportCode_T lCDG ("CDG"); + const stdair::AirportCode_T lSFO ("SFO"); + lSegmentDateKey = stdair::SegmentDateKey (lCDG, lSFO); + + stdair::SegmentDate& lCDGSFOSegment = + stdair::FacBom<stdair::SegmentDate>::instance().create (lSegmentDateKey); + stdair::FacBomManager::instance().addToList (lAF102_20100320_FD, + lCDGSFOSegment); + + // Step 0.4: Leg-date level + // Create a LegDate (CDG) for AF's Inventory + lLegDateKey = stdair::LegDateKey (lCDG); + + stdair::LegDate& lCDGLeg = + stdair::FacBom<stdair::LegDate>::instance().create (lLegDateKey); + stdair::FacBomManager::instance().addToList (lAF102_20100320_FD, lCDGLeg); + + // Step 0.5: segment-cabin level + // Create a SegmentCabin (Y) for the Segment CDG-SFO of AF's Inventory + stdair::SegmentCabin& lCDGSFOSegmentYCabin = + stdair::FacBom<stdair::SegmentCabin>::instance().create(lYSegmentCabinKey); + stdair::FacBomManager::instance().addToList (lCDGSFOSegment, + lCDGSFOSegmentYCabin); + + // Step 0.6: leg-cabin level + // Create a LegCabin (Y) for the Leg CDG-SFO on AF's Inventory + stdair::LegCabin& lCDGLegYCabin = + stdair::FacBom<stdair::LegCabin>::instance().create (lYLegCabinKey); + stdair::FacBomManager::instance().addToList (lCDGLeg, lCDGLegYCabin); + + // Step 0.7: fare family level + // Create a fareFamily (1) for the Segment CDG-SFO, cabin Y on AF's Inv + stdair::FareFamily& lCDGSFOSegmentYCabin1Family = + stdair::FacBom<stdair::FareFamily>::instance().create(l1FareFamilyKey); + stdair::FacBomManager::instance().addToList (lCDGSFOSegmentYCabin, + lCDGSFOSegmentYCabin1Family); + + // Step 0.8: booking class level + // Create a BookingClass (Q) for the Segment CDG-SFO, cabin Y, fare family 1 on AF's Inv + stdair::BookingClass& lCDGSFOSegmentYCabin1FamilyQClass = + stdair::FacBom<stdair::BookingClass>::instance().create(lQBookingClassKey); + stdair::FacBomManager::instance().addToList (lCDGSFOSegmentYCabin1Family, + lCDGSFOSegmentYCabin1FamilyQClass); + + + // /////////// Step 1.0: Display the BOM tree ////////// + // 1.0. Bom root level + cout << lBomRoot.describeKey() << endl; + + // 1.1. Inventory level + const stdair::InventoryList_T& lInventoryList = + stdair::BomManager::getList<stdair::Inventory> (lBomRoot); + for (stdair::InventoryList_T::const_iterator itInv = lInventoryList.begin(); + itInv != lInventoryList.end(); ++itInv) { + const stdair::Inventory* lInv_ptr = *itInv; + + cout << " " <<lInv_ptr->describeKey() << endl; + + // 1.2. FlightDate level + const stdair::FlightDateList_T& lFlightDateList = + stdair::BomManager::getList<stdair::FlightDate> (*lInv_ptr); + for (stdair::FlightDateList_T::const_iterator itFD=lFlightDateList.begin(); + itFD != lFlightDateList.end(); ++itFD) { + const stdair::FlightDate* lFD_ptr = *itFD; + + cout << " " << lFD_ptr->toString() << endl; + + // 1.4. LegDate level + const stdair::LegDateList_T& lLegDateList = + stdair::BomManager::getList<stdair::LegDate> (*lFD_ptr); + for (stdair::LegDateList_T::const_iterator itLD = + lLegDateList.begin(); + itLD != lLegDateList.end(); ++itLD) { + const stdair::LegDate* lLD_ptr = *itLD; + + cout << " " << lLD_ptr->toString() << endl; + + // 1.6. LegCabin level + const stdair::LegCabinList_T& lLegCabinList = + stdair::BomManager::getList<stdair::LegCabin> (*lLD_ptr); + for (stdair::LegCabinList_T::const_iterator itLC = + lLegCabinList.begin(); + itLC != lLegCabinList.end(); ++itLC) { + const stdair::LegCabin* lLC_ptr = *itLC; + + cout << " " << lLC_ptr->toString() << endl; + } + } + + // 1.3. SegmentDate level + const stdair::SegmentDateList_T& lSegmentDateList = + stdair::BomManager::getList<stdair::SegmentDate> (*lFD_ptr); + for (stdair::SegmentDateList_T::const_iterator itSD = + lSegmentDateList.begin(); + itSD != lSegmentDateList.end(); ++itSD) { + const stdair::SegmentDate* lSD_ptr = *itSD; + + cout << " " << lSD_ptr->toString() << endl; + + // 1.5. SegmentCabin level + const stdair::SegmentCabinList_T& lSegmentCabinList = + stdair::BomManager::getList<stdair::SegmentCabin> (*lSD_ptr); + for (stdair::SegmentCabinList_T::const_iterator itSC = + lSegmentCabinList.begin(); + itSC != lSegmentCabinList.end(); ++itSC) { + const stdair::SegmentCabin* lSC_ptr = *itSC; + + cout << " " << lSC_ptr->toString() << endl; + + // 1.7. FareFamily level + const stdair::FareFamilyList_T& lFareFamilyList = + stdair::BomManager::getList<stdair::FareFamily> (*lSC_ptr); + for (stdair::FareFamilyList_T::const_iterator itFF = + lFareFamilyList.begin(); + itFF != lFareFamilyList.end(); ++itFF) { + const stdair::FareFamily* lFF_ptr = *itFF; + + cout << " " << lFF_ptr->toString() << endl; + + // 1.8. BookingClass level + const stdair::BookingClassList_T& lBookingClassList = + stdair::BomManager::getList<stdair::BookingClass> (*lFF_ptr); + for (stdair::BookingClassList_T::const_iterator itBC = + lBookingClassList.begin(); + itBC != lBookingClassList.end(); ++itBC) { + const stdair::BookingClass* lBC_ptr = *itBC; + + cout << " " << lBC_ptr->toString() << endl; + } + } + } + } + } + } + // Exit program: + return 0; +} Added: trunk/stdair/doc/tutorial/src/completeex.ref =================================================================== --- trunk/stdair/doc/tutorial/src/completeex.ref (rev 0) +++ trunk/stdair/doc/tutorial/src/completeex.ref 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,27 @@ + -- ROOT -- + BA + 15, 2010-Jun-10 + LHR + Y + BKK + Y + LHR-SYD + Y + 1 + Q + LHR-BKK + Y + 1 + Q + BKK-SYD + Y + 1 + Q + AF + 102, 2010-Mar-20 + CDG + Y + CDG-SFO + Y + 1 + Q Deleted: trunk/stdair/doc/tutorial/src/convcode.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/convcode.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/convcode.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,85 +0,0 @@ -#include <itpp/itcomm.h> - -using namespace itpp; - -//These lines are needed for use of cout and endl -using std::cout; -using std::endl; - -int main() -{ - //Scalars - int constraint_length, MaxNrofErrors, Nobits, MaxIterations, p, i; - double Ec, Eb; - - //Vectors - ivec generators; - vec EbN0dB, EbN0, N0, ber, trans_symbols, rec_symbols; - bvec uncoded_bits, coded_bits, decoded_bits; - - //Classes - BPSK bpsk; - BERC berc; - Convolutional_Code conv_code; - AWGN_Channel channel; - - /* - Set up the convolutional encoder/decoder class: - The generators are given in octal form by adding a zero in front of the numbers. - In this example we will simulate a rate 1/3 code that is listed in J. G. Proakis, - "Digital communications". The encoder has constraint length 7. - */ - generators.set_size(3,false); - generators(0) = 0133; - generators(1) = 0145; - generators(2) = 0175; - constraint_length = 7; - conv_code.set_generator_polynomials(generators, constraint_length); - - //Init: Calculate some simulation specific parameters: - Ec = 1.0; - EbN0dB = linspace(-2,6,5); - EbN0 = inv_dB(EbN0dB); - Eb = Ec / conv_code.get_rate(); - N0 = Eb * pow(EbN0,-1); - MaxNrofErrors = 100; - Nobits = 10000; - MaxIterations = 10; - ber.set_size(EbN0dB.length(),false); - ber.clear(); - - //Randomize the random number generators. - RNG_randomize(); - - for (p=0; p<EbN0dB.length(); p++) { - - cout << "Now simulating point " << p+1 << " out of " << EbN0dB.length() << endl; - berc.clear(); //Clear the bit error rate counter. - channel.set_noise(N0(p)/2.0); //Set the noise value of the AWGN channel. - - for (i=0; i<MaxIterations; i++) { - - uncoded_bits = randb(Nobits); //The uncoded bits. - coded_bits = conv_code.encode(uncoded_bits); //The convolutional encoder function. - bpsk.modulate_bits(coded_bits, trans_symbols); //The BPSK modulator. - rec_symbols = channel( trans_symbols ); //The AWGN channel. - decoded_bits = conv_code.decode(rec_symbols); //The Viterbi decoder function. - berc.count(uncoded_bits,decoded_bits); //Count the errors. - ber(p) = berc.get_errorrate(); - - //Break the simulation on this point if sufficient number of bit errors were observed: - if (berc.get_errors()>MaxNrofErrors) { - cout << "Breaking on point " << p+1 << " with " << berc.get_errors() << " errors." << endl; break; - } - - } - } - - //Print the results: - cout << "BER = " << ber << endl; - cout << "EbN0dB = " << EbN0dB << endl; - - //Exit program: - return 0; - -} Deleted: trunk/stdair/doc/tutorial/src/convcode.ref =================================================================== --- trunk/stdair/doc/tutorial/src/convcode.ref 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/convcode.ref 2010-10-20 14:23:22 UTC (rev 354) @@ -1,10 +0,0 @@ -Now simulating point 1 out of 5 -Breaking on point 1 with 3297 errors. -Now simulating point 2 out of 5 -Breaking on point 2 with 781 errors. -Now simulating point 3 out of 5 -Breaking on point 3 with 112 errors. -Now simulating point 4 out of 5 -Now simulating point 5 out of 5 -BER = [0.330858 0.0783743 0.00280983 0 0] -EbN0dB = [-2 0 2 4 6] Deleted: trunk/stdair/doc/tutorial/src/interleaver.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/interleaver.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/interleaver.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,43 +0,0 @@ -#include <itpp/itcomm.h> - -using namespace itpp; - -//These lines are needed for use of cout and endl -using std::cout; -using std::endl; - -int main() -{ - //Declare scalars and vectors: - int rows, cols; - ivec input, output, deinterleaved; - - //Declare the interleaver. The interleaver classes are templated, and therefore we must specify - //the type of the data elements. In this example we are using integers: - Block_Interleaver<int> my_interleaver; - - //Initialize the interleaver class. Note that this can be done already in the declaration by writing - //Block_Interleaver<int> my_interleaver(rows,cols); - rows = 4; - cols = 5; - my_interleaver.set_rows(rows); - my_interleaver.set_cols(cols); - - //Define the input to the interleaver: - input = "1:20"; - - //Do the interleaving: - output = my_interleaver.interleave(input); - - //Do the de-interleaving: - deinterleaved = my_interleaver.deinterleave(output); - - //Print the results: - cout << "input = " << input << endl; - cout << "output = " << output << endl; - cout << "deinterleaved = " << deinterleaved << endl; - - //Exit program: - return 0; - -} Deleted: trunk/stdair/doc/tutorial/src/interleaver.ref =================================================================== --- trunk/stdair/doc/tutorial/src/interleaver.ref 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/interleaver.ref 2010-10-20 14:23:22 UTC (rev 354) @@ -1,3 +0,0 @@ -input = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] -output = [1 5 9 13 17 2 6 10 14 18 3 7 11 15 19 4 8 12 16 20] -deinterleaved = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] Added: trunk/stdair/doc/tutorial/src/invobject.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/invobject.cpp (rev 0) +++ trunk/stdair/doc/tutorial/src/invobject.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1,24 @@ +// StdAir +#include <stdair/factory/FacBomManager.hpp> +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/Inventory.hpp> + +// These lines are needed for use of cout and endl +using std::cout; +using std::endl; + +int main() +{ + // Create an inventory Key (i,e an airline code) + const stdair::InventoryKey lBAKey ("BA"); + + // Create an inventory object whose airline code is BA + stdair::Inventory& lBAInv = + stdair::FacBom<stdair::Inventory>::instance().create (lBAKey); + + // Display the airline code + cout << " Inventory: " << lBAInv.describeKey() << endl; + + // Exit program: + return 0; +} Added: trunk/stdair/doc/tutorial/src/invobject.ref =================================================================== --- trunk/stdair/doc/tutorial/src/invobject.ref (rev 0) +++ trunk/stdair/doc/tutorial/src/invobject.ref 2010-10-20 14:23:22 UTC (rev 354) @@ -0,0 +1 @@ + Inventory: BA Deleted: trunk/stdair/doc/tutorial/src/ldpc_bersim_awgn.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/ldpc_bersim_awgn.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/ldpc_bersim_awgn.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,83 +0,0 @@ -#include <itpp/itcomm.h> - -using namespace std; -using namespace itpp; - -extern int main(int argc, char **argv) -{ - int Nbits=1000*1000*5000; // maximum number of bits simulated for any SNR point - int Nbers=2000; // target number of bit errors per SNR point - double BERmin=1e-6; // BER at which to terminate simulation - vec EbN0db = "0.6:0.2:5"; - - LDPC_Code C(argv[1]); - bool single_snr_mode=false; - if (argc==3) { - double x; - sscanf(argv[2],"%lf",&x); - EbN0db.set_size(1); - EbN0db(0)=x; - single_snr_mode=true; - } - - cout << "Running with Eb/N0: " << EbN0db << endl; - - // High performance: 2500 iterations, high resolution LLR algebra - C.setup_decoder("bp","2500 1 0"); - - // Alt. setting -- High speed: 50 iterations, logmax approximation - // C.setup_decoder("bp","50 1 0",LLR_calc_unit(12,0,7)); - - cout << C << endl; - - int N = C.get_nvar(); // number of bits per codeword - BPSK Mod; - bvec bitsin = zeros_b(N); - vec s = Mod.modulate_bits(bitsin); - - RNG_randomize(); - for (int j=0; j<length(EbN0db); j++) { - // noise variance is N0/2 per dimension - double N0 = pow(10.0,-EbN0db(j)/10.0) / C.get_rate(); - AWGN_Channel chan(N0/2); - BERC berc; // counters for coded and uncoded BER - BLERC ferc; // counter for coded FER - ferc.set_blocksize(N); - for (long int i=0; i<Nbits; i+=C.get_nvar()) { - // Received data - vec x = chan(s); - - // Demodulate - vec softbits=Mod.demodulate_soft_bits(x,N0); - - //Decode the received bits - bvec bitsout=C.decode(softbits); - - //Count the number of errors - berc.count(bitsin,bitsout); - ferc.count(bitsin,bitsout); - - if (single_snr_mode) { - cout << "Eb/N0=" << EbN0db(j) << " Simulated " - << ferc.get_total_blocks() << " frames and " - << berc.get_total_bits() << " bits. " - << "Obtained " << berc.get_errors() << " bit errors. " - << " BER: " << berc.get_errorrate() - << " FER: " << ferc.get_errorrate() << endl; - cout.flush(); - } else { - if (berc.get_errors()>Nbers) { break;} - } - } - - cout << "Eb/N0=" << EbN0db(j) << " Simulated " - << ferc.get_total_blocks() << " frames and " - << berc.get_total_bits() << " bits. " - << "Obtained " << berc.get_errors() << " bit errors. " - << " BER: " << berc.get_errorrate() - << " FER: " << ferc.get_errorrate() << endl; - cout.flush(); - if (berc.get_errorrate()<BERmin) { break; } - } - return 0; -} Deleted: trunk/stdair/doc/tutorial/src/ldpc_gen_codes.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/ldpc_gen_codes.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/ldpc_gen_codes.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,97 +0,0 @@ -// Generate some example LDPC codes - -#include <itpp/itcomm.h> - -using namespace itpp; -using namespace std; - -extern int main(int argc, char **argv) -{ - { // This generates a random regular (3,6) code with 500 bits - cout << "========= RANDOM (3,6) CODE ==========" << endl; - LDPC_Parity_Matrix H; - H.generate_regular_ldpc(500,3,6, - "rand", // random unstructured matrix - "500 10"); // optimize girth - H.display_stats(); - LDPC_Code C1(H); - C1.save_to_file("random_3_6_code.it"); - } - - { // This is the code "204.33.484 (N=204,K=102,M=102,R=0.5)" from - // David MacKay's database over sparse-graph code. It can be - // obtained with "wget - // http://www.inference.phy.cam.ac.uk/mackay/codes/EN/C/204.33.484" - cout << "========= MACKAY CODE ==========" << endl; - LDPC_Parity_Matrix H("204.33.484","alist"); - H.display_stats(); - LDPC_Generator_Matrix G(H); - LDPC_Code C(H,G); - C.save_to_file("mackay_204.33.484.it"); - - // Now produce a girth-optimized version of this code by removing - // cycles. This slightly improves the performance at high SNR. - H.cycle_removal_MGW(12); - LDPC_Generator_Matrix G1(H); - LDPC_Code C1(H,G1); - C1.save_to_file("mackay_204.33.484_opt.it"); - } - - // Irregular 1/2-rate codes optimized for the AWGN channel. The - // degree distributions are taken from Richardson & Urbanke, - // Trans. IT 2001. - - { // 1000 bits - cout << "========= IRREGULAR CODE 1000 BITS ==========" << endl; - LDPC_Parity_Matrix H; - H.generate_irregular_ldpc(1000, - "0 0.27684 0.28342 0 0 0 0 0 0.43974", - "0 0 0 0 0 0.01568 0.85244 0.13188", - "rand", // random unstructured matrix - "500 8"); // optimize girth - LDPC_Code C(H); - C.save_to_file("RU_1000.it"); - } - - { // 10000 bits (takes a few minutes to run) - cout << "========= IRREGULAR CODE 10000 BITS ==========" << endl; - LDPC_Parity_Matrix H; - H.generate_irregular_ldpc(10000,"0 0.21991 0.23328 0.02058 0 0.08543 0.06540 0.04767 \ - 0.01912 0 0 0 0 0 0 0 0 0 0.08064 0.22798", - "0 0 0 0 0 0 0 0.64854 0.34747 0.00399", - "rand", // random unstructured matrix - "150 8"); // optimize - LDPC_Code C(H); - C.save_to_file("RU_10000.it"); - } - - { // 100000 bits (takes a while to run) - cout << "========= IRREGULAR CODE 100000 BITS ==========" << endl; - LDPC_Parity_Matrix H; - H.generate_irregular_ldpc(100000,"0 0.1712 0.21053 0.00273 0 0 0.00009 0.15269 0.09227 \ - 0.02802 0 0 0 0 0.01206 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07212 0 0 0 0 \ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25830", - "0 0 0 0 0 0 0 0 0.33620 0.08883 0.57497", - "rand", - "40 4"); // less aggressive optimization - LDPC_Code C(H); - C.save_to_file("RU_100000.it"); - } - - exit(0); - - { // 1000000 bits (THIS CODE REQUIRES ABOUT 450 MB TO STORE AND 2GB - // INTERNAL MEMORY TO GENERATE) - cout << "========= IRREGULAR CODE 1000000 BITS ==========" << endl; - LDPC_Parity_Matrix H; - H.generate_irregular_ldpc(1000000,"0 0.1712 0.21053 0.00273 0 0 0.00009 0.15269 0.09227 \ - 0.02802 0 0 0 0 0.01206 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07212 0 0 0 0 \ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25830", - "0 0 0 0 0 0 0 0 0.33620 0.08883 0.57497", - "rand", - "0 0"); // no optimization here - LDPC_Code C(H); - C.save_to_file("RU_1000000.it"); - } - -} Deleted: trunk/stdair/doc/tutorial/src/mimoconv.cpp =================================================================== --- trunk/stdair/doc/tutorial/src/mimoconv.cpp 2010-10-18 11:37:53 UTC (rev 353) +++ trunk/stdair/doc/tutorial/src/mimoconv.cpp 2010-10-20 14:23:22 UTC (rev 354) @@ -1,241 +0,0 @@ - -#include <itpp/itcomm.h> - -using std::cout; -using std::endl; -using namespace itpp; -using namespace std; - -/* Zero-forcing detector with ad hoc soft information. This function - applies the ZF (pseudoinverse) linear filter to the received - data. This results in effective noise with covariance matrix - inv(H'H)*sigma2. The diagonal elements of this noise covariance - matrix are taken as noise variances per component in the processed - received data but the noise correlation is ignored. - - */ - -void ZF_demod(ND_UQAM &channel, ivec &LLR_apr, ivec &LLR_apost, double sigma2, cmat &H, cvec &y) -{ - it_assert(H.rows()>=H.cols(),"ZF_demod() - underdetermined systems not tolerated"); - cvec shat=ls_solve_od(H,y); // the ZF solution - vec Sigma2=real(diag(inv(H.hermitian_transpose()*H)))*sigma2; // noise covariance of shat - cvec h(length(shat)); - for (int i=0; i<length(shat); i++) { - shat(i) = shat(i)/sqrt(Sigma2(i)); - h(i) = 1.0/sqrt(Sigma2(i)); - } - channel.map_demod(LLR_apr,LLR_apost,1.0,h,shat); -} - - -extern int main(int argc, char **argv) -{ - // -- modulation and channel parameters (taken from command line input) -- - int nC; // type of constellation (1=QPSK, 2=16-QAM, 3=64-QAM) - int nRx; // number of receive antennas - int nTx; // number of transmit antennas - int Tc; // coherence time (number of channel vectors with same H) - - if (argc!=5) { - cout << "Usage: cm nTx nRx nC Tc" << endl << "Example: cm 2 2 1 100000 (2x2 QPSK MIMO on slow fading channel)" << endl; - exit(1); - } else { - sscanf(argv[1],"%i",&nTx); - sscanf(argv[2],"%i",&nRx); - sscanf(argv[3],"%i",&nC); - sscanf(argv[4],"%i",&Tc); - } - - cout << "Initializing.. " << nTx << " TX antennas, " << nRx << " RX antennas, " - << (1<<nC) << "-PAM per dimension, coherence time " << Tc << endl; - - // -- simulation control parameters -- - const vec EbN0db = "-5:0.5:50"; // SNR range - const int Nmethods =2; // number of demodulators to try - const long int Nbitsmax=50*1000*1000; // maximum number of bits to ever simulate per SNR point - const int Nu = 1000; // length of data packet (before applying channel coding) - - int Nbers, Nfers; // target number of bit/frame errors per SNR point - double BERmin, FERmin; // BER/FER at which to terminate simulation - if (Tc==1) { // Fast fading channel, BER is of primary interest - BERmin = 0.001; // stop simulating a given method if BER<this value - FERmin = 1.0e-10; // stop simulating a given method if FER<this value - Nbers = 1000; // move to next SNR point after counting 1000 bit errors - Nfers = 200; // do not stop on this condition - } else { // Slow fading channel, FER is of primary interest here - BERmin = 1.0e-15; // stop simulating a given method if BER<this value - FERmin = 0.01; // stop simulating a given method if FER<this value - Nbers = -1; // do not stop on this condition - Nfers = 200; // move to next SNR point after counting 200 frame errors - } - - // -- Channel code parameters -- - Convolutional_Code code; - ivec generator(3); - generator(0)=0133; // use rate 1/3 code - generator(1)=0165; - generator(2)=0171; - double rate=1.0/3.0; - code.set_generator_polynomials(generator, 7); - bvec dummy; - code.encode_tail(randb(Nu),dummy); - const int Nc = length(dummy); // find out how long the coded blocks are - - // ============= Initialize ==================================== - - const int Nctx = (int) (2*nC*nTx*ceil(double(Nc)/double(2*nC*nTx))); // Total number of bits to transmit - const int Nvec = Nctx/(2*nC*nTx); // Number of channel vectors to transmit - const int Nbitspvec = 2*nC*nTx; // Number of bits per channel vector - - // initialize MIMO channel with uniform QAM per complex dimension and Gray coding - ND_UQAM chan; - chan.set_Gray_QAM(nTx,1<<(2*nC)); - cout << chan << endl; - - // initialize interleaver - Sequence_Interleaver<bin> sequence_interleaver_b(Nctx); - Sequence_Interleaver<int> sequence_interleaver_i(Nctx); - sequence_interleaver_b.randomize_interleaver_sequence(); - sequence_interleaver_i.set_interleaver_sequence(sequence_interleaver_b.get_interleaver_sequence()); - - // RNG_randomize(); - - Array<cvec> Y(Nvec); // received data - Array<cmat> H(Nvec/Tc+1); // channel matrix (new matrix for each coherence interval) - - ivec Contflag = ones_i(Nmethods); // flag to determine whether to run a given demodulator - if (pow(2.0,nC*2.0*nTx)>256) { // ML decoder too complex.. - Contflag(1)=0; - } - if (nTx>nRx) { - Contflag(0)=0; // ZF not for underdetermined systems - } - cout << "Running methods: " << Contflag << endl; - - cout.setf(ios::fixed, ios::floatfield); - cout.setf(ios::showpoint); - cout.precision(5); - - // ================== Run simulation ======================= - for (int nsnr=0; nsnr<length(EbN0db); nsnr++) { - const double Eb=1.0; // transmitted energy per information bit - const double N0 = pow(10.0,-EbN0db(nsnr)/10.0); - const double sigma2=N0; // Variance of each scalar complex noise sample - const double Es=rate*2*nC*Eb; // Energy per complex scalar symbol - // (Each transmitted scalar complex symbol contains rate*2*nC - // information bits.) - const double Ess=sqrt(Es); - - Array<BERC> berc(Nmethods); // counter for coded BER - Array<BERC> bercu(Nmethods); // counter for uncoded BER - Array<BLERC> ferc(Nmethods); // counter for coded FER - - for (int i=0; i<Nmethods; i++) { - ferc(i).set_blocksize(Nu); - } - - long int nbits=0; - while (nbits<Nbitsmax) { - nbits += Nu; - - // generate and encode random data - bvec inputbits = randb(Nu); - bvec txbits; - code.encode_tail(inputbits, txbits); - // coded block length is not always a multiple of the number of - // bits per channel vector - txbits=concat(txbits,randb(Nctx-Nc)); - txbits = sequence_interleaver_b.interleave(txbits); - - // -- generate channel and data ---- - for (int k=0; k<Nvec; k++) { - /* A complex valued channel matrix is used here. An - alternative (with equivalent result) would be to use a - real-valued (structured) channel matrix of twice the - dimension. - */ - if (k%Tc==0) { // generate a new channel realization every Tc intervals - H(k/Tc) = Ess*randn_c(nRx,nTx); - } - - // modulate and transmit bits - bvec bitstmp = txbits(k*2*nTx*nC,(k+1)*2*nTx*nC-1); - cvec x=chan.modulate_bits(bitstmp); - cvec e=sqrt(sigma2)*randn_c(nRx); - Y(k) = H(k/Tc)*x+e; - } - - // -- demodulate -- - Array<QLLRvec> LLRin(Nmethods); - for (i... [truncated message content] |