Introduction

Here you can find some (hopefully) useful C++ libraries.

Index


Computing with Galois fields

What do I find here?

A C++ library for computing with Galois fields. It handles any finite field and it should be fairly portable. There is a specialized (hopefully, more efficient) version for GF(2n) which stores field elements as integers (rather than vector of integers) and uses bitwise operators.

Interesting... Can you show me a typical usage?

Sure, here it is
                   GF<3, 2>  x, y; // Work with GF(3^2)
              
                   std::cin >> x >> y;          // Read x and y from stdin
              
                   std::cout << x+y;            // Sum
              
                   std::cout << x*y;            // Product
              
                   if (not y.is_zero())         // if (y!=0) works too, but it is
                     {                          // sligthly less efficient
              
                        std::cout << inv(y)     // Inverse and  division
                                  << x/y;            
                     }
              
You can also give a look to the documentation or to the ChangeLog.

Cool! where do I get it?

Here (version 0.1)