<html> <head> <title> A Tour of NTL: Examples: Extension Rings and Fields </title> </head> <body bgcolor="#fff9e6"> <center> <a href="tour-ex4.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> <a href="tour-examples.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> <a href="tour-ex6.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> </center> <h1> <p align=center> A Tour of NTL: Examples: Extension Rings and Fields </p> </h1> <p> <hr> <p> NTL also supports extension rings and fields over finite fields, and polynomial arithmetic over such extensions. Here is a little program that illustrates this. <p> <pre> #include <NTL/ZZ_pXFactoring.h> #include <NTL/ZZ_pEX.h> NTL_CLIENT int main() { ZZ_p::init(to_ZZ(17)); // define GF(17) ZZ_pX P; BuildIrred(P, 10); // generate an irreducible polynomial P // of degree 10 over GF(17) ZZ_pE::init(P); // define GF(17^10) ZZ_pEX f, g, h; // declare polynomials over GF(17^10) random(f, 20); // f is a random, monic polynomial of degree 20 SetCoeff(f, 20); random(h, 20); // h is a random polynomial of degree less than 20 g = MinPolyMod(h, f); // compute the minimum polynomial of h modulo f if (g == 0) Error("oops (1)"); // check that g != 0 if (CompMod(g, h, f) != 0) // check that g(h) = 0 mod f Error("oops (2)"); } </pre> <p> This example illustrates building extension rings over <tt>ZZ_p</tt>. One can also use <tt>zz_p</tt> and <tt>GF2</tt> as base classes; the syntax is exactly the same. <p> See <a href="ZZ_pE.txt"><tt>ZZ_pE.txt</tt></a> for the basics of the extension ring <tt>ZZ_pE</tt> over <tt>ZZ_p</tt>. Also see <a href="ZZ_pEX.txt"><tt>ZZ_pEX.txt</tt></a> for polynomial arithmetic over <tt>ZZ_pE</tt>, and <a href="ZZ_pEXFactoring.txt"><tt>ZZ_pEXFactoring.txt</tt></a> for factoring routines over <tt>ZZ_pE</tt>. See <a href="vec_ZZ_pE.txt"><tt>vec_ZZ_pE.txt</tt></a> for vectors over <tt>ZZ_pE</tt>, and <a href="mat_ZZ_pE.txt"><tt>mat_ZZ_pE.txt</tt></a> for matrices over <tt>ZZ_pE</tt>. <p> See <a href="lzz_pE.txt"><tt>lzz_pE.txt</tt></a> for the basics of the extension ring <tt>zz_pE</tt> over <tt>zz_p</tt>. Also see <a href="lzz_pEX.txt"><tt>lzz_pEX.txt</tt></a> for polynomial arithmetic over <tt>zz_pE</tt>, and <a href="lzz_pEXFactoring.txt"><tt>lzz_pEXFactoring.txt</tt></a> for factoring routines over <tt>zz_pE</tt>. See <a href="vec_lzz_pE.txt"><tt>vec_lzz_pE.txt</tt></a> for vectors over <tt>zz_pE</tt>, and <a href="mat_lzz_pE.txt"><tt>mat_lzz_pE.txt</tt></a> for matrices over <tt>zz_pE</tt>. <p> See <a href="GF2E.txt"><tt>GF2E.txt</tt></a> for the basics of the extension ring <tt>GF2E</tt> over <tt>GF2</tt>. Also see <a href="GF2EX.txt"><tt>GF2EX.txt</tt></a> for polynomial arithmetic over <tt>GF2E</tt>, and <a href="GF2EXFactoring.txt"><tt>GF2EXFactoring.txt</tt></a> for factoring routines over <tt>GF2E</tt>. See <a href="vec_GF2E.txt"><tt>vec_GF2E.txt</tt></a> for vectors over <tt>GF2E</tt>, and <a href="mat_GF2E.txt"><tt>mat_GF2E.txt</tt></a> for matrices over <tt>GF2E</tt>. <center> <a href="tour-ex4.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> <a href="tour-examples.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> <a href="tour-ex6.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> </center> </body> </html>