0
$\begingroup$

Pardon me if it is off topic.But, is there anyone who could suggest me some basics with how to get started with working with C++ for GF(2)??

I am new in C++.I am learning to working with arrays and pointers. I have no idea if there is any in built function like MATLAB. Would be so helpful if anyone could suggest me anything. Any kind of suggestion is appreciated.

Thanks in Advance

$\endgroup$
7
  • 1
    $\begingroup$ Exactly what do you want to do with $GF(2)$? The field on two elements is just $\mathbb Z/2\mathbb Z$ and it's pretty easy to implement addition and multiplication. (Working with bitwise operators on a single bit, they are ^ and & respectively. Other ways to implement this are just as simple) $\endgroup$ May 31, 2016 at 17:13
  • $\begingroup$ hi,,thank you for your reply..Actually I am trying to encode and decode the LDPC code.I am using the binary codes. So,I am having to XOR, then Invert matrix and all in GF(2).It is easy to implement this in Matlab.I was wondering,if there is any in built function for that in Cplus plus.TIA $\endgroup$
    – nafila
    May 31, 2016 at 17:21
  • $\begingroup$ My (admittedly limited) experience suggests that most production (=appears in some standard) LDPC codes come with efficient encoding algorithms that don't require you to invert matrices over GF(2). The exception is the LDPC code in Chinese broadcasting standard that's released only in a totally unstructured form. The more challenging programming task (at least for me) was to implement the message passing (or belief propagation) algorithm. But, as others said, I doubt there is a standard library for dealing with this. Many developers have written their own, and you can ask at programming sites. $\endgroup$ Jun 1, 2016 at 10:03
  • $\begingroup$ (cont'd) FWIW I wrote mine in Free Pascal, because Pascal is my native (programming) language. $\endgroup$ Jun 1, 2016 at 10:03
  • $\begingroup$ Thank you for your answer and suggestions actually...I wanted to invert my matrix to calculate the parity. I am having to generate my own matrix and then apply some algorithms for efficient encoding. I have done this with MATLAB. But it does not allow me to work with an array size of 64000 which is DVBS 2 standard.SO I thought of using C++... $\endgroup$
    – nafila
    Jun 1, 2016 at 16:43

2 Answers 2

1
$\begingroup$

You could define your own operators for + and * by operator overloading. That means that you define the rules of GF(2) yourself, and you can then compute with it using the + and * operators.

$\endgroup$
1
  • $\begingroup$ Yes,,,I could be wrong since im just a beginner in using C plus plus. In that case, I will have to write the whole program.Isn't it? Its not possible like in matlab...For example im giving something..Lat's say you want to XOR the elements of a vector.you can use XOR function. You want to invert a square matrix.You can use INV(matrix)...but in case of Cplus plus,you have to implement the whole algorithm. Am I right? $\endgroup$
    – nafila
    May 31, 2016 at 18:51
-1
$\begingroup$

C++ is a general purpose programming language. It comes with a standard library, but nothing comparable to a dedicated mathematics package like Matlab.

Usually you look for external libraries that offer the desired functionality, in case you should really need unique Matlab functionality, you should investigate about interfaces between Matlab and C or C++. (Example)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .