1 | <html> |
---|
2 | <head> |
---|
3 | <title> |
---|
4 | A Tour of NTL: Examples: Extension Rings and Fields </title> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body bgcolor="#fff9e6"> |
---|
8 | <center> |
---|
9 | <a href="tour-ex4.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> |
---|
10 | <a href="tour-examples.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> |
---|
11 | <a href="tour-ex6.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> |
---|
12 | </center> |
---|
13 | |
---|
14 | <h1> |
---|
15 | <p align=center> |
---|
16 | A Tour of NTL: Examples: Extension Rings and Fields |
---|
17 | </p> |
---|
18 | </h1> |
---|
19 | |
---|
20 | <p> <hr> <p> |
---|
21 | |
---|
22 | NTL also supports extension rings and fields over finite fields, |
---|
23 | and polynomial arithmetic over such extensions. |
---|
24 | Here is a little program that illustrates this. |
---|
25 | |
---|
26 | <p> |
---|
27 | <pre> |
---|
28 | #include <NTL/ZZ_pXFactoring.h> |
---|
29 | #include <NTL/ZZ_pEX.h> |
---|
30 | |
---|
31 | int main() |
---|
32 | { |
---|
33 | ZZ_p::init(to_ZZ(17)); // define GF(17) |
---|
34 | |
---|
35 | ZZ_pX P; |
---|
36 | BuildIrred(P, 10); // generate an irreducible polynomial P |
---|
37 | // of degree 10 over GF(17) |
---|
38 | |
---|
39 | ZZ_pE::init(P); // define GF(17^10) |
---|
40 | |
---|
41 | ZZ_pEX f, g, h; // declare polynomials over GF(17^10) |
---|
42 | |
---|
43 | random(f, 20); // f is a random, monic polynomial of degree 20 |
---|
44 | SetCoeff(f, 20); |
---|
45 | |
---|
46 | random(h, 20); // h is a random polynomial of degree less than 20 |
---|
47 | |
---|
48 | g = MinPolyMod(h, f); // compute the minimum polynomial of h modulo f |
---|
49 | |
---|
50 | if (g == 0) Error("oops (1)"); // check that g != 0 |
---|
51 | |
---|
52 | if (CompMod(g, h, f) != 0) // check that g(h) = 0 mod f |
---|
53 | Error("oops (2)"); |
---|
54 | } |
---|
55 | </pre> |
---|
56 | |
---|
57 | <p> |
---|
58 | This example illustrates building extension rings over <tt>ZZ_p</tt>. |
---|
59 | One can also use <tt>zz_p</tt> and <tt>GF2</tt> as base classes; |
---|
60 | the syntax is exactly the same. |
---|
61 | |
---|
62 | <p> |
---|
63 | See <a href="ZZ_pE.txt"><tt>ZZ_pE.txt</tt></a> for the basics of the extension |
---|
64 | ring <tt>ZZ_pE</tt> over <tt>ZZ_p</tt>. |
---|
65 | Also see <a href="ZZ_pEX.txt"><tt>ZZ_pEX.txt</tt></a> for polynomial |
---|
66 | arithmetic over <tt>ZZ_pE</tt>, and |
---|
67 | <a href="ZZ_pEXFactoring.txt"><tt>ZZ_pEXFactoring.txt</tt></a> for factoring |
---|
68 | routines over <tt>ZZ_pE</tt>. |
---|
69 | See <a href="vec_ZZ_pE.txt"><tt>vec_ZZ_pE.txt</tt></a> for vectors over <tt>ZZ_pE</tt>, |
---|
70 | and <a href="mat_ZZ_pE.txt"><tt>mat_ZZ_pE.txt</tt></a> for matrices over <tt>ZZ_pE</tt>. |
---|
71 | |
---|
72 | <p> |
---|
73 | See <a href="lzz_pE.txt"><tt>lzz_pE.txt</tt></a> for the basics of the extension |
---|
74 | ring <tt>zz_pE</tt> over <tt>zz_p</tt>. |
---|
75 | Also see <a href="lzz_pEX.txt"><tt>lzz_pEX.txt</tt></a> for polynomial |
---|
76 | arithmetic over <tt>zz_pE</tt>, and |
---|
77 | <a href="lzz_pEXFactoring.txt"><tt>lzz_pEXFactoring.txt</tt></a> for factoring |
---|
78 | routines over <tt>zz_pE</tt>. |
---|
79 | See <a href="vec_lzz_pE.txt"><tt>vec_lzz_pE.txt</tt></a> for vectors over <tt>zz_pE</tt>, |
---|
80 | and <a href="mat_lzz_pE.txt"><tt>mat_lzz_pE.txt</tt></a> for matrices over <tt>zz_pE</tt>. |
---|
81 | |
---|
82 | <p> |
---|
83 | See <a href="GF2E.txt"><tt>GF2E.txt</tt></a> for the basics of the extension |
---|
84 | ring <tt>GF2E</tt> over <tt>GF2</tt>. |
---|
85 | Also see <a href="GF2EX.txt"><tt>GF2EX.txt</tt></a> for polynomial |
---|
86 | arithmetic over <tt>GF2E</tt>, and |
---|
87 | <a href="GF2EXFactoring.txt"><tt>GF2EXFactoring.txt</tt></a> for factoring |
---|
88 | routines over <tt>GF2E</tt>. |
---|
89 | See <a href="vec_GF2E.txt"><tt>vec_GF2E.txt</tt></a> for vectors over <tt>GF2E</tt>, |
---|
90 | and <a href="mat_GF2E.txt"><tt>mat_GF2E.txt</tt></a> for matrices over <tt>GF2E</tt>. |
---|
91 | |
---|
92 | |
---|
93 | <center> |
---|
94 | <a href="tour-ex4.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> |
---|
95 | <a href="tour-examples.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> |
---|
96 | <a href="tour-ex6.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> |
---|
97 | </center> |
---|
98 | |
---|
99 | </body> |
---|
100 | </html> |
---|