[BACK]Return to ff.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts

Diff for /OpenXM/src/asir-doc/parts/ff.texi between version 1.1 and 1.4

version 1.1, 1999/12/08 05:47:44 version 1.4, 2003/04/19 10:36:30
Line 1 
Line 1 
   @comment $OpenXM: OpenXM/src/asir-doc/parts/ff.texi,v 1.3 2000/01/13 08:29:56 noro Exp $
   \BJP
 @node $BM-8BBN$K4X$9$k1i;;(B,,, Top  @node $BM-8BBN$K4X$9$k1i;;(B,,, Top
 @chapter $BM-8BBN$K4X$9$k1i;;(B  @chapter $BM-8BBN$K4X$9$k1i;;(B
   \E
   \BEG
   @node Finite fields,,, Top
   @chapter Finite fields
   \E
   
 @menu  @menu
   \BJP
 * $BM-8BBN$NI=8=$*$h$S1i;;(B::  * $BM-8BBN$NI=8=$*$h$S1i;;(B::
 * $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B::  * $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B::
 * $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B::  * $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B::
 * $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B::  * $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B::
   \E
   \BEG
   * Representation of finite fields::
   * Univariate polynomials on finite fields::
   * Elliptic curves on finite fields::
   * Functions for Finite fields::
   \E
 @end menu  @end menu
   
   \BJP
 @node $BM-8BBN$NI=8=$*$h$S1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B  @node $BM-8BBN$NI=8=$*$h$S1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B
 @section $BM-8BBN$NI=8=$*$h$S1i;;(B  @section $BM-8BBN$NI=8=$*$h$S1i;;(B
   \E
   \BEG
   @node Representation of finite fields,,, Finite fields
   @section Representation of finite fields
   \E
   
 @noindent  @noindent
 @b{Asir} $B$K$*$$$F$O(B, $BM-8BBN$O(B, $B@5I8?tAGBN(B GF(p), $BI8?t(B 2 $B$NM-8BBN(B GF(2^n)  \BJP
   @b{Asir} $B$K$*$$$F$O(B, $BM-8BBN$O(B, $B@5I8?tAGBN(B GF(p), $BI8?t(B 2 $B$NM-8BBN(B GF(2^n),
   GF(p) $B$N(B n $B<!3HBg(B GF(p^n)
 $B$,Dj5A$G$-$k(B. $B$3$l$i$OA4$F(B, @code{setmod_ff()} $B$K$h$jDj5A$5$l$k(B.  $B$,Dj5A$G$-$k(B. $B$3$l$i$OA4$F(B, @code{setmod_ff()} $B$K$h$jDj5A$5$l$k(B.
   \E
   \BEG
   On @b{Asir} @var{GF(p)}, @var{GF(2^n)}, @var{GF(p^n} can be defined, where
   @var{GF(p)} is a finite prime field of charateristic @var{p},
   @var{GF(2^n)} is a finite field of characteristic 2 and
   @var{GF(p^n} is a finite extension of @var{GF(p)}. These are
   all defined by @code{setmod_ff()}.
   \E
   
 @example  @example
 [0] P=pari(nextprime,2^50);  [0] P=pari(nextprime,2^50);
Line 30  x^50+x^4+x^3+x^2+1
Line 61  x^50+x^4+x^3+x^2+1
 x^50+x^4+x^3+x^2+1  x^50+x^4+x^3+x^2+1
 [6] field_type_ff();  [6] field_type_ff();
 2  2
   [7] setmod_ff(x^3+x+1,1125899906842679);
   [1*x^3+1*x+1,1125899906842679]
   [8] field_type_ff();
   3
   [9] setmod_ff(3,5);
   [3,x^5+2*x+1,x]
   [10] field_type_ff();
   4
 @end example  @end example
 @code{setmod_ff()} $B$O(B, $B0z?t$,@5@0?t(B p $B$N>l9g(B GF(p), n $B<!B?9`<0(B f(x) $B$N>l(B  \BJP
   @code{setmod_ff()} $B$O(B, $B$5$^$6$^$J%?%$%W$NM-8BBN$r4pACBN$H$7$F%;%C%H$9$k(B.
   $B0z?t$,@5@0?t(B p $B$N>l9g(B GF(p), n $B<!B?9`<0(B f(x) $B$N>l(B
 $B9g(B, f(x) mod 2 $B$rDj5AB?9`<0$H$9$k(B GF(2^n) $B$r$=$l$>$l4pACBN$H$7$F%;%C%H$9(B  $B9g(B, f(x) mod 2 $B$rDj5AB?9`<0$H$9$k(B GF(2^n) $B$r$=$l$>$l4pACBN$H$7$F%;%C%H$9(B
 $B$k(B. @code{setmod_ff()} $B$K$*$$$F$O0z?t$N4{Ls%A%'%C%/$O9T$o$:(B, $B8F$S=P$7B&(B  $B$k(B. $B$^$?(B, $BM-8BAGBN$NM-8B<!3HBg$bDj5A$G$-$k(B. $B>\$7$/$O(B @xref{$B?t$N7?(B}.
   @code{setmod_ff()} $B$K$*$$$F$O0z?t$N4{Ls%A%'%C%/$O9T$o$:(B, $B8F$S=P$7B&(B
 $B$,@UG$$r;}$D(B.  $B$,@UG$$r;}$D(B.
   
 $B4pACBN$H$O(B, $B$"$/$^$GM-8BBN$N85$H$7$F@k8@$"$k$$$ODj5A$5$l$?%*%V%8%'%/%H$,(B,  $B4pACBN$H$O(B, $B$"$/$^$GM-8BBN$N85$H$7$F@k8@$"$k$$$ODj5A$5$l$?%*%V%8%'%/%H$,(B,
Line 48  x^50+x^4+x^3+x^2+1
Line 90  x^50+x^4+x^3+x^2+1
   
 $BM-8BBN$N85$NF~NOJ}K!$O(B, $BM-8BBN$N<oN`$K$h$jMM!9$G$"$k(B. GF(p) $B$N>l9g(B,  $BM-8BBN$N85$NF~NOJ}K!$O(B, $BM-8BBN$N<oN`$K$h$jMM!9$G$"$k(B. GF(p) $B$N>l9g(B,
 @code{simp_ff()} $B$K$h$k(B.  @code{simp_ff()} $B$K$h$k(B.
   \E
   
   \BEG
   If @var{p} is a positive integer, @code{setmod_ff(@var{p})} sets
   @var{GF(p)} as the current base field.
   If @var{f} is a univariate polynomial of degree @var{n},
   @code{setmod_ff(@var{f})} sets @var{GF(2^n)} as the current
   base field.  @var{GF(2^n)} is represented
   as an algebraic extension of @var{GF(2)} with the defining polynomial
   @var{f mod 2}. Furthermore, finite extensions of prime finite fields
   can be defined. @xref{Types of numbers}.
   In all cases the primality check of the argument is
   not done and the caller is responsible for it.
   
   Correctly speaking there is no actual object corresponding to a 'base field'.
   Setting a base field means that operations on elements of finite fields
   are done according to the arithmetics of the base field. Thus, if
   operands of an arithmetic operation are both rational numbers, then the result
   is also a rational number. However, if one of the operands is in
   a finite field, then the other is automatically regarded as in the
   same finite field and the operation is done in the finite field.
   
   A non zero element of a finite field belongs to the number and has object
   identifier 1. Its number identifier is 6 if the finite field is @var{GF(p)},
   7 if it is @var{GF(2^n)}.
   
   There are several methods to input an element of a finite field.
   An element of @var{GF(p)} can be input by @code{simp_ff()}.
   \E
   
 @example  @example
 [0] P=pari(nextprime,2^50);  [0] P=pari(nextprime,2^50);
 1125899906842679  1125899906842679
Line 60  x^50+x^4+x^3+x^2+1
Line 131  x^50+x^4+x^3+x^2+1
 6  6
 @end example  @end example
   
 $B$^$?(B, GF(2^n) $B$N>l9g$$$/$D$+$NJ}K!$,$"$k(B.  \JP $B$^$?(B, GF(2^n) $B$N>l9g$$$/$D$+$NJ}K!$,$"$k(B.
   \EG In the case of @var{GF(2^n)} the following methods are available.
   
 @example  @example
 [0] setmod_ff(x^50+x^4+x^3+x^2+1);  [0] setmod_ff(x^50+x^4+x^3+x^2+1);
 x^50+x^4+x^3+x^2+1  x^50+x^4+x^3+x^2+1
Line 74  x^50+x^4+x^3+x^2+1
Line 147  x^50+x^4+x^3+x^2+1
 (@@^9+@@^8+@@^7+@@^6+@@^5+@@^4+@@^3+@@^2+@@+1)  (@@^9+@@^8+@@^7+@@^6+@@^5+@@^4+@@^3+@@^2+@@+1)
 @end example  @end example
   
   \BJP
 $BM-8BBN$N85$O?t$G$"$j(B, $BBN1i;;$,2DG=$G$"$k(B. @code{@@} $B$O(B  $BM-8BBN$N85$O?t$G$"$j(B, $BBN1i;;$,2DG=$G$"$k(B. @code{@@} $B$O(B
 GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7$/$O(B @xref{$B?t$N7?(B}.  GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7$/$O(B @xref{$B?t$N7?(B}.
   \E
   \BEG
   Elements of finite fields are numbers and one can apply field arithmetics
   to them. @code{@@} is a generator of @var{GF(2^n)} over @var{GF(2)}.
   @xref{Types of numbers}.
   \E
   
 @noindent  @noindent
   
   \BJP
 @node $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B  @node $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B
 @section $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B  @section $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B
   \E
   \BEG
   @node Univariate polynomials on finite fields,,, Finite fields
   @section Univariate polynomials on finite fields
   \E
   
 @noindent  @noindent
   \BJP
 @samp{fff} $B$G$O(B, $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0$KBP$7(B, $BL5J?J}J,2r(B, DDF, $B0x?tJ,2r(B,  @samp{fff} $B$G$O(B, $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0$KBP$7(B, $BL5J?J}J,2r(B, DDF, $B0x?tJ,2r(B,
 $BB?9`<0$N4{LsH=Dj$J$I$N4X?t$,Dj5A$5$l$F$$$k(B.  $BB?9`<0$N4{LsH=Dj$J$I$N4X?t$,Dj5A$5$l$F$$$k(B.
   
 $B$$$:$l$b(B, $B7k2L$O(B [@b{$B0x;R(B}, @b{$B=EJ#EY(B}] $B$N%j%9%H$H$J$k$,(B, $B0x;R$O(B monic  $B$$$:$l$b(B, $B7k2L$O(B [@b{$B0x;R(B}, @b{$B=EJ#EY(B}] $B$N%j%9%H$H$J$k$,(B, $B0x;R$O(B monic
 $B$H$J$j(B, $BF~NOB?9`<0$N<g78?t$O<N$F$i$l$k(B.  $B$H$J$j(B, $BF~NOB?9`<0$N<g78?t$O<N$F$i$l$k(B.
   
 @noindent  
 $BL5J?J}J,2r$O(B, $BB?9`<0$H$=$NHyJ,$H$N(B GCD $B$N7W;;$+$i;O$^$k$b$C$H$b0lHLE*$J(B  $BL5J?J}J,2r$O(B, $BB?9`<0$H$=$NHyJ,$H$N(B GCD $B$N7W;;$+$i;O$^$k$b$C$H$b0lHLE*$J(B
 $B%"%k%4%j%:%`$r:NMQ$7$F$$$k(B.  $B%"%k%4%j%:%`$r:NMQ$7$F$$$k(B.
   
 @example  
 @end example  
   
 @noindent  
 $BM-8BBN>e$G$N0x?tJ,2r$O(B, DDF $B$N8e(B, $B<!?tJL0x;R$NJ,2r$N:]$K(B, Berlekamp  $BM-8BBN>e$G$N0x?tJ,2r$O(B, DDF $B$N8e(B, $B<!?tJL0x;R$NJ,2r$N:]$K(B, Berlekamp
 $B%"%k%4%j%:%`$GNm6u4V$r5a$a(B, $B4pDl%Y%/%H%k$N:G>.B?9`<0$r5a$a(B, $B$=$N:,(B  $B%"%k%4%j%:%`$GNm6u4V$r5a$a(B, $B4pDl%Y%/%H%k$N:G>.B?9`<0$r5a$a(B, $B$=$N:,(B
 $B$r(B Cantor-Zassenhaus $B%"%k%4%j%:%`$K$h$j5a$a$k(B, $B$H$$$&J}K!$r<BAu$7$F$$$k(B.  $B$r(B Cantor-Zassenhaus $B%"%k%4%j%:%`$K$h$j5a$a$k(B, $B$H$$$&J}K!$r<BAu$7$F$$$k(B.
   \E
   \BEG
   In @samp{fff} square-free factorization, DDF (distinct degree factorization),
   irreducible factorization and primality check are implemented for
   univariate polynomials over finite fields.
   
 @example  Factorizers return lists of [@b{factor},@b{multiplicity}]. The factor
 @end example  part is monic and the information on the leading coefficient of the
   input polynomial is abandoned.
   
   The algorithm used in square-free factorization is the most primitive one.
   
   The irreducible factorization proceeds as follows.
   
   @enumerate
   @item DDF
   @item Nullspace computation by Berlekamp algorithm
   @item Root finding of minimal polynomials of bases of the nullspace
   @item Separation of irreducible factors by the roots
   @end enumerate
   \E
   
   \BJP
 @node $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B  @node $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B
 @section $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B  @section $BM-8BBN>e$NBJ1_6J@~$K4X$9$k1i;;(B
   \E
   \BEG
   @node Elliptic curves on finite fields,,, Finite fields
   @section Elliptic curves on finite fields
   \E
   
   \BJP
 $BM-8BBN>e$NBJ1_6J@~$K4X$9$k$$$/$D$+$N4pK\E*$J1i;;$,(B, $BAH$_9~$_4X?t$H$7$F(B  $BM-8BBN>e$NBJ1_6J@~$K4X$9$k$$$/$D$+$N4pK\E*$J1i;;$,(B, $BAH$_9~$_4X?t$H$7$F(B
 $BDs6!$5$l$F$$$k(B.  $BDs6!$5$l$F$$$k(B.
   
Line 133  GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7
Line 240  GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7
 $B1i;;7k2L$b@F<!:BI8$GF@$i$l$k$,(B, @var{z} $B:BI8$,(B 1 $B$H$O8B$i$J$$$?$a(B,  $B1i;;7k2L$b@F<!:BI8$GF@$i$l$k$,(B, @var{z} $B:BI8$,(B 1 $B$H$O8B$i$J$$$?$a(B,
 $B%"%U%#%s:BI8$r5a$a$k$?$a$K$O(B @var{x}, @var{y} $B:BI8$r(B @var{z} $B:BI8$G(B  $B%"%U%#%s:BI8$r5a$a$k$?$a$K$O(B @var{x}, @var{y} $B:BI8$r(B @var{z} $B:BI8$G(B
 $B3d$kI,MW$,$"$k(B.  $B3d$kI,MW$,$"$k(B.
   \E
   
   \BEG
   Several fundamental operations on elliptic curves over finite fields
   are provided as built-in functions.
   
   An elliptic curve is specified by a vector @var{[a b]} of length 2,
   where @var{a}, @var{b} are elements of finite fields.
   If the current base field is a prime field, then @var{[a b]} represents
   @var{y^2=x^3+ax+b}. If the current base field is a finite field of
   characteristic 2, then @var{[a b]} represents @var{y^2+xy=x^3+ax^2+b}.
   
   Points on an elliptic curve together with the point at infinity
   forms an additive group. The addition, the subtraction and the
   additive inverse operation are provided as @code{ecm_add_ff()},
   @code{ecm_sub_ff()} and @code{ecm_chsgn_ff()} respectively.
   Here the representation of points are as follows.
   
   @itemize @bullet
   @item 0 denotes the point at infinity.
   @item The other points are represented by vectors @var{[x y z]} of
   length 3 with non-zero @var{z}.
   @end itemize
   
   @var{[x y z]} represents a projective coordinate and
   it corresponds to @var{[x/z y/z]} in the affine coordinate.
   To apply the above operations to a point @var{[x y]},
   @var{[x y 1]} should be used instead as an argument.
   The result of an operation is also represented by the projective
   coordinate. As the third coordinate is not always equal to 1,
   one has to divide the first and the scond coordinate by the third
   one to obtain the affine coordinate.
   \E
   
   \BJP
 @node $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B,,, $BM-8BBN$K4X$9$k1i;;(B  @node $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B,,, $BM-8BBN$K4X$9$k1i;;(B
 @section $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  @section $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \E
   \BEG
   @node Functions for Finite fields,,, Finite fields
   @section Functions for Finite fields
   \E
   
 @menu  @menu
 * setmod_ff::  * setmod_ff::
Line 158  GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7
Line 304  GF(2^n) $B$N(B, GF(2)$B>e$N@8@.85$G$"$k(B. $B>\$7
 * extdeg_ff::  * extdeg_ff::
 @end menu  @end menu
   
 @node setmod_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node setmod_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node setmod_ff,,, Functions for Finite fields
 @subsection @code{setmod_ff}  @subsection @code{setmod_ff}
 @findex setmod_ff  @findex setmod_ff
   
 @table @t  @table @t
 @item setmod_ff([@var{prime}|@var{poly}])  @item setmod_ff([@var{prime}|@var{poly}])
 :: $BM-8BBN$N@_Dj(B, $B@_Dj$5$l$F$$$kM-8BBN$NK!(B, $BDj5AB?9`<0$NI=<((B  \JP :: $BM-8BBN$N@_Dj(B, $B@_Dj$5$l$F$$$kM-8BBN$NK!(B, $BDj5AB?9`<0$NI=<((B
   \EG :: Sets/Gets the current base fields.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t$^$?$OB?9`<0(B  \JP $B?t$^$?$OB?9`<0(B
   \EG number or polynomial
 @item prime  @item prime
 $BAG?t(B  \JP $BAG?t(B
   \EG prime
 @item poly  @item poly
 GF(2) $B>e4{Ls$J(B 1 $BJQ?tB?9`<0(B  \JP GF(2) $B>e4{Ls$J(B 1 $BJQ?tB?9`<0(B
   \EG univariate polynomial irreducible over GF(2)
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B0z?t$,@5@0?t(B @var{prime} $B$N;~(B, GF(@var{prime}) $B$r4pACBN$H$7$F@_Dj$9$k(B.  $B0z?t$,@5@0?t(B @var{prime} $B$N;~(B, GF(@var{prime}) $B$r4pACBN$H$7$F@_Dj$9$k(B.
 @item  @item
 $B0z?t$,B?9`<0(B @var{poly} $B$N;~(B,  $B0z?t$,B?9`<0(B @var{poly} $B$N;~(B,
 GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod2)  GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod 2)
 $B$r4pACBN$H$7$F@_Dj$9$k(B.  $B$r4pACBN$H$7$F@_Dj$9$k(B.
 @item  @item
 $BL50z?t$N;~(B, $B@_Dj$5$l$F$$$k4pACBN$,(B GF(@var{prime}) $B$N>l9g(B @var{prime},  $BL50z?t$N;~(B, $B@_Dj$5$l$F$$$k4pACBN$,(B GF(@var{prime}) $B$N>l9g(B @var{prime},
Line 189  GF(2^n) $B$N>l9gDj5AB?9`<0$rJV$9(B. 
Line 341  GF(2^n) $B$N>l9gDj5AB?9`<0$rJV$9(B. 
 @item  @item
 GF(2^n) $B$NDj5AB?9`<0$O(B, GF(2) $B>e(B n $B<!4{Ls$J$i$J$s$G$bNI$$$,(B, $B8zN($K(B  GF(2^n) $B$NDj5AB?9`<0$O(B, GF(2) $B>e(B n $B<!4{Ls$J$i$J$s$G$bNI$$$,(B, $B8zN($K(B
 $B1F6A$9$k$?$a(B, @code{defpoly_mod2()} $B$G@8@.$9$k$N$,$h$$(B.  $B1F6A$9$k$?$a(B, @code{defpoly_mod2()} $B$G@8@.$9$k$N$,$h$$(B.
   \E
   \BEG
   @item
   If the argument is a non-negative integer @var{prime}, GF(@var{prime})
   is set as the current base field.
   @item
   If the argument is a polynomial @var{poly},
   GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod2)
   is set as the current base field.
   @item
   If no argument is specified, the modulus indicating the current base field
   is returned. If the current base field is GF(@var{prime}), @var{prime} is
   returned. If it is GF(2^n), the defining polynomial is returned.
   @item
   Any irreducible univariate polynomial over GF(2) is available to
   set GF(2^n). However the use of @code{defpoly_mod2()} is recommended
   for efficiency.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 201  x^100+x^15+1
Line 371  x^100+x^15+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{defpoly_mod2}  @fref{defpoly_mod2}
 @end table  @end table
   
 @node field_type_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node field_type_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node field_type_ff,,, Functions for Finite fields
 @subsection @code{field_type_ff}  @subsection @code{field_type_ff}
 @findex field_type_ff  @findex field_type_ff
   
 @table @t  @table @t
 @item field_type_ff()  @item field_type_ff()
 :: $B@_Dj$5$l$F$$$k4pACBN$N<oN`(B  \JP :: $B@_Dj$5$l$F$$$k4pACBN$N<oN`(B
   \EG :: Type of the current base field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t(B  \JP $B@0?t(B
   \EG integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B@_Dj$5$l$F$$$k4pACBN$N<oN`$rJV$9(B.  $B@_Dj$5$l$F$$$k4pACBN$N<oN`$rJV$9(B.
 @item  @item
 $B@_Dj$J$7$J$i(B 0, GF(p) $B$J$i(B 1, GF(2^n) $B$J$i(B 2 $B$rJV$9(B.  $B@_Dj$J$7$J$i(B 0, GF(p) $B$J$i(B 1, GF(2^n) $B$J$i(B 2 $B$rJV$9(B.
   \E
   \BEG
   @item
   Returns the type of the current base field.
   @item
   If no field is set, 0 is returned. If GF(p) is set, 1 is returned.
   If GF(2^n) is set, 2 is returned.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 240  x^2+x+1
Line 423  x^2+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node field_order_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node field_order_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node field_order_ff,,, Functions for Finite fields
 @subsection @code{field_order_ff}  @subsection @code{field_order_ff}
 @findex field_order_ff  @findex field_order_ff
   
 @table @t  @table @t
 @item field_order_ff()  @item field_order_ff()
 :: $B@_Dj$5$l$F$$$k4pACBN$N0L?t(B  \JP :: $B@_Dj$5$l$F$$$k4pACBN$N0L?t(B
   \EG :: Order of the current base field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t(B  \JP $B@0?t(B
   \EG integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B@_Dj$5$l$F$$$k4pACBN$N0L?t(B ($B85$N8D?t(B) $B$rJV$9(B.  $B@_Dj$5$l$F$$$k4pACBN$N0L?t(B ($B85$N8D?t(B) $B$rJV$9(B.
 @item  @item
 $B@_Dj$5$l$F$$$kBN$,(B GF(q) $B$J$i$P(B q $B$rJV$9(B.  $B@_Dj$5$l$F$$$kBN$,(B GF(q) $B$J$i$P(B q $B$rJV$9(B.
   \E
   \BEG
   @item
   Returns the order of the current base field.
   @item
   @var{q} is returned if the current base field is GF(q).
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 280  x^2+x+1
Line 475  x^2+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node characteristic_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node characteristic_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node characteristic_ff,,, Functions for Finite fields
 @subsection @code{characteristic_ff}  @subsection @code{characteristic_ff}
 @findex characteristic_ff  @findex characteristic_ff
   
 @table @t  @table @t
 @item characteristic_ff()  @item characteristic_ff()
 :: $B@_Dj$5$l$F$$$kBN$NI8?t(B  \JP :: $B@_Dj$5$l$F$$$kBN$NI8?t(B
   \EG :: Characteristic of the current base field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t(B  \JP $B@0?t(B
   \EG integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B@_Dj$5$l$F$$$kBN$NI8?t$rJV$9(B.  $B@_Dj$5$l$F$$$kBN$NI8?t$rJV$9(B.
 @item  @item
 GF(p) $B$N>l9g(B p, GF(2^n) $B$N>l9g(B 2 $B$rJV$9(B.  GF(p) $B$N>l9g(B p, GF(2^n) $B$N>l9g(B 2 $B$rJV$9(B.
   \E
   \BEG
   @item
   Returns the characteristic of the current base field.
   @item
   @var{p} is returned if @var{GF(p)}, where @var{p} is a prime, is set.
   @var{2} is returned if @var{GF(2^n)} is set.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 320  x^2+x+1
Line 528  x^2+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node extdeg_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node extdeg_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node extdeg_ff,,, Functions for Finite fields
 @subsection @code{extdeg_ff}  @subsection @code{extdeg_ff}
 @findex extdeg_ff  @findex extdeg_ff
   
 @table @t  @table @t
 @item extdeg_ff()  @item extdeg_ff()
 :: $B@_Dj$5$l$F$$$k4pACBN$N(B, $BAGBN$KBP$9$k3HBg<!?t(B  \JP :: $B@_Dj$5$l$F$$$k4pACBN$N(B, $BAGBN$KBP$9$k3HBg<!?t(B
   \EG :: Extension degree of the current base field over the prime field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t(B  \JP $B@0?t(B
   \EG integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B@_Dj$5$l$F$$$k4pACBN$N(B, $BAGBN$KBP$9$k3HBg<!?t$rJV$9(B.  $B@_Dj$5$l$F$$$k4pACBN$N(B, $BAGBN$KBP$9$k3HBg<!?t$rJV$9(B.
 @item  @item
 GF(p) $B$N>l9g(B 1, GF(2^n) $B$N>l9g(B n $B$rJV$9(B.  GF(p) $B$N>l9g(B 1, GF(2^n) $B$N>l9g(B n $B$rJV$9(B.
   \E
   \BEG
   @item
   Returns the extension degree of the current base field over the prime field.
   @item
   GF(p) $B$N>l9g(B 1, GF(2^n) $B$N>l9g(B n $B$rJV$9(B.
   1 is returned if @var{GF(p)}, where @var{p} is a prime, is set.
   @var{n} is returned if @var{GF(2^n)} is set.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 360  x^2+x+1
Line 582  x^2+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node simp_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node simp_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node simp_ff,,, Functions for Finite fields
 @subsection @code{simp_ff}  @subsection @code{simp_ff}
 @findex simp_ff  @findex simp_ff
   
 @table @t  @table @t
 @item simp_ff(@var{obj})  @item simp_ff(@var{obj})
 :: $B?t(B, $B$"$k$$$OB?9`<0$N78?t$rM-8BBN$N85$KJQ49(B  \JP :: $B?t(B, $B$"$k$$$OB?9`<0$N78?t$rM-8BBN$N85$KJQ49(B
   \BEG
   :: Converts numbers or coefficients of polynomials into elements
   in finite fields.
   \E
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B?t$^$?$OB?9`<0(B  \JP $B?t$^$?$OB?9`<0(B
   \EG number or polynomial
 @item obj  @item obj
 $B?t$^$?$OB?9`<0(B  \JP $B?t$^$?$OB?9`<0(B
   \EG number or polynomial
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B?t(B, $B$"$k$$$OB?9`<0$N78?t$rM-8BBN$N85$KJQ49$9$k(B.  $B?t(B, $B$"$k$$$OB?9`<0$N78?t$rM-8BBN$N85$KJQ49$9$k(B.
 @item  @item
Line 389  x^2+x+1
Line 620  x^2+x+1
 @item  @item
 $BM-8BBN$N85$KBP$7(B, $BK!$"$k$$$ODj5AB?9`<0$K$h$k(B reduction $B$r9T$&>l9g$K$b(B  $BM-8BBN$N85$KBP$7(B, $BK!$"$k$$$ODj5AB?9`<0$K$h$k(B reduction $B$r9T$&>l9g$K$b(B
 $BMQ$$$k(B.  $BMQ$$$k(B.
   \E
   \BEG
   @item
   Converts numbers or coefficients of polynomials into elements in finite
   fields.
   @item
   It is used to convert integers or intrgral polynomials int
   elements of finite fields or polynomials over finite fields.
   @item
   An element of a finite field may not have the reduced representation.
   In such case an application of @code{simp_ff} assures the output has
   the reduced representation.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 403  x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120
Line 647  x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton}  @fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton}
 @end table  @end table
   
 @node random_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node random_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node random_ff,,, Functions for Finite fields
 @subsection @code{random_ff}  @subsection @code{random_ff}
 @findex random_ff  @findex random_ff
   
 @table @t  @table @t
 @item random_ff()  @item random_ff()
 :: $BM-8BBN$N85$NMp?t@8@.(B  \JP :: $BM-8BBN$N85$NMp?t@8@.(B
   \EG :: Random generation of an element of a finite field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $BM-8BBN$N85(B  \JP $BM-8BBN$N85(B
   \EG element of a finite field
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $BM-8BBN$N85$rMp?t@8@.$9$k(B.  $BM-8BBN$N85$rMp?t@8@.$9$k(B.
 @item  @item
 GF(p) $B$N>l9g(B, 0 $B0J>e(B p $BL$K~$N@0?t$G$"$i$o$5$l$k(B GF(p) $B$N85(B,  
 GF(2^n) $B$N>l9g(B, n $B<!L$K~$N(B GF(2) $B>e$NB?9`<0$GI=$5$l$k(B GF(2^n) $B$r(B  
 $BJV$9(B.  
 @item  
 @code{random()}, @code{lrandom()} $B$HF1$8(B 32bit $BMp?tH/@84o$r;HMQ$7$F$$$k(B.  @code{random()}, @code{lrandom()} $B$HF1$8(B 32bit $BMp?tH/@84o$r;HMQ$7$F$$$k(B.
   \E
   \BEG
   @item
   Generates an element of the current base field randomly.
   @item
   The same random generator as in @code{random()}, @code{lrandom()}
   is used.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 445  return to toplevel
Line 698  return to toplevel
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}, @fref{random}, @fref{lrandom}  @fref{setmod_ff}, @fref{random}, @fref{lrandom}
 @end table  @end table
   
 @node lmptop,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node lmptop,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node lmptop,,, Functions for Finite fields
 @subsection @code{lmptop}  @subsection @code{lmptop}
 @findex lmptop  @findex lmptop
   
 @table @t  @table @t
 @item lmptop(@var{obj})  @item lmptop(@var{obj})
 :: GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49(B  \JP :: GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49(B
   \EG :: Converts the coefficients of a polynomial over GF(p) into integers.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B@0?t78?tB?9`<0(B  \JP $B@0?t78?tB?9`<0(B
   \EG integral polynomial
 @item obj  @item obj
 GF(p)$B78?tB?9`<0(B  \JP GF(p) $B78?tB?9`<0(B
   \EG polynomial over GF(p)
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49$9$k(B.  GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49$9$k(B.
 @item  @item
 GF(p) $B$N85$O(B, 0 $B0J>e(B p $BL$K~$N@0?t$GI=8=$5$l$F$$$k(B.  GF(p) $B$N85$O(B, 0 $B0J>e(B p $BL$K~$N@0?t$GI=8=$5$l$F$$$k(B.
 $BB?9`<0$N3F78?t$O(B, $B$=$NCM$r@0?t%*%V%8%'%/%H(B($B?t<1JL;R(B 0)$B$H$7$?$b$N$K(B  $BB?9`<0$N3F78?t$O(B, $B$=$NCM$r@0?t%*%V%8%'%/%H(B($B?t<1JL;R(B 0)$B$H$7$?$b$N$K(B
 $BJQ49$5$l$k(B.  $BJQ49$5$l$k(B.
   \E
   \BEG
 @item  @item
 GF(p) $B$N85$O(B, $B@0?t$KJQ49$5$l$k(B.  Converts the coefficients of a polynomial over GF(p) into integers.
   @item
   An element of GF(p) is represented by a non-negative integer @var{r} less than
   @var{p}.
   Each coefficient of a polynomial is converted into an integer object
   whose value is @var{r}.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 495  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
Line 762  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{simp_ff}  @fref{simp_ff}
 @end table  @end table
   
 @node ntogf2n,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node ntogf2n,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node ntogf2n,,, Functions for Finite fields
 @subsection @code{ntogf2n}  @subsection @code{ntogf2n}
 @findex ntogf2n  @findex ntogf2n
   
 @table @t  @table @t
 @item ntogf2n(@var{m})  @item ntogf2n(@var{m})
 :: $B<+A3?t$r(B GF(2^n) $B$N85$KJQ49(B  \JP :: $B<+A3?t$r(B GF(2^n) $B$N85$KJQ49(B
   \EG :: Converts a non-negative integer into an element of GF(2^n).
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 GF(2^n) $B$N85(B  \JP GF(2^n) $B$N85(B
   \EG element of GF(2^n)
 @item m  @item m
 $BHsIi@0?t(B  \JP $BHsIi@0?t(B
   \EG non-negative integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B<+A3?t(B @var{m} $B$N(B 2 $B?JI=8=(B @var{m}=@var{m0}+@var{m1}*2+...+@var{mk}*2^k  $B<+A3?t(B @var{m} $B$N(B 2 $B?JI=8=(B @var{m}=@var{m0}+@var{m1}*2+...+@var{mk}*2^k
 $B$KBP$7(B, GF(2^n)=GF(2)[t]/(g(t)) $B$N85(B  $B$KBP$7(B, GF(2^n)=GF(2)[t]/(g(t)) $B$N85(B
Line 523  GF(2^n) $B$N85(B
Line 796  GF(2^n) $B$N85(B
 @item  @item
 $BDj5AB?9`<0$K$h$k>jM>$O<+F0E*$K$O7W;;$5$l$J$$$?$a(B, @code{simp_ff()} $B$r(B  $BDj5AB?9`<0$K$h$k>jM>$O<+F0E*$K$O7W;;$5$l$J$$$?$a(B, @code{simp_ff()} $B$r(B
 $BE,MQ$9$kI,MW$,$"$k(B.  $BE,MQ$9$kI,MW$,$"$k(B.
   \E
   \BEG
   @item
   Let @var{m} be a non-negative integer.
   @var{m} has the binary representation
   @var{m}=@var{m0}+@var{m1}*2+...+@var{mk}*2^k.
   This function returns an element of  GF(2^n)=GF(2)[t]/(g(t)),
   @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t).
   @item
   Apply @code{simp_ff()} to reduce the result.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 535  x^30+x+1
Line 819  x^30+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{gf2nton}  @fref{gf2nton}
 @end table  @end table
   
 @node gf2nton,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node gf2nton,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node gf2nton,,, Functions for Finite fields
 @subsection @code{gf2nton}  @subsection @code{gf2nton}
 @findex gf2nton  @findex gf2nton
   
 @table @t  @table @t
 @item gf2nton(@var{m})  @item gf2nton(@var{m})
 :: GF(2^n) $B$N85$r<+A3?t$KJQ49(B  \JP :: GF(2^n) $B$N85$r<+A3?t$KJQ49(B
   \EG :: Converts an element of GF(2^n) into a non-negative integer.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $BHsIi@0?t(B  \JP $BHsIi@0?t(B
   \EG non-negative integer
 @item m  @item m
 GF(2^n) $B$N85(B  \JP GF(2^n) $B$N85(B
   \EG element of GF(2^n)
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
 @item  @item
 @code{gf2nton} $B$N5UJQ49$G$"$k(B.  \JP @code{gf2nton} $B$N5UJQ49$G$"$k(B.
   \EG The inverse of @code{gf2nton}.
 @end itemize  @end itemize
   
 @example  @example
Line 574  x^30+x+1
Line 864  x^30+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{gf2nton}  @fref{gf2nton}
 @end table  @end table
   
 @node ptogf2n,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node ptogf2n,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node ptogf2n,,, Functions for Finite fields
 @subsection @code{ptogf2n}  @subsection @code{ptogf2n}
 @findex ptogf2n  @findex ptogf2n
   
 @table @t  @table @t
 @item ptogf2n(@var{poly})  @item ptogf2n(@var{poly})
 :: $B0lJQ?tB?9`<0$r(B GF(2^n) $B$N85$KJQ49(B  \JP :: $B0lJQ?tB?9`<0$r(B GF(2^n) $B$N85$KJQ49(B
   \EG :: Converts a univariate polynomial into an element of GF(2^n).
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 GF(2^n) $B$N85(B  \JP GF(2^n) $B$N85(B
   \EG element of GF(2^n)
 @item poly  @item poly
 $B0lJQ?tB?9`<0(B  \JP $B0lJQ?tB?9`<0(B
   \EG univariate polynomial
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
 @item  @item
   \BJP
 @var{poly} $B$NI=$9(B GF(2^n) $B$N85$r@8@.$9$k(B. $B78?t$O(B, 2 $B$G3d$C$?M>$j$K(B  @var{poly} $B$NI=$9(B GF(2^n) $B$N85$r@8@.$9$k(B. $B78?t$O(B, 2 $B$G3d$C$?M>$j$K(B
 $BJQ49$5$l$k(B.  $BJQ49$5$l$k(B.
 @var{poly} $B$NJQ?t$K(B @code{@@} $B$rBeF~$7$?7k2L$HEy$7$$(B.  @var{poly} $B$NJQ?t$K(B @code{@@} $B$rBeF~$7$?7k2L$HEy$7$$(B.
   \E
   \BEG
   Generates an element of GF(2^n) represented by @var{poly}.
   The coefficients are reduced modulo 2.
   The output is equal to the result by substituting @code{@@} for
   the variable of @var{poly}.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 609  x^30+x+1
Line 912  x^30+x+1
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{gf2ntop}  @fref{gf2ntop}
 @end table  @end table
   
 @node gf2ntop,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node gf2ntop,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node gf2ntop,,, Functions for Finite fields
 @subsection @code{gf2ntop}  @subsection @code{gf2ntop}
 @findex gf2ntop  @findex gf2ntop
   
 @table @t  @table @t
 @item gf2ntop(@var{m}[,@var{v}])  @item gf2ntop(@var{m}[,@var{v}])
 :: GF(2^n) $B$N85$rB?9`<0$KJQ49(B  \JP :: GF(2^n) $B$N85$rB?9`<0$KJQ49(B
   \EG :: Converts an element of GF(2^n) into a polynomial.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B0lJQ?tB?9`<0(B  \JP $B0lJQ?tB?9`<0(B
   \EG univariate polynomial
 @item m  @item m
 GF(2^n) $B$N85(B  \JP GF(2^n) $B$N85(B
   \EG an element of GF(2^n)
 @item v  @item v
 $BITDj85(B  \JP $BITDj85(B
   \EG indeterminate
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 @var{m} $B$rI=$9B?9`<0$r(B, $B@0?t78?t$NB?9`<0%*%V%8%'%/%H$H$7$FJV$9(B.  @var{m} $B$rI=$9B?9`<0$r(B, $B@0?t78?t$NB?9`<0%*%V%8%'%/%H$H$7$FJV$9(B.
 @item @var{v} $B$N;XDj$,$J$$>l9g(B, $BD>A0$N(B @code{ptogf2n()} $B8F$S=P$7(B  @item
   @var{v} $B$N;XDj$,$J$$>l9g(B, $BD>A0$N(B @code{ptogf2n()} $B8F$S=P$7(B
 $B$K$*$1$k0z?t$NJQ?t(B ($B%G%U%)%k%H$O(B @code{x}), $B;XDj$,$"$k>l9g$K$O(B  $B$K$*$1$k0z?t$NJQ?t(B ($B%G%U%)%k%H$O(B @code{x}), $B;XDj$,$"$k>l9g$K$O(B
 $B;XDj$5$l$?ITDj85$rJQ?t$H$9$kB?9`<0$rJV$9(B.  $B;XDj$5$l$?ITDj85$rJQ?t$H$9$kB?9`<0$rJV$9(B.
   \E
   \BEG
   @item
   Returns a polynomial representing @var{m}.
   @item
   If @var{v} is used as the variable of the output.
   If @var{v} is not specified, the variable of the argument
   of the latest @code{ptogf2n()} call. The default variable is @code{x}.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 652  t^13+t^12+t^11+t^10
Line 972  t^13+t^12+t^11+t^10
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{ptogf2n}  @fref{ptogf2n}
 @end table  @end table
   
 @node defpoly_mod2,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node defpoly_mod2,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node defpoly_mod2,,, Functions for Finite fields
 @subsection @code{defpoly_mod2}  @subsection @code{defpoly_mod2}
 @findex defpoly_mod2  @findex defpoly_mod2
   
 @table @t  @table @t
 @item defpoly_mod2(@var{d})  @item defpoly_mod2(@var{d})
 :: GF(2) $B>e4{Ls$J0lJQ?tB?9`<0$N@8@.(B  \JP :: GF(2) $B>e4{Ls$J0lJQ?tB?9`<0$N@8@.(B
   \EG :: Generates an irreducible univariate polynomial over GF(2).
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $BB?9`<0(B  \JP $BB?9`<0(B
   \EG univariate polynomial
 @item d  @item d
 $B@5@0?t(B  \JP $B@5@0?t(B
   \EG positive integer
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 @samp{fff} $B$GDj5A$5$l$F$$$k(B.  @samp{fff} $B$GDj5A$5$l$F$$$k(B.
 @item  @item
Line 682  t^13+t^12+t^11+t^10
Line 1008  t^13+t^12+t^11+t^10
 3 $B9`<0$,B8:_$7$J$1$l$P(B, $B4{Ls(B 5 $B9`<0$NCf$G(B, $BBh(B 2 $B9`$N<!?t$,$b$C$H$b>.$5$/(B,  3 $B9`<0$,B8:_$7$J$1$l$P(B, $B4{Ls(B 5 $B9`<0$NCf$G(B, $BBh(B 2 $B9`$N<!?t$,$b$C$H$b>.$5$/(B,
 $B$=$NCf$GBh(B 3 $B9`$N<!?t$,$b$C$H$b>.$5$/(B, $B$=$NCf$GBh(B 4 $B9`$N<!?t$,$b$C$H$b(B  $B$=$NCf$GBh(B 3 $B9`$N<!?t$,$b$C$H$b>.$5$/(B, $B$=$NCf$GBh(B 4 $B9`$N<!?t$,$b$C$H$b(B
 $B>.$5$$$b$N$rJV$9(B.  $B>.$5$$$b$N$rJV$9(B.
   \E
   \BEG
   @item
   Defined in @samp{fff}.
   @item
   An irreducible univariate polynomial of degree @var{d} is returned.
   @item
   If an irreducible trinomial @var{x^d+x^m+1} exists, then the one
   with the smallest @var{m} is returned.
   Otherwise, an irreducible pentanomial @var{x^d+x^m1+x^m2+x^m3+1}
   (@var{m1>m2>m3} is returned.
   @var{m1}, @var{m2} and @var{m3} are determined as follows:
   Fix @var{m1} as small as possible. Then fix @var{m2} as small as possible.
   Then fix @var{m3} as small as possible.
   \E
 @end itemize  @end itemize
   
 @example  @example
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node fctr_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node fctr_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node fctr_ff,,, Functions for Finite fields
 @subsection @code{fctr_ff}  @subsection @code{fctr_ff}
 @findex fctr_ff  @findex fctr_ff
   
 @table @t  @table @t
 @item fctr_ff(@var{poly})  @item fctr_ff(@var{poly})
 :: 1 $BJQ?tB?9`<0$NM-8BBN>e$G$N4{LsJ,2r(B  \JP :: 1 $BJQ?tB?9`<0$NM-8BBN>e$G$N4{LsJ,2r(B
   \EG :: Irreducible univariate factorization over a finite field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B%j%9%H(B  \JP $B%j%9%H(B
   \EG list
 @item poly  @item poly
 $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0(B  \JP $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0(B
   \EG univariate polynomial over a finite field
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 @samp{fff} $B$GDj5A$5$l$F$$$k(B.  @samp{fff} $B$GDj5A$5$l$F$$$k(B.
 @item  @item
Line 719  t^13+t^12+t^11+t^10
Line 1066  t^13+t^12+t^11+t^10
 $B=EJ#EY$G$"$k(B.  $B=EJ#EY$G$"$k(B.
 @item  @item
 @var{poly} $B$N<g78?t$O<N$F$i$l$k(B.  @var{poly} $B$N<g78?t$O<N$F$i$l$k(B.
   \E
   \BEG
   @item
   Defined in @samp{fff}.
   @item
   Factorize @var{poly} into irreducible factors over the current base field.
   @item
   The result is a list [[@var{f1},@var{m1}],[@var{f2},@var{m2}],...],
   where @var{fi} is a monic irreducible factor and @var{mi} is its
   multiplicity.
   @item
   The leading coefficient of @var{poly} is abandoned.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 730  t^13+t^12+t^11+t^10
Line 1090  t^13+t^12+t^11+t^10
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node irredcheck_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node irredcheck_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node irredcheck_ff,,, Functions for Finite fields
 @subsection @code{irredcheck_ff}  @subsection @code{irredcheck_ff}
 @findex irredcheck_ff  @findex irredcheck_ff
   
 @table @t  @table @t
 @item irredcheck_ff(@var{poly})  @item irredcheck_ff(@var{poly})
 :: 1 $BJQ?tB?9`<0$NM-8BBN>e$G$N4{LsH=Dj(B  \JP :: 1 $BJQ?tB?9`<0$NM-8BBN>e$G$N4{LsH=Dj(B
   \EG :: Primality check of a univariate polynomial over a finite field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 0|1  0|1
 @item poly  @item poly
 $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0(B  \JP $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0(B
   \EG univariate polynomial over a finite field
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 @samp{fff} $B$GDj5A$5$l$F$$$k(B.  @samp{fff} $B$GDj5A$5$l$F$$$k(B.
 @item  @item
 $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0$N4{LsH=Dj$r9T$$(B, $B4{Ls$N>l9g(B 1, $B$=$l0J30$O(B 0 $B$rJV$9(B.  $BM-8BBN>e$N(B 1 $BJQ?tB?9`<0$N4{LsH=Dj$r9T$$(B, $B4{Ls$N>l9g(B 1, $B$=$l0J30$O(B 0 $B$rJV$9(B.
   \E
   \BEG
   @item
   Defined in @samp{fff}.
   @item
   Returns 1 if @var{poly} is irreducible over the current base field.
   Returns 0 otherwise.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 767  x^10+14687973587364016969
Line 1140  x^10+14687973587364016969
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
 @node randpoly_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node randpoly_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node randpoly_ff,,, Functions for Finite fields
 @subsection @code{randpoly_ff}  @subsection @code{randpoly_ff}
 @findex randpoly_ff  @findex randpoly_ff
   
 @table @t  @table @t
 @item randpoly_ff(@var{d},@var{v})  @item randpoly_ff(@var{d},@var{v})
 :: $BM-8BBN>e$N(B $BMp?t78?t(B 1 $BJQ?tB?9`<0$N@8@.(B  \JP :: $BM-8BBN>e$N(B $BMp?t78?t(B 1 $BJQ?tB?9`<0$N@8@.(B
   \EG :: Generation of a random univariate polynomial over a finite field.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $BB?9`<0(B  \JP $BB?9`<0(B
   \EG polynomial
 @item d  @item d
 $B@5@0?t(B  \JP $B@5@0?t(B
   \EG positive integer
 @item v  @item v
 $BITDj85(B  \JP $BITDj85(B
   \EG indeterminate
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 @samp{fff} $B$GDj5A$5$l$F$$$k(B.  @samp{fff} $B$GDj5A$5$l$F$$$k(B.
 @item  @item
 @var{d} $B<!L$K~(B, $BJQ?t$,(B @var{v}, $B78?t$,8=:_@_Dj$5$l$F$$$kM-8BBN$KB0$9$k(B  @var{d} $B<!L$K~(B, $BJQ?t$,(B @var{v}, $B78?t$,8=:_@_Dj$5$l$F$$$kM-8BBN$KB0$9$k(B
 1 $BJQ?tB?9`<0$r@8@.$9$k(B. $B78?t$O(B @code{random_ff()} $B$K$h$j@8@.$5$l$k(B.  1 $BJQ?tB?9`<0$r@8@.$9$k(B. $B78?t$O(B @code{random_ff()} $B$K$h$j@8@.$5$l$k(B.
   \E
   \BEG
   @item
   Defined in @samp{fff}.
   @item
   Generates a polynomial of @var{v} such that the degree is less than @var{d}
   and the coefficients are in the current base field.
   The coefficients are generated by @code{random_ff()}.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 810  x^10+14687973587364016969
Line 1199  x^10+14687973587364016969
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}, @fref{random_ff}  @fref{setmod_ff}, @fref{random_ff}
 @end table  @end table
   
 @node ecm_add_ff ecm_sub_ff ecm_chsgn_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B  \JP @node ecm_add_ff ecm_sub_ff ecm_chsgn_ff,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node ecm_add_ff ecm_sub_ff ecm_chsgn_ff,,, Functions for Finite fields
 @subsection @code{ecm_add_ff}, @code{ecm_sub_ff}, @code{ecm_chsgn_ff}  @subsection @code{ecm_add_ff}, @code{ecm_sub_ff}, @code{ecm_chsgn_ff}
 @findex ecm_add_ff  @findex ecm_add_ff
 @findex ecm_sub_ff  @findex ecm_sub_ff
Line 823  x^10+14687973587364016969
Line 1214  x^10+14687973587364016969
 @table @t  @table @t
 @item ecm_add_ff(@var{p1},@var{p2},@var{ec})  @item ecm_add_ff(@var{p1},@var{p2},@var{ec})
 @itemx ecm_sub_ff(@var{p1},@var{p2},@var{ec})  @itemx ecm_sub_ff(@var{p1},@var{p2},@var{ec})
 @itemx ecm_chsgn_ff(@var{p1},@var{p2},@var{ec})  @itemx ecm_chsgn_ff(@var{p1})
 :: $BBJ1_6J@~>e$NE@$N2C;;(B, $B8:;;(B, $B5U85(B  \JP :: $BBJ1_6J@~>e$NE@$N2C;;(B, $B8:;;(B, $B5U85(B
   \EG :: Addition, Subtraction and additive inverse for points on an elliptic curve.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 $B%Y%/%H%k$^$?$O(B 0  \JP $B%Y%/%H%k$^$?$O(B 0
   \EG vector or 0
 @item p1,p2  @item p1,p2
 $BD9$5(B 3 $B$N%Y%/%H%k$^$?$O(B 0  \JP $BD9$5(B 3 $B$N%Y%/%H%k$^$?$O(B 0
   \EG vector of length 3 or 0
 @item ec  @item ec
 $BD9$5(B 2 $B$N%Y%/%H%k(B  \JP $BD9$5(B 2 $B$N%Y%/%H%k(B
   \EG vector of length 2
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B8=:_@_Dj$5$l$F$$$kM-8BBN>e$G(B,  @var{ec} $B$GDj5A$5$l$kBJ1_6J@~>e$N(B  $B8=:_@_Dj$5$l$F$$$kM-8BBN>e$G(B,  @var{ec} $B$GDj5A$5$l$kBJ1_6J@~>e$N(B
 $BE@(B @var{p1}, @var{p2} $B$NOB(B @var{p1+p2}, $B:9(B @var{p1-p2}, $B5U85(B @var{-p1} $B$rJV$9(B.  $BE@(B @var{p1}, @var{p2} $B$NOB(B @var{p1+p2}, $B:9(B @var{p1-p2}, $B5U85(B @var{-p1} $B$rJV$9(B.
Line 855  x^10+14687973587364016969
Line 1251  x^10+14687973587364016969
 $B$G3d$kI,MW$,$"$k(B.  $B$G3d$kI,MW$,$"$k(B.
 @item  @item
 @var{p1}, @var{p2} $B$,BJ1_6J@~>e$NE@$+$I$&$+$N%A%'%C%/$O$7$J$$(B.  @var{p1}, @var{p2} $B$,BJ1_6J@~>e$NE@$+$I$&$+$N%A%'%C%/$O$7$J$$(B.
   \E
   \BEG
   @item
   Let @var{p1}, @var{p2} be points on the elliptic curve represented by
   @var{ec} over the current base field.
   ecm_add_ff(@var{p1},@var{p2},@var{ec}), ecm_sub_ff(@var{p1},@var{p2},@var{ec})
   and ecm_chsgn_ff(@var{p1}) returns
   @var{p1+p2}, @var{p1-p2} and @var{-p1} respectively.
   @item
   If the current base field is a prime field of odd order, then
   @var{ec} represents @var{y^2=x^3+ec[0]x+ec[1]}.
   If the characteristic of the current base field is 2,
   then @var{ec} represents @var{y^2+xy=x^3+ec[0]x^2+ec[1]}.
   @item
   The point at infinity is represented by 0.
   @item
   If an argument denoting a point is a vector of length 3,
   then it is the projective coordinate. In such a case
   the third coordinate must not be 0.
   @item
   If the result is a vector of length 3, then the third coordinate
   is not equal to 0 but not necessarily 1. To get the result by
   the affine coordinate, the first and the second coordinates should
   be divided by the third coordinate.
   @item
   The check whether the arguments are on the curve is omitted.
   \E
 @end itemize  @end itemize
   
 @example  @example
Line 878  x^10+14687973587364016969
Line 1301  x^10+14687973587364016969
 @end example  @end example
   
 @table @t  @table @t
 @item $B;2>H(B  \JP @item $B;2>H(B
   \EG @item References
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>