Sin( x y ) Image Border.

COMPUTING PRIMITIVE POLYNOMIALS


Overview

We present C++ software for a program which generates a primitive polynomial of degree n modulo p. You can optionally find all primitive polynomials.

A sample run from the command line:

$ pp 13 10

Primpoly Version 5.3 - A Program for Computing Primitive Polynomials. Copyright (C) 1999-2008 by Sean Erik O'Connor. All Rights Reserved. Primpoly comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License. This is free software, and you are welcome to redistribute it under certain conditions; see the GNU General Public License for details.

Primitive polynomial modulo 13 of degree 10

x ^ 10 + 2 x ^ 2 + 2 x + 2

Features

Download

The C++ version seems to be working now. I'm currently debugging it more thoroughly and optimizing it for speed. The C version below is stable.

Source code and executables are distributed under the terms of the GNU General Public License Current version is 8.0

I have an in-depth explanation of the software design of this program and the theory behind the algorithms used. See also the examples and test cases. to verify if the program is working correctly.

Click on the Compact disk icon for source code download. to view and download.
Compact disk icon for source code download. Primpoly.cpp Main program.
Compact disk icon for source code download. Primpoly.h Header file containing parameters and constants.
Compact disk icon for source code download. ppArith.cpp Modulo p integer arithmetic.
Compact disk icon for source code download. ppArith.h Modulo p integer arithmetic class.
Compact disk icon for source code download. ppFactor.cpp Factoring into primes and primality testing.
Compact disk icon for source code download. ppFactor.h Factoring into primes and primality testing class.
Compact disk icon for source code download. ppParser.cpp Polynomial I/O. I took the liberty of using my own LALR(1) parser generator on a simple polynomial grammar to automatically generate the parser. Here is the grammar and its LALR(1) parse tables. The C++ LR parser isn't hard to implement using STL vectors and the automatically generated parse tables above.
Compact disk icon for source code download. ppParser.h Polynomial I/O.
Compact disk icon for source code download. ppPolynomial.cpp Polynomial arithmetic.
Compact disk icon for source code download. ppPolynomial.h Polynomial arithmetic class.
Compact disk icon for source code download. BigInt.cpp Multiple precision integer arithmetic.
Compact disk icon for source code download. BigInt.h Multiple precision integer arithmetic class.
Compact disk icon for source code download. ppUnitTest.cpp Unit test function for all the classes and their member functions. Runs always and prints to a log file.
Compact disk icon for source code download. makefile Makefile for Unix systems and Windows systems running Cygwin.

Download C Version

It does have limits on the size of p and n since it uses integer arithmetic. See the documentation for more details. For p=2 we can go as high as n=62.

Source code and executables are distributed under the terms of the GNU General Public License Current version is 5.3

Click on the Compact disk icon for source code download. to view and download
Compact disk icon for source code download. Primpoly.c This is the main program.
Compact disk icon for source code download. Primpoly.h This is the header file containing parameters and constants.
Compact disk icon for source code download. ppHelperFunc.c High level helper functions.
Compact disk icon for source code download. ppArith.c Modulo p integer arithmetic, primitive root testing.
Compact disk icon for source code download. ppFactor.c Factoring into primes and primality testing.
Compact disk icon for source code download. ppIO.c Polynomial I/O.
Compact disk icon for source code download. ppPolyArith.c Polynomial arithmetic.
Compact disk icon for source code download. ppOrder.c Polynomial order testing.
Compact disk icon for source code download. makefile Makefile for Unix systems and Windows systems running Cygwin.

Install and Run

On Mac OS X, I also use the Xcode IDE. On a Windows XP PC system, I use the GNU Cygwin toolset for command line compiling and debugging. On Unix systems, including Mac OS X, I use the built-in gcc compiler and gdb debugger. For details on the C++ language, see Bjarne Stroustrup's Page and C++ FAQ Lite and the Standard Template Library.

Uses for Primitive Polynomials:

Acknowledgements


Copyright © 1986-2008 by Sean Erik O'Connor. All Rights Reserved.     last updated 12 May 08.