E N D
IT++ A software package for NEWCOM
What is IT++? IT++ is a C++ library of mathematical, signal processing, speech processing, and communications classes and functions. It has been developed by researchers in these areas. The kernel of the package are templated vector and matrix classes and lots of functions for vectors and matrices. As such the kernel is similar to the Matlab functions. IT++ is based on LAPACK and CBLAS. The IT++ library originates from the former department of Information Theory at Chalmers University of Technology, Gothenburg, Sweden. Since the library is coded in C++ the name of the library seemed like a good idea at the time. While departments come and go, IT++ have developed a life of its' own and is now released under the GNU GPL license for you to enjoy. IT++ works on GNU/Linux, Sun Solaris, Cygwin, Windows 2000/NT/XP (with Microsoft Visual C++, and Mac OS X.
What is IT++ not? IT++ does not contain full programs or simulators, but it does contain the building blocks for most applications.
The parts of IT++ itbase contains the basic stuff of it++, including vector and matrix manipulation, mathematical functions and signal processing functions. We have random number generation, FFT and other transforms, filtering, matrix algebra, a command-line parser, equation solving and much more. itcomm contains communication-related functions and classes. It is more spezialized than itbase, containing building blocks for communication systems. For example, it contain modulators and demodulators, channel encoders and decoders, spreading and de-spreading functions, channel classes, interleavers, e.t.c. itsrccode is the source coding part of it++, specialized on data compression and speech signal processing. We have vector quantization, linear prediction, Gaussian mixture modelling, etc.
Modules of IT++ • Here is a list of IT++ modules: • Writing Matlab Mex-files using IT++ • Bessel Functions • Matrix Decompositions • Conversion Functions • Determinant • Logarithmic and Exponential Functions • Error Functions • Trigonometric Functions • Hyperbolic Functions • Miscellaneous Functions • Filter Classes and Functions • Inverse Matrix • Error handling functions • IT++ File Format • Solving Linear Equation Systems • Random Number Generation • Signal Processing Functions • Deterministic Sources • Special Matricies • Windows • Timers • Forward Error Correcting Codes • Communication Channels • Interleavers • Digital Modulation • Audio • LPC-related Functions
The basic types Scalar types: complex<double> real and imag part of type double bin Used for binary (0,1) data Vector types: Vec<type> The templated vector class vec A vector of double cvec A vector of complex<double> ivec An integer vector (int) bvec A binary vector svec An integer vector (short) Matrix types: Mat<type> The templated vector class mat A matrix of double cmat A matrix of complex<double> imat An integer matrix (int) bmat A binary matrix (bin) smat An integer matrix (short)
Vector manipulation vec myvector; // defines an empty vector vec myvector(10); // A vector of length 10 myvector.set_length(15); // the vector gets length 15 vec a = "0 0.7 5 9.3"; // a = [0 0.7 5 9.3] ivec b = "0:5"; // b = [0 1 2 3 4 5] vec c = "3:2.5:13"; // c = [3 5.5 8 10.5 13] a(3)=3.14; // Assignment to vector elements (MATLAB style) a[0]=1.2; // c-style assignment works also. First element has index 0. a=c.left(2); // a=c.right(2); // a=c.mid(2,2); // From index 2 of c, to index 4. a=c(2,4); // Same as above c=concat(a,myvector); // Concatenation of two vectors c=to_vec(b); // Converts the integer vector to a Vec<double>
Mathematics Bessel Functions Matrix Decompositions Conversion Functions Determinant Logarithmic and Exponential Functions Error Functions Trigonometric Functions Hyperbolic Functions Miscellaneous Functions Inverse Matrix Solving Linear Equation Systems Random Number Generation Special Matricies vec a,b; a=randn(54); // Gaussian random numbers b=round(a); // mat m=”1 2 3; 4 5 6; 7 8 9”; m=inv(m); // the inverse cout << a << b << m << endl ; a=eig(m); // eigenvalue decomposition double d; d=erf(0.2); // the error function a=3*a+sin(b); // arithmetics and functions a=elem_mult(a,b); // elementwise multiplication
Random numbers • Discrete-valued random number generators • Bernoulli_RNG • I_Uniform_RNG • Continuous-valued random number generators • Uniform_RNG • Exponential_RNG • Normal_RNG • Complex_Normal_RNG • AR1_Normal_RNG • Weibull_RNG • Rayleigh_RNG • Rice_RNG • Random vectors and matrices are easily obtained by using these predefined functions: • randb: random bit vector or matrix. • randu: random uniform vector or matrix. • randi: random index vector or matrix. • randray: random Rayleigh vector or matrix. • randrice: random Rice vector or matrix. • randexp: random Exponential vector or matrix. • randn: random Gaussian vector or matrix. • randn_c: random complex Gaussian vector or matrix.
Filtering • Filtering classes • AR_Filter autoregressive filter class • MA_Filter moving average filter class • ARMA_Filter • Filter functions • filter filtering function (AR, MA, ARMA) • Filter design • fir1 FIR filter design using the window method.
Signal processing • Signal processing • a2k, k2a, a2lar, k2lar, lpc, levinsson, lerouxguegen • fft, ifft • spectrum • cov, xcorr • chirp • dht, dht2, dwht, dhwt2, self_dht, self_dwht • filter_spectrum • filter_whiteness • Signal sources • Sine_Source • Square_Source • Triangle_Source • Sawtooth_Source • Impulse_Source • Pattern_Source
Communication The itcomm Library The itcomm library contains many different communication functions such as modulators and demodulators, channel encoders and decoders, spreading and de-spreading functions, channel classes, interleavers, e.t.c. Modulator Classes There is a base modulator class called Modulator and two derived classes Modulator_1d and Modulator_2d. You can use Modulator_1d to define you own 1-dimensional signal constellations (e.g. BPSK and PAM) and Modulator_2d to define you own 2-dimensional signal constellations (e.g. QPSK, QAM e.t.c) The predefined classes are BPSK, PAM, PSK, QAM, QPSK, and OFDM. Channel Classes The following channel classes are available in itcomm: AWGN_Channel, Multipath_Rayleigh_Channel, Rayleigh_Channel, BSC, and Rice_Channel.
Communication Error Control Classes The following error control classes are available in itcomm: Turbo_Codec, BCH, Reed_Solomon, Convolutional_Code, Punctured_Convolutional_Code, Hamming_Code, Rec_Syst_Conv_Code. Spreading Classes The following spreading classes are available in itcomm: Spread_1d, Spread_2d, Multicode_Spread_1d, Multicode_Spread_2d. Also, the class Gold can be used to generate Gold spreading sequences. Interleaver Classes The following interleaver classes are available in itcomm: Block_Interleaver, Cross_Interleaver, and Sequence_Interleaver.
MATLAB interface • IT++ support several ways to communicate with MATLAB. • MATLAB engine. With MATLAB engine, a matlab process can be started from inside the C++ program. This is useful for plotting, or to use functionality of MATLAB not yet implemented in IT++. • By itfile. IT++ defines a file format that is understood both by IT++ and MATLAB. This is useful to save data from a program for later analysis in MATLAB, or if MATLAB provides som data that can be used by the IT++ program.Interface functions and classes: • By MEX files. IT++ provides some interface routines for mex file writing, to convert between matlab and it++ vectors and matrices. Matlab_Engine M; vec v; M.put(v,”v”); M.command(”plot(v)”); vec v("1 2 3"); it_file f("file.it"); f << Name("v") << v;
#include "itcomm.h" int main() { int i, Number_of_bits; double Ec, Eb; vec EbN0dB, EbN0, N0, noise_variance, bit_error_rate; bvec transmitted_bits, received_bits; cvec transmitted_symbols, received_symbols; QPSK qpsk; //The QPSK modulator class AWGN_Channel awgn_channel; //The AWGN channel class it_file ff; //For saving the results to file BERC berc; //Used to count the bit errors tic(); // start a timer Ec = 1.0; //The transmitted energy per QPSK symbol is 1. Eb = Ec / 2.0; //The transmitted energy per bit is 0.5.
EbN0dB = linspace(0.0,9.0,10); //Simulate for 10 Eb/N0 values from 0 to 9 dB. EbN0 = inv_dB(EbN0dB); //Calculate Eb/N0 in a linear scale instead of dB. N0 = Eb * pow(EbN0,-1.0); //N0 is the variance of the (complex valued) noise. Number_of_bits = 100000; //100000 bits are transmitted for each Eb/N0 value bit_error_rate.set_length(EbN0dB.length()); RNG_randomize(); for (i=0; i<EbN0dB.length(); i++) { cout << "Eb/N0 value " << i+1 << " of " << EbN0dB.length() << endl; transmitted_bits = randb(Number_of_bits); transmitted_symbols = qpsk.modulate_bits(transmitted_bits); awgn_channel.set_noise(N0(i)); received_symbols = awgn_channel(transmitted_symbols); received_bits = qpsk.demodulate_bits(received_symbols);
transmitted_symbols = qpsk.modulate_bits(transmitted_bits); awgn_channel.set_noise(N0(i)); received_symbols = awgn_channel(transmitted_symbols); received_bits = qpsk.demodulate_bits(received_symbols); berc.clear(); berc.count(transmitted_bits,received_bits); bit_error_rate(i) = berc.get_errorrate(); } toc(); cout << "EbN0dB = " << EbN0dB << " [dB]" << endl; cout << "BER = " << bit_error_rate << endl; cout << "Saving results to ./qpsk_result_file.it" << endl << endl; ff.open("qpsk_result_file.it"); ff << Name("EbN0dB") << EbN0dB; ff << Name("ber") << bit_error_rate; ff.close(); return 0; }
Possible extension • New functionality provided by NEWCOM partners • ???