IT++ Polar Code

Please take a look at the PolarCode source code and documentation.

PolarCode provides IT++ functions for the training, encoding and decoding of polar codes. Like turbo and LDPC codes, polar codes facilitate near-capacity operation. However, unlike turbo and LDPC codes, polar codes do not require an iterative decoder. You can find out more about polar codes in Erdal Arikan’s paper.

Copyright © 2010 Robert G. Maunder. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

92 Responses to “IT++ Polar Code”

  1. Raul Says:

    Sorry, I like to know how you compile your code, or how I can use since I’m new in using C + + and do not know why I can not compile it. I have already Gcc installed and the IT + + and running. Thanks

  2. Rob Says:

    Hello Raul,

    You can download a version of the source code that includes the makefile that I use from…
    http://users.ecs.soton.ac.uk/rm/wp-content/PolarCode110Project.zip
    On a Linux or Mac computer, compilation should be as simple as typing ‘make’ in the PolarCode110 directory. However, this might depend on how IT++ is installed on your computer.

    Hope this helps, Rob.

  3. raul Says:

    Dear Robb.

    Your bar program works for me great, but now I need to use a channel BAWGN, the problem is the calculation of Bhattacharya. You, how do you calculate in your program?, I’ve seen you use it but not as programs. If I could help with this we agradeseía.

    regards
    Raul

  4. Rob Says:

    Hello Raul,

    The polar code program will use a BAWGN channel if you set the variable…
    channel=0;

    Take care, Rob.

  5. raul Says:

    Hello Robb

    Sorry but I do not understand where I have put that parameter, and if so, that means that automatically give me the values ​​for the channel BWGN. The thing is I\’m using the Polar Code of your program to apply to other cases, that\’s why I wondered about as I had with the calculation of echo Batacharrya.

    Greetings and thank you very much

  6. Rob Says:

    Hi Raul,

    That parameter is set on line 114 of main.c. It is set to channel=0 by default, which will give you the BAWGN channel.

    Take care, Rob.

  7. Liu Tong Says:

    Sorry, Now I want to simulate polar codes under BEC channel. But this simulation packege is only for AWGN and Rayleigh channel .Can you tell me where to revise to suit for BEC and BSC channel ? Thanks a lot.

  8. Rob Says:

    Hi Liu Tong,

    All you need to do is write some code that will set the LLRs in encoded_llrs to appropriate values. More specifically, LLRs that correspond to erased bits should be set to 0. LLRs that correspond to unerased 0-valued bits should be set to +infinity, using the set_to_plus_infinity function. LLRs that correspond to unerased 1-valued bits should be set to -infinity, using the set_to_minus_infinity function.

    Take care, Rob.

  9. Liu Tong Says:

    Hi, Rob
    Thanks for your advise. But I still have a question. according to your simulatoin code. u_hat is bvec type which can hold only two variables: 0 and 1 , but in bec channel , u_hat may have thress possibles: 0,1 and uncertainty. I don’t know your simulation package is suitable for BEC without revisal . Thansk a lot.

  10. Rob Says:

    Hi Liu Tong,

    You don’t need to modify this to get my code to work with the BEC channel. u_hat is an hard decision output from my code. The BEC channel provides the input to my code in form of an llr_frame. You need to put the three values (+infinity, 0 and -infinity) into this. You don’t need to worry about u_hat.

    Take care, Rob.

  11. gilbert Says:

    Hi,
    there is a problem if K is equal to N. Maybe to change PolarCode.cpp.127: if(K > N) -> if(K >= N)?

    thx

  12. Rob Says:

    Hello Gilbert,

    Thanks for this, I will give it a try.

    Take care, Rob.

  13. chuyi qian Says:

    HI, Rob I am trying to simulate fountain coding scheme with HARQ I wonder how I can model the fountain code, could you give me some advice? Thanks

  14. Rob Says:

    Hello Chuyi Qian,

    A fountain decoder uses the same components as an LDPC decoder, namely check nodes and variable nodes. I keep meaning to write some Matlab functions for these, but I’m afraid that I haven’t gotten around to this yet. I’m sure you’d be able to find some elsewhere on the Internet though…

    Take care, Rob.

  15. Ahmed elshahawy Says:

    Dear all
    Im a phd student at lancaster uni,and im studying polar codes.please can any one help me with the program.if any one can give the program of polar codes for BEC and BAWGN it would be great and very helpful.
    Many thnx

  16. Rob Says:

    Hi Ahmed,

    The code I have provided here will simulate a polar code for BAWGN. It can be very easily adapted for BEC as well - take a look at the following comment to find out how…
    http://users.ecs.soton.ac.uk/rm/resources/cpolarcode/#comment-5977

    Take care, Rob.

  17. aitezaz Says:

    Hi Rob,
    Thanks for your time and effort. I am currently working on Belief Propagation decoding for polar codes … What i am finding is that for fixed number of iterations polar codes (designed for BEC(.5) ) with n=11 (code length 2^n) perform inferior to the codes with n=10. My understanding was that the larger the code length is, the better the performance should be under identical settings. Is there some catch that I can’t get ?

    Thanks again

  18. Rob Says:

    Hi Aitezaz,

    LDPC codes having longer code lengths perform better because this allows greater freedom for the code structure to be randomised. It is possible that a longer code length does not improve the polar code performance because its code structure is not randomised. One thing you may like to look into is the girth of your factor graph. It may be that for some reason, lengthening the code has caused some small loops to be created within the factor graph - these damage the performance of belief propagation…

    Take care, Rob.

  19. Aitezaz Says:

    Thanks Rob!
    I really appreciate your taking out time to help us.
    The girth of polar codes is 12 irrespective of the length. So I am afraid that may not be the reason for this bad performance since its the same for n=10 and n=11. You’ll have to forgive me I don’t understand what do you mean by randomizing in the context of polar codes. As polar codes are highly structured codes and they don’t have any random structure in them. I was wondering if it is a known phenomenon that has already been discussed somewhere (even in LDPC context). I will be very thankful to you if you can guide me to a few references or keywords to search.

  20. Rob Says:

    Hello Aitezaz,

    Since the girth is constant with the code length, I don’t think that is the problem. I wonder if the structured nature of polar codes means that more iterations are required for good information at one of the code to propagate to the other end. Perhaps this is why the performance is suffering - you may like to try iterating between the check nodes and the variable nodes more times…

    Take care, Rob.

  21. Rob Says:

    Sarah says “Hi Rob,
    I have a question about polar codes.For polar codes, we have the Bhattacharyya parameter in advance before transmitting. Since Bhattacharyya parameter could estimate the performance of each bit channel, can we say that the bits with lower Bhttacharyya parameters are better protected than others?
    Thank your very much.
    Sarah”

    Hi Sarah,

    You are correct - different bits have different amounts of protection in the polar code. The polar decoder will decode the best protected bits first and use them to help decode the least protected bits.

    Take care, Rob.

  22. Sarah Says:

    Hi Bob,
    Thank you for your kind reply. Did you do BP decoding?
    Regards,
    Sarah

  23. Rob Says:

    Hello Sarah,

    Belief propagation doesn’t work very well for polar codes…

    Take care, Rob.

  24. Nyakec Says:

    Thanks for this code, I can see it uses prob. computation, how can this be changed for QAM?

  25. Rob Says:

    Hi Nyakec,

    Please see my response to your other comment at…
    http://users.ecs.soton.ac.uk/rm/resources/matlabcapacity/#comment-9742

    Take care, Rob.

  26. Ahmed Elshahawy Says:

    Dear Rob,
    thanks for your reply but i still can use your program as i got only C++ and matlab so could you please send me the link again and tell me where is the AWGN pOLAR CODES IS LOCATED AND HOW CAN I RUN IT.
    Many Thanks
    Kind Regards
    Ahmed Elshahawy

  27. Rob Says:

    Hi Ahmed,

    I’m afraid that I can only share a Polar code for IT++. I’m not sure if you realise, but IT++ is just a set of libraries for C++ - you can install it and then run my code.

    Take care, Rob.

  28. Ahmed Elshahawy Says:

    Dear Rob.

    Thank you very much for your reply ..do you know if can download IT++ fow windows xp and and which website is good to load it++ ??
    regards
    Ahmed

  29. Rob Says:

    Hi Ahmed,

    You can download IT++ from…
    http://itpp.sourceforge.net/current/

    Take care, Rob.

  30. Ahmed Elshahawy Says:

    Dear Rob
    Is’t ok to tell me how do u calculate the Bhattcharya Parameter for AWGN please as im stuck at this point ???

  31. Rob Says:

    Hello Ahmed,

    In an AWGN channel, W(y|x) is a Gaussian distribution. You will have to replace the sum over y with an integral dy.

    Take care, Rob.

  32. LJ Kong Says:

    Dear Rob,

    List decoding can improve SC decoder performance, Could you share the List decoding program? Many thanks.

    BR/LJ

  33. Rob Says:

    Hello LJ,

    I’m afraid that I don’t have any code that I can share for list decoding…

    Take care, Rob.

  34. Ankit Says:

    hi can you plz send me the detail dat i can implement polar code on Matlab

  35. Rob Says:

    Hello Ankit,

    I’m afraid that I don’t have a Matlab version of the polar code that I can share. However, Matlab is not too dissimilar from IT++, so it should be fairly easy for you to convert it.

    Take care, Rob.

  36. LJ Kong Says:

    Dear Rob,

    how to explain the eq. (5) in Erdal Arikan’s paper. why divide by 2^(N-1) and the scope of sum ? I can understand the explanation in the paper, but not the equation. Many thanks .

    BR
    LJ

  37. Ankit Says:

    In decoder how we can detect and correct errors?

    Is SC decoder and its latest architecture good to implement on DSP?

    What if we increase blocklength?

  38. Rob Says:

    Hi Ankit,

    There is a lot of research at the moment about how to implement decoding in hardware - the tricky thing is achieving a high throughput for the BCJR decoder, since it is not well suited to parallel processing. For large block lengths, the sliding window technique can be used to increase the parallelism and reduce the memory requirement.

    Take care, Rob.

  39. Stojan Says:

    Hi Rob,

    I also try to compile the code, however I fail. I have installed g++ and itpp.

    This is what I get when I type make.

    root@ubuntu:~/Downloads/PolarCode110# ls
    bin Makefile obj src
    root@ubuntu:~/Downloads/PolarCode110# make

    checking dependencies

    root@ubuntu:~/Downloads/PolarCode110#

    Also When I execute a.out I am not able to do this.

    root@ubuntu:~/Downloads/PolarCode110/bin# ls
    a.out
    root@ubuntu:~/Downloads/PolarCode110/bin# ./a.out
    bash: ./a.out: cannot execute binary file

    Any sugestions how to solve this.

    Regards,

    Stojan Kitanov

  40. Stojan Says:

    Hi Rob,
    I am not able to compile the code. This is what I get.
    root@ubuntu:~/Downloads/PolarCode110# ls
    bin Makefile obj src
    root@ubuntu:~/Downloads/PolarCode110# make

    checking dependencies

    Also I can not execute a.out file after compilation.

    root@ubuntu:~/Downloads/PolarCode110#
    root@ubuntu:~/Downloads/PolarCode110/bin# ls
    a.out
    root@ubuntu:~/Downloads/PolarCode110/bin# ./a.out
    bash: ./a.out: cannot execute binary file

    Any sugestions how to do this.

    Regards,

    Stojan Kitanov

  41. Rob Says:

    Hi Stojan,

    If you want to recompile the code, you should type “make clean” to remove the pre-compiled version and then “make” to recompile it.

    You need to change the permissions of a.out to make it executable. You may be able to do this by right clicking on the file and going to properties.

    Take care, Rob.

  42. Stojan Says:

    Hi Rob,

    I checked the properties of the file and it is marked as executable (i.e. to run as a program). So something else is wrong. As I said I have installed g++ and it++ both with sudo apt get install command.

    Otherwise I followed the commands make clean and make. And this what I get:
    root@ubuntu:~/Downloads/PolarCode110# make clean
    remove all objects
    root@ubuntu:~/Downloads/PolarCode110# make

    checking dependencies

    compiling object file \"obj/main.o\" …
    compiling object file \"obj/PolarCode.o\" …
    compiling object file \"obj/robprob.o\" …
    src/robprob.cpp: In function ‘RobProb::pvalues RobProb::to_pvalues(const vec&)’:
    src/robprob.cpp:621:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::vec RobProb::to_vec(const pvalues&)’:
    src/robprob.cpp:631:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues RobProb::add(const pvalues&, const pvalues&, RobProb::JacobianType)’:
    src/robprob.cpp:671:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalue RobProb::sum(const pvalues&, RobProb::JacobianType)’:
    src/robprob.cpp:689:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalue RobProb::product(const pvalues&)’:
    src/robprob.cpp:731:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::entropy(const pvalues&)’:
    src/robprob.cpp:746:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues RobProb::to_lvalues(const vec&, double)’:
    src/robprob.cpp:766:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::vec RobProb::to_vec(const lvalues&, double)’:
    src/robprob.cpp:776:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues RobProb::jacobian(const lvalues&, const lvalues&, RobProb::JacobianType)’:
    src/robprob.cpp:811:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalue RobProb::jacobian(const lvalues&, RobProb::JacobianType)’:
    src/robprob.cpp:829:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalue RobProb::sum(const lvalues&)’:
    src/robprob.cpp:873:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::entropy(const lvalues&)’:
    src/robprob.cpp:887:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues RobProb::log(const pvalues&)’:
    src/robprob.cpp:908:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues RobProb::exp(const lvalues&)’:
    src/robprob.cpp:921:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::mat RobProb::to_mat(const pvalues_frame&, RobProb::MatrixType)’:
    src/robprob.cpp:943:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:951:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::to_pvalues_frame(const mat&, RobProb::MatrixType)’:
    src/robprob.cpp:985:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:996:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::add(const pvalues_frame&, const pvalues_frame&, RobProb::JacobianType)’:
    src/robprob.cpp:1039:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::normalize(const pvalues_frame&)’:
    src/robprob.cpp:1052:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::equalize(const pvalues_frame&)’:
    src/robprob.cpp:1063:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const pvalues_frame&, const pvalues&)’:
    src/robprob.cpp:1077:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const pvalues_frame&)’:
    src/robprob.cpp:1095:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::mat RobProb::to_mat(const lvalues_frame&, RobProb::MatrixType, double)’:
    src/robprob.cpp:1123:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:1131:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::to_lvalues_frame(const mat&, RobProb::MatrixType, double)’:
    src/robprob.cpp:1165:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:1176:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::jacobian(const lvalues_frame&, const lvalues_frame&, RobProb::JacobianType)’:
    src/robprob.cpp:1213:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::normalize(const lvalues_frame&)’:
    src/robprob.cpp:1226:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::equalize(const lvalues_frame&)’:
    src/robprob.cpp:1237:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const lvalues_frame&, const lvalues&)’:
    src/robprob.cpp:1250:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const lvalues_frame&)’:
    src/robprob.cpp:1268:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::log(const pvalues_frame&)’:
    src/robprob.cpp:1284:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::exp(const lvalues_frame&)’:
    src/robprob.cpp:1295:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::vec RobProb::to_vec(const plr_frame&, double)’:
    src/robprob.cpp:2288:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::plr_frame RobProb::to_plr_frame(const vec&, double)’:
    src/robprob.cpp:2298:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::plr_frame RobProb::add(const plr_frame&, const plr_frame&, RobProb::JacobianType)’:
    src/robprob.cpp:2331:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const plr_frame&, const RobProb::plr&)’:
    src/robprob.cpp:2346:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const plr_frame&)’:
    src/robprob.cpp:2364:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::pvalues_frame RobProb::to_pvalues_frame(const plr_frame&)’:
    src/robprob.cpp:2395:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::plr_frame RobProb::to_plr_frame(const pvalues_frame&)’:
    src/robprob.cpp:2405:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::vec RobProb::to_vec(const llr_frame&, double)’:
    src/robprob.cpp:2416:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::to_llr_frame(const vec&, double)’:
    src/robprob.cpp:2426:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::jacobian(const llr_frame&, const llr_frame&, RobProb::JacobianType)’:
    src/robprob.cpp:2465:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::jacobian_xor(const llr_frame&, const llr_frame&, RobProb::JacobianType)’:
    src/robprob.cpp:2483:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const llr_frame&, const RobProb::llr&)’:
    src/robprob.cpp:2497:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const llr_frame&)’:
    src/robprob.cpp:2515:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const llr_frame&, const bvec&)’:
    src/robprob.cpp:2611:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2652:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2672:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2716:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2756:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘void RobProb::display_llr_histograms(const llr_frame&, const bvec&)’:
    src/robprob.cpp:2793:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2834:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2854:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:2898:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::generate_gaussian_llr_frame(const bvec&, double)’:
    src/robprob.cpp:3004:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp:3020:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::generate_bec_llr_frame(const bvec&, double)’:
    src/robprob.cpp:3035:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::lvalues_frame RobProb::to_lvalues_frame(const llr_frame&)’:
    src/robprob.cpp:3047:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::to_llr_frame(const lvalues_frame&)’:
    src/robprob.cpp:3057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::llr_frame RobProb::log(const plr_frame&)’:
    src/robprob.cpp:3069:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘RobProb::plr_frame RobProb::exp(const llr_frame&)’:
    src/robprob.cpp:3080:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::ivec RobProb::hard(const pvalues_frame&)’:
    src/robprob.cpp:3151:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::ivec RobProb::hard(const lvalues_frame&)’:
    src/robprob.cpp:3162:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::bvec RobProb::hard(const plr_frame&)’:
    src/robprob.cpp:3190:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘itpp::bvec RobProb::hard(const llr_frame&)’:
    src/robprob.cpp:3201:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    src/robprob.cpp: In function ‘double RobProb::mutual_information(const llr_frame&, const bvec&)’:
    src/robprob.cpp:2732:129: warning: ‘bin_offset’ may be used uninitialized in this function [-Wuninitialized]
    src/robprob.cpp:2732:117: warning: ‘bin_width’ may be used uninitialized in this function [-Wuninitialized]
    src/robprob.cpp: In function ‘void RobProb::display_llr_histograms(const llr_frame&, const bvec&)’:
    src/robprob.cpp:2770:6: warning: ‘bin_offset’ may be used uninitialized in this function [-Wuninitialized]
    src/robprob.cpp:2914:117: warning: ‘bin_width’ may be used uninitialized in this function [-Wuninitialized]

    creating binary \"bin/a.out\"
    /usr/bin/ld: cannot find -lfftw3
    /usr/bin/ld: cannot find -llapack
    /usr/bin/ld: cannot find -lblas
    collect2: ld returned 1 exit status
    make: *** [bin] Error 1
    root@ubuntu:~/Downloads/PolarCode110#

    Any idea how to fix this.

    Best regards,

    Stojan Kitanov

  43. Rob Says:

    Hi Stojan,

    The error messages show that your installation of IT++ does not have lfftw3, llapack and lblas, which it requires. I’m afraid that I don’t know how to fix this because it has been a long time since I last installed IT++. My advice would be for you to visit the IT++ webpage and look for help there.

    With regard to a.out, the only other thing that I can think of is that the permissions of the file may not be granting you access to it. For this, I’m afraid that I must refer you to the ubuntu webpages for help…

    Take care, Rob.

  44. Stojan Says:

    Hi Rob,

    I managed to compile it and to run the ./a.out file in bin.

    I installed the packages:

    sudo apt-get install fftw3-dev
    sudo apt-get install liblapack-dev

    After that I was able to compile it and to run the a.out file in bin folder.
    Thanks for your help.
    Would you give me any sugestions how to continue with the simulations.

    Regards,

    Stojan

  45. Swan Says:

    Dear Sir:

    I have a question, please help me about it.

    How will you chose the good channels? You pick up the highest weight (from the G matriex)or it doesnt matter, eg, if N=256, R=1/2. then i say from 128 - 256 all good?

    Thanks alot

  46. Rob Says:

    Hi Swan,

    As I recall, the good channels are the ones with the highest weight and these are the ones you should use.

    Take care, Rob.

  47. Terry Says:

    Hi Rob

    I appreciate your work offered for other researchers, and I\’ve run your program and found that the BER performance with N=256, K=128, is not desirable. the details of the results are as follows, can u give me any advice about that?

    N=256
    K=128
    A=[56,60,62,63,64,80,88,92,94,95,96,104,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,144,150,151,152,154,155,156,157,158,159,160,164,166,167,168,170,171,172,173,174,175,176,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,196,198,199,200,202,203,204,205,206,207,208,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256]

    !SNR berrors bits BER ferrors frames FER ACS
    -1 580 12800 0.0453125 17 100 0.17 47.3326
    -0.5 130 12800 0.0101563 4 100 0.04 46.3548
    0 124 22784 0.00544242 3 178 0.0168539 45.5219
    0.5 106 339328 0.000312382 4 2651 0.00150886 44.7185
    1 108 1301376 8.29891e-005 3 10167 0.000295072 44.0342

  48. Rob Says:

    Hi Terry,

    I wonder if you are using a Rayleigh fading channel or an AWGN channel. My feeling is that polar codes do not perform very well for Rayleigh fading channels, which affects some bits worse than others. This is because polar codes assume that all bits are affected equally by the channel, like in an AWGN channel. My suggestion would be to try using an AWGN channel.

    Take care, Rob.

  49. Terry Says:

    Hi Rob

    Actually, I’m using an AWGN channel and just revising the code length N while keeping the rate R = 0.5. However, the results is beyond my expectation.

    The steps I did this as follows. First, fix training = 1 and set N, K to get the good channels indices. Next, change training = 0, and run this program using the file generating by the first step and then get the results showed before. and during the whole simulation, just keep channel=0.

    So, is there any problem about the steps and simulation parameters?

  50. Rob Says:

    Hi Terry,

    The approach you have described sounds correct to me. My advice would be to begin by trying to reproduce the results presented in one of the published papers on polar codes.

    Take care, Rob.

  51. Ratheesh Says:

    hai sir, i would like to implement polar modulator(qpsk+cordic for rectangular to polar conversion).please help me for the development of iq modulator and cordic block.how i can generate sine and cosine wave from cordic module or by any other means

  52. Rob Says:

    Hi Ratheesh,

    My recommendation would be to use a baseband simulation, which will avoid the requirement for generating sine and cosine carrier waves - this will make your simulation run much faster. I have Matlab code for QPSK modulation available at…
    http://users.ecs.soton.ac.uk/rm/resources/matlabexit/#comment-1545

    Take care, Rob.

  53. Lily Says:

    Hi Rob

    Thank you for your codes, and it\’s help me a lot. But I don\’t understand PolarCode.cpp.597, why \"Ls(x,y) = left^right\" (in llr PolarCode::L_Nover2 module)? In my opinion, it should be \"Ls(x,y) =log((exp(left)*exp(right)+1)/(exp(left)+exp(right)))\".

    Regards,

    Lily

  54. Rob Says:

    Hi Lily,

    This line is performing the boxplus of the two LLRs…
    http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.291&rep=rep1&type=pdf
    I think you’ll find that your equation gives the same result as this.

    Take care, Rob.

  55. Liu He Says:

    Hi,Rob,
    I have a problem with the coad that I can\’t resolve.So I beg your help.

    llr_frame RobProb::log(const plr_frame & x)
    lvalues_frame RobProb::log(const pvalues_frame & x)
    lvalues RobProb::log(const pvalues & x)
    llr RobProb::log(const plr & x)
    lvalue RobProb::log(const pvalue & x)

  56. Rob Says:

    Hi Liu,

    I am happy to help, but it is not clear from your message what trouble you are having…

    Take care, Rob.

  57. Dang Anh Tuan Says:

    Hi Rob
    Can you support me to simulate polar codes under BEC channel. I had read your comment but i don\’t know where to change

  58. Rob Says:

    Hi Dang,

    You just need to delete the stuff on lines 141 to 159 and replace it with a BEC. More specifically, the elements of encoded_llrs should have values of +infinity, -infinity or 0, depending on whether the corresponding element of encoded_bits is a 0 or a 1 and whether that bit have been erased by the channel.

    Take care, Rob.

  59. Dang Anh Tuan Says:

    Hi Rob
    Thanks for your answer, i have another question. How can i calculate Block error rate (BLER) ?

  60. Rob Says:

    Hi Dang,

    This code already provides the BLER, although it refers to it as the Frame Error Rate (FER) instead - these two terms mean the same thing.

    Take care, Rob.

  61. Wu Zhou Says:

    Hi Rob
    Thank you for your code , I am a student , I am studying polar code, I want to simulate the BER (N=256,K=128 AWGN ) using this code, but I found it was not right (when the SNR=4dB , the BER =0.0132, the SNR=0,the BER=0.2175) ,Can you give me some advice?

  62. Rob Says:

    Hi Wu,

    I wonder if you are comparing the non-iterative polar decoding algorithm of my code with a more complex iterative algorithm from another paper. An iterative algorithm will give a lower BER, but will have a much higher complexity.

    Take care, Rob.

  63. Pascal Giard Says:

    Hi Wu,
    FWIW, I don’t know what you (Wu) are actually comparing but contrary to LDPC codes, with polar codes the use of a belief-propagation (BP) algorithm does not improve the BER much if at all. In fact, the successive-cancellation (SC) algorithm can be seen as a very efficient schedule of the BP algorithm where only one iteration is executed.

    There are many ways to improve the BER. Notably, the BER will improve if you use systematic encoding/decoding. The FER will remain unchanged though. If you use a maximum likelihood decoding algorithm, the BER/FER will also improve. As this will get complex very fast, it is typical to use an approximation like sphere decoding or more commonly List decoding.

    Finally, if you can afford doing a concatenation with a CRC, using List+CRC will significantly improve the BER/FER at little cost to the point where polar codes can be competitive with LDPC and turbo codes.

    As polar codes are pretty recent, searching about polar decoders on scholar.google.ca should get you started without getting too much swamped.

    Hope this helps!

    -Pascal

  64. Rob Says:

    Hi Pascal,

    Thank you for these thoughts.

    Take care, Rob.

  65. Andrew Says:

    Hi Rob

    I have a question!
    In main.cpp file:
    Parameters are read from the command line and/or a configuration file.

    I dont understand, how can i put them in this cfg file? And whats cfg file? DOXYGEN.CFG??

    TY and take care, Rob!

  66. Rob Says:

    Hi Andrew,

    doxygen.cfg is used to generate the documentation - it is not what you are looking for. You can see how to provide the parameters on the command line or in a configuration file at…
    http://users.ecs.soton.ac.uk/rm/wp-content/PolarCode/group__polar.html

    Take care, Rob.

  67. MADIOR Says:

    HI guys
    Iam very happy to discuss with you
    I on Polar codes and now my jobis to create Believe propagation decoding with polar codes please somebody can help me to have code source with Matlab
    Kindly Regards

  68. Rob Says:

    Hello Madior,

    I’m afraid that I don’t have any Matlab code for belief propagation. You could write this by converting my code to Matlab and then activating all check nodes alternately with all variable nodes.

    Take care, Rob.

  69. MADIOR Says:

    Hi ROB
    Thank you to answer my request , can i have your email ? i want to send you my method that i want to program

  70. Rob Says:

    Hi Madior,

    You can find my contact details at…
    http://users.ecs.soton.ac.uk/rm/profilecontact/

    Take care, Rob.

  71. Andrew Says:

    Hi Rob once again! Thanks for the previous answer!
    There was a question directly as coding. Why we transpose a vector? In methodical instructions it isn’t told that it is necessary. Besides, as a result, we use get_row(0). Why 0?
    And one more important point. Types of these “ivec” and “bvec” don’t allow me to see in the field of “data” all elements of these vectors, and, probably, only the first element. This any omission or this information for coding/decoding is simply not necessary for me or the program simply operates with the address of the first elemenrt of a vector, without forgetting about the others?

    Thanks, Rob!

  72. Rob Says:

    Hi Andrew,

    I’m wondering if you could be more specific in your question - can you point me to a particular line of a particular file in my code. I think that you are asking questions that are general to IT++, rather than specific to my code.

    Take care, Rob.

  73. Andrew Says:

    Hey, Rob!

    I have a question about a code, which you published on the site http://users .ecs.soton.ac.uk/.
    The matter is that I want to use decoding with PLR. But when I try to launch the project, I receive an error: “RobProb Error: Setting a normal-domain probability ratio to a negative value” at a demodulation stage. Why it occurs? Maybe I somehow incorrectly realize Main function?

    Part of my Main function right now:

    bvec encoded_bits = polar_code.encode(information_bits);

    cvec tx = bpsk.modulate_bits(encoded_bits);

    cvec rx = awgn(tx);

    plr_frame encoded_plrs = to_plr_frame(bpsk.demodulate_soft_bits(rx, N0)); <- here i become ERROR!!!

    Ty, best regars, Andrew!

  74. Rob Says:

    Hi Andrew,

    I suspect that this is because the bpsk.soft_demodulate function returns a vector of LLRs, rather than a vector of LLRs, represented by positive and negative floating point numbers. You may need to convert this to my LLR_frame data type, before converting to the plr_frame data type.

    Take care, Rob.

  75. MADIOR Says:

    HI ROB,
    Do you know how “ITERATIVE RECEIVER FOR MIMO SYSTEM BASED ON POLAR CODES ” works please help me for this issue
    Best Regards

  76. Andrew Says:

    Hey, Rob!

    how information sequence of A is created?
    I mean that we have N = 8, K = 5, u_A_c = (0,0,0);
    but how we receive from these data A vector = {3,5,6,7,8}??
    Whether there is any special rule of filling? After all i will need the N=1024, K = 512 code.

    ty for latest answer!!!

  77. Rob Says:

    Hi Madior,

    Iterative polar decoding can be achieved by iterating the operation of the variable nodes and the check nodes. It operates a bit like an LDPC decoder using a flooding schedule in this case.

    Take care, Rob.

  78. Andrew Says:

    if (difference>=5.0) log_probability = maximum + 0.0067;
    else if (difference>=3.0) log_probability = maximum + 0.049;
    else if (difference>=2.0) log_probability = maximum + 0.13;
    else if (difference>=1.5) log_probability = maximum + 0.2;
    else if (difference>=1.0) log_probability = maximum + 0.31;
    else if (difference>=0.6) log_probability = maximum + 0.44;
    else if (difference>=0.3) log_probability = maximum + 0.55;
    else log_probability = maximum + 0.69;

    ___________________________________________________________

    i mean, From where you took these values of probability which you add to a maximum? (0.31… 0.44…. 0.55…..)

    Besides, why generally to use the Jacobian? Arikan doesn’t have anything similar.
    Where I can read about it though something?

    The main issue consists that I have only code size N. And I have no information sequence of A yet. I shall select indexes of the frozen A_c elements. And so, how I can receive them? On a code I send N quantity of the potential frozen characters via the channel to check what good channels. Apprx. But further… not only that I don’t understand, why we use a Jacobian when decoding. I also don’t understand, why to use mutual information? If you don’t remember all this already, can you share a source, in which all these actions are described?

  79. Rob Says:

    Hi Andrew,

    Another of the commenters on this website asked the same question about these correction factors for the Jacobian logarithm and I’m afraid that I couldn’t remember where I got them from. They are approximating the function described in equation (1) and Figure 2 of http://eprints.soton.ac.uk/271618/9/Fixed-Point.PDF

    This function is used for the soft decoding of the check nodes in the factor graph of the polar code.

    In my previous work, I assumed that the indices of the frozen bits were chosen in an offline process and that these indices were known to both the transmitter and the receiver. I chose these indices using mutual information because this is the best way of measuring the quality of soft information that I am aware of.

    Take care, Rob.

  80. Michelle Says:

    Hi Rob,
    Thank you for your previous work on polar codes. I have complied IT++ with Microsoft Visual Studio 2010. I wonder if the source codes can be compiled in IT++ on Windows system. If it can be done, please tell me how to compile, please~And actually I had tried to make a simulation about SC decoding of polar codes (based on “Permuted Successive Cancellation Decoderfor Polar Codes”) with hybrid programming including C language and matlab, but the result shows a sudden increase in BER during high SNR and in low SNR it is normal waterfall. I check the code again and again, yet there is no clue. Is there any suggestion for me?Looking forward to your reply.

  81. Rob Says:

    Hi Michelle,

    I’m afraid that I can’t offer any advice about using IT++ on Windows. I have never tried to do it and I suspect that it is difficult to get working (I could never get it working properly on Mac, only on Linux).

    My guess would be that at high SNRs, you are suffering from numerical precision issues. In this case, you may have calculations involving very high numbers and very low numbers. If you are not already, you may like to consider performing all of your calculation in the logarithmic domain (i.e. by using LLRs), rather than in the normal domain (i.e. by using probabilities).

    Take care, Rob.

  82. Michelle Says:

    Thank you for your reply. I will follow your suggestions and adjust the precision. If it did not work well, the next thing I will do is to install the Linux system:). Thx~

  83. MADIOR Says:

    hi GUYS
    I would like to have an efficient polar codes decoding in matlab
    Please guys

  84. Rob Says:

    Hello Madior,

    I’m afraid that I don’t have a Matlab version of this code that I can share.

    Take care, Rob.

  85. MADIOR Says:

    Hi Rob,
    can i have C or C++ version
    Regrds

  86. Rob Says:

    Hi Madior,

    The code linked to above is written in C++ - it uses the IT++ libraries…
    http://users.ecs.soton.ac.uk/rm/wp-content/PolarCode110.zip

    Take care, Rob.

  87. xiaoyuge Says:

    hi, Rob
    Polar code construction i want used gaussian approximation.do you have any ideas?

    thank you

  88. Rob Says:

    Hi Xiaoyuge,

    I’m afraid that I haven’t looked into the gaussian approximation, so I don’t have any ideas.

    Take care, Rob.

  89. Kumud S. Altmayer Says:

    I give up, frustrated, wasted time. it doe snot run in either Dev C++ or MS visual C++. There is a missing file it says
    32 25 J:\IT+_polarcodes\PolarCode.h [Error] itpp/itbase.h: No such file or directory, program terminated.
    I will just use Matlab, am fed up now.

  90. Rob Says:

    Hello Kumud,

    I’m afraid that I can’t offer any support for IT++ - I have not used it in several years. I know that it is very difficult to setup in anything but Linux - it is (or at least it used to be) very easy in Linux.

    Take care, Rob.

  91. Hua Says:

    Hi Rob,

    I would like to simulate with N=1024, K=512. But I don’t know how to set the information set A. Can you give me an example of setting A, or is there any rule for setting A? Thx.

  92. Rob Says:

    Hi Hua,

    In my code, there is a function for designing (I call it training) the information set A. You can read about this at…
    http://users.ecs.soton.ac.uk/rm/wp-content/PolarCode/group__polar.html

    Take care, Rob.

Leave a Reply

Security Code: