[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.3 and 1.8

version 1.3, 2000/01/13 08:29:56 version 1.8, 2005/09/08 07:40:49
Line 1 
Line 1 
 @comment $OpenXM: OpenXM/src/asir-doc/parts/ff.texi,v 1.2 1999/12/21 02:47:31 noro Exp $  @comment $OpenXM: OpenXM/src/asir-doc/parts/ff.texi,v 1.7 2003/04/21 03:07:32 noro Exp $
 \BJP  \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
Line 12 
Line 12 
 \BJP  \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::
   * $B>.I8?tM-8BBN>e$G$NB?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  \E
 \BEG  \BEG
 * Representation of finite fields::  * Representation of finite fields::
 * Univariate polynomials on finite fields::  * Univariate polynomials on finite fields::
   * Polynomials on small finite fields::
 * Elliptic curves on finite fields::  * Elliptic curves on finite fields::
 * Functions for Finite fields::  * Functions for Finite fields::
 \E  \E
Line 34 
Line 36 
   
 @noindent  @noindent
 \BJP  \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)  @b{Asir} $B$K$*$$$F$O(B, $BM-8BBN$O(B, $B@5I8?tAGBN(B GF(@var{p}), $BI8?t(B 2 $B$NM-8BBN(B GF(2^@var{n}),
   GF(@var{p}) $B$N(B @var{n} $B<!3HBg(B GF(@var{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  \E
 \BEG  \BEG
 On @b{Asir} @var{GF(p)} and @var{GF(2^n)} can be defined, where  On @b{Asir} GF(@var{p}), GF(2^@var{n}), GF(@var{p^n}) can be defined, where
 @var{GF(p)} is a finite prime field of charateristic @var{p} and  GF(@var{p}) is a finite prime field of charateristic @var{p},
 @var{GF(2^n)} is a finite field of characteristic 2. These are  GF(2^@var{n}) is a finite field of characteristic 2 and
   GF(@var{p^n}) is a finite extension of GF(@var{p}). These are
 all defined by @code{setmod_ff()}.  all defined by @code{setmod_ff()}.
 \E  \E
   
Line 59  x^50+x^4+x^3+x^2+1
Line 63  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
 \BJP  \BJP
 @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  @code{setmod_ff()} $B$O(B, $B$5$^$6$^$J%?%$%W$NM-8BBN$r4pACBN$H$7$F%;%C%H$9$k(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  $B0z?t$,@5@0?t(B @var{p} $B$N>l9g(B GF(@var{p}), @var{n} $B<!B?9`<0(B f(x) $B$N>l(B
 $B$k(B. @code{setmod_ff()} $B$K$*$$$F$O0z?t$N4{Ls%A%'%C%/$O9T$o$:(B, $B8F$S=P$7B&(B  $B9g(B, f(x) mod 2 $B$rDj5AB?9`<0$H$9$k(B GF(2^@var{n}) $B$r$=$l$>$l4pACBN$H$7$F%;%C%H$9(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 73  x^50+x^4+x^3+x^2+1
Line 87  x^50+x^4+x^3+x^2+1
 $B$k(B.  $B$k(B.
   
 0 $B$G$J$$M-8BBN$N85$O(B, $B?t%*%V%8%'%/%H$G$"$j(B, $B<1JL;R$NCM$O(B 1 $B$G$"$k(B.  0 $B$G$J$$M-8BBN$N85$O(B, $B?t%*%V%8%'%/%H$G$"$j(B, $B<1JL;R$NCM$O(B 1 $B$G$"$k(B.
 $B$5$i$K(B, 0 $B$G$J$$M-8BBN$N85$N?t<1JL;R$O(B, GF(p) $B$N>l9g(B 6, GF(2^n) $B$N>l9g(B 7  $B$5$i$K(B, 0 $B$G$J$$M-8BBN$N85$N?t<1JL;R$O(B, GF(@var{p}) $B$N>l9g(B 6, GF(2^@var{n}) $B$N>l9g(B 7
 $B$H$J$k(B.  $B$H$J$k(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,  $BM-8BBN$N85$NF~NOJ}K!$O(B, $BM-8BBN$N<oN`$K$h$jMM!9$G$"$k(B. GF(@var{p}) $B$N>l9g(B,
 @code{simp_ff()} $B$K$h$k(B.  @code{simp_ff()} $B$K$h$k(B.
 \E  \E
   
 \BEG  \BEG
 If @var{p} is a positive integer, @code{setmod_ff(@var{p})} sets  If @var{p} is a positive integer, @code{setmod_ff(@var{p})} sets
 @var{GF(p)} as the current base field.  GF(@var{p}) as the current base field.
 If @var{f} is a univariate polynomial of degree @var{n},  If @var{f} is a univariate polynomial of degree @var{n},
 @code{setmod_ff(@var{f})} sets @var{GF(2^n)} as the current  @code{setmod_ff(@var{f})} sets GF(2^@var{n}) as the current
 base field.  @var{GF(2^n)} is represented  base field.  GF(2^@var{n}) is represented
 as an algebraic extension of @var{GF(2)} with the defining polynomial  as an algebraic extension of GF(2) with the defining polynomial
 @var{f mod 2}. In both cases the primality check of the argument is  @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.  not done and the caller is responsible for it.
   
 Correctly speaking there is no actual object corresponding to a 'base field'.  Correctly speaking there is no actual object corresponding to a 'base field'.
Line 99  a finite field, then the other is automatically regard
Line 115  a finite field, then the other is automatically regard
 same finite field and the operation is done in the finite field.  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  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)},  identifier 1. Its number identifier is 6 if the finite field is GF(@var{p}),
 7 if it is @var{GF(2^n)}.  7 if it is GF(2^@var{n}).
   
 There are several methods to input an element of a finite field.  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()}.  An element of GF(@var{p}) can be input by @code{simp_ff()}.
 \E  \E
   
 @example  @example
Line 117  An element of @var{GF(p)} can be input by @code{simp_f
Line 133  An element of @var{GF(p)} can be input by @code{simp_f
 6  6
 @end example  @end example
   
 \JP $B$^$?(B, GF(2^n) $B$N>l9g$$$/$D$+$NJ}K!$,$"$k(B.  \JP $B$^$?(B, GF(2^@var{n}) $B$N>l9g$$$/$D$+$NJ}K!$,$"$k(B.
 \EG In the case of @var{GF(2^n)} the following methods are available.  \EG In the case of GF(2^@var{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);
Line 135  x^50+x^4+x^3+x^2+1
Line 151  x^50+x^4+x^3+x^2+1
   
 \BJP  \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^@var{n}) $B$N(B, GF(2) $B>e$N@8@.85$G$"$k(B. $B>\$7$/$O(B @xref{$B?t$N7?(B}.
 \E  \E
 \BEG  \BEG
 Elements of finite fields are numbers and one can apply field arithmetics  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)}.  to them. @code{@@} is a generator of GF(2^@var{n}) over GF(2).
 @xref{Types of numbers}.  @xref{Types of numbers}.
 \E  \E
   
Line 190  The irreducible factorization proceeds as follows.
Line 206  The irreducible factorization proceeds as follows.
 @end enumerate  @end enumerate
 \E  \E
   
   @noindent
   
 \BJP  \BJP
   @node $B>.I8?tM-8BBN>e$G$NB?9`<0$N1i;;(B,,, $BM-8BBN$K4X$9$k1i;;(B
   @section $B>.I8?tM-8BBN>e$G$NB?9`<0$N1i;;(B
   \E
   \BEG
   @node Polynomials on small finite fields,,, Finite fields
   @section Polynomials on small finite fields
   \E
   
   \BJP
   $B>.I8?tM-8BBN78?t$NB?9`<0$K8B$j(B, $BB?JQ?tB?9`<0$N0x?tJ,2r$,(B
   $BAH$_9~$_4X?t$H$7$F<BAu$5$l$F$$$k(B. $B4X?t$O(B @code{sffctr()}
   $B$G$"$k(B. $B$^$?(B, @code{modfctr()} $B$b(B, $BM-8BAGBN>e$GB?JQ?t(B
   $BB?9`<0$N0x?tJ,2r$r9T$&$,(B, $B<B:]$K$O(B, $BFbIt$G==J,Bg$-$J(B
   $B3HBgBN$r@_Dj$7(B, @code{sffctr()} $B$r8F$S=P$7$F(B,
   $B:G=*E*$KAGBN>e$N0x;R$r9=@.$9$k(B, $B$H$$$&J}K!$G7W;;$7$F$$$k(B.
   \E
   
   \BEG
   A multivariate polynomial over small finite field
   set by @code{setmod_ff(p,n)} can be factorized by
   using a builtin function @code{sffctr()}. @code{modfctr()}
   also factorizes a polynomial over a finite prime field.
   Internally, @code{modfctr()} creates a sufficiently large
   field extension of the specified ground field, and
   it calls @code{sffctr()}, then it constructs irreducible
   factors over the ground field from the factors returned by
   @code{sffctr()}.
   \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  \E
Line 203  The irreducible factorization proceeds as follows.
Line 251  The irreducible factorization proceeds as follows.
 $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.
   
 $BBJ1_6J@~$N;XDj$O(B, $BD9$5(B 2 $B$N%Y%/%H%k(B @var{[a b]} $B$G9T$&(B. @var{a}, @var{b}  $BBJ1_6J@~$N;XDj$O(B, $BD9$5(B 2 $B$N%Y%/%H%k(B [@var{a b}] $B$G9T$&(B. @var{a}, @var{b}
 $B$OM-8BBN$N85$G(B,  $B$OM-8BBN$N85$G(B,
 @code{setmod_ff} $B$GDj5A$5$l$F$$$kM-8BBN$,AGBN$N>l9g(B, @var{y^2=x^3+ax+b},  @code{setmod_ff} $B$GDj5A$5$l$F$$$kM-8BBN$,AGBN$N>l9g(B, @var{y^2=x^3+ax+b},
 $BI8?t(B 2 $B$NBN$N>l9g(B @var{y^2+xy=x^3+ax^2+b} $B$rI=$9(B.  $BI8?t(B 2 $B$NBN$N>l9g(B @var{y^2+xy=x^3+ax^2+b} $B$rI=$9(B.
Line 215  The irreducible factorization proceeds as follows.
Line 263  The irreducible factorization proceeds as follows.
   
 @itemize @bullet  @itemize @bullet
 @item $BL58B1sE@$O(B 0.  @item $BL58B1sE@$O(B 0.
 @item $B$=$l0J30$NE@$O(B, $BD9$5(B 3 $B$N%Y%/%H%k(B @var{[x y z]}. $B$?$@$7(B, @var{z} $B$O(B  @item $B$=$l0J30$NE@$O(B, $BD9$5(B 3 $B$N%Y%/%H%k(B [@var{x y z}]. $B$?$@$7(B, @var{z} $B$O(B
 0 $B$G$J$$(B.  0 $B$G$J$$(B.
 @end itemize  @end itemize
   
 $B$H$$$&E@$G$"$k(B. @var{[x y z]} $B$O@F<!:BI8$K$h$kI=8=$G$"$j(B, $B%"%U%#%s:BI8(B  $B$H$$$&E@$G$"$k(B. [@var{x y z}] $B$O@F<!:BI8$K$h$kI=8=$G$"$j(B, $B%"%U%#%s:BI8(B
 $B$G$O(B @var{[x/z y/z]} $B$J$kE@$rI=$9(B. $B$h$C$F(B, $B%"%U%#%s:BI8(B @var{[x y]} $B$G(B  $B$G$O(B [@var{x/z y/z}] $B$J$kE@$rI=$9(B. $B$h$C$F(B, $B%"%U%#%s:BI8(B [@var{x y}] $B$G(B
 $BI=8=$5$l$?E@$r1i;;BP>]$H$9$k$K$O(B, @var{[x y 1]} $B$J$k%Y%/%H%k$r(B  $BI=8=$5$l$?E@$r1i;;BP>]$H$9$k$K$O(B, [@var{x y 1}] $B$J$k%Y%/%H%k$r(B
 $B@8@.$9$kI,MW$,$"$k(B.  $B@8@.$9$kI,MW$,$"$k(B.
 $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
Line 232  The irreducible factorization proceeds as follows.
Line 280  The irreducible factorization proceeds as follows.
 Several fundamental operations on elliptic curves over finite fields  Several fundamental operations on elliptic curves over finite fields
 are provided as built-in functions.  are provided as built-in functions.
   
 An elliptic curve is specified by a vector @var{[a b]} of length 2,  An elliptic curve is specified by a vector [@var{a b}] of length 2,
 where @var{a}, @var{b} are elements of finite fields.  where @var{a}, @var{b} are elements of finite fields.
 If the current base field is a prime field, then @var{[a b]} represents  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  @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}.  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  Points on an elliptic curve together with the point at infinity
 forms an additive group. The addition, the subtraction and the  forms an additive group. The addition, the subtraction and the
Line 246  Here the representation of points are as follows.
Line 294  Here the representation of points are as follows.
   
 @itemize @bullet  @itemize @bullet
 @item 0 denotes the point at infinity.  @item 0 denotes the point at infinity.
 @item The other points are represented by vectors @var{[x y z]} of  @item The other points are represented by vectors [@var{x y z}] of
 length 3 with non-zero @var{z}.  length 3 with non-zero @var{z}.
 @end itemize  @end itemize
   
 @var{[x y z]} represents a projective coordinate and  [@var{x y z}] represents a projective coordinate and
 it corresponds to @var{[x/z y/z]} in the affine coordinate.  it corresponds to [@var{x/z y/z}] in the affine coordinate.
 To apply the above operations to a point @var{[x y]},  To apply the above operations to a point [@var{x y}],
 @var{[x y 1]} should be used instead as an argument.  [@var{x y 1}] should be used instead as an argument.
 The result of an operation is also represented by the projective  The result of an operation is also represented by the projective
 coordinate. As the third coordinate is not always equal to 1,  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 has to divide the first and the scond coordinate by the third
Line 282  one to obtain the affine coordinate.
Line 330  one to obtain the affine coordinate.
 * gf2nton::  * gf2nton::
 * ptogf2n::  * ptogf2n::
 * gf2ntop::  * gf2ntop::
   * ptosfp sfptop::
 * defpoly_mod2::  * defpoly_mod2::
   * sffctr::
 * fctr_ff::  * fctr_ff::
 * irredcheck_ff::  * irredcheck_ff::
 * randpoly_ff::  * randpoly_ff::
Line 296  one to obtain the affine coordinate.
Line 346  one to obtain the affine coordinate.
 @findex setmod_ff  @findex setmod_ff
   
 @table @t  @table @t
 @item setmod_ff([@var{prime}|@var{poly}])  @item setmod_ff([@var{p}|@var{defpoly2}])
   @itemx setmod_ff([@var{defpolyp},@var{p}])
   @itemx setmod_ff([@var{p},@var{n}])
 \JP :: $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.  \EG :: Sets/Gets the current base fields.
 @end table  @end table
Line 305  one to obtain the affine coordinate.
Line 357  one to obtain the affine coordinate.
 @item return  @item return
 \JP $B?t$^$?$OB?9`<0(B  \JP $B?t$^$?$OB?9`<0(B
 \EG number or polynomial  \EG number or polynomial
 @item prime  @item p
 \JP $BAG?t(B  \JP $BAG?t(B
 \EG prime  \EG prime
 @item poly  @item defpoly2
 \JP 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)  \EG univariate polynomial irreducible over GF(2)
   @item defpolyp
   \JP GF(@var{p}) $B>e4{Ls$J(B 1 $BJQ?tB?9`<0(B
   \EG univariate polynomial irreducible over GF(@var{p})
   @item n
   \JP $B3HBg<!?t(B
   \EG the extension degree
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
 \BJP  \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{p} $B$N;~(B, GF(@var{p}) $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{defpoly2} $B$N;~(B,
 GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod 2)  GF(2^deg(@var{defpoly2} mod 2)) = GF(2)[t]/(@var{defpoly2}(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},  $B0z?t$,(B @var{defpolyp} $B$H(B @var{p} $B$N;~(B,
 GF(2^n) $B$N>l9gDj5AB?9`<0$rJV$9(B.  GF(@var{p^deg(defpolyp)}) $B$r4pACBN$H$7$F@_Dj$9$k(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  $B0z?t$,(B @var{p} $B$H(B @var{n} $B$N;~(B,
   GF(@var{p^n}) $B$r4pACBN$H$7$F@_Dj$9$k(B. @var{p^n} $B$O(B @var{2^29} $BL$K~$G(B
   $B$J$1$l$P$J$i$J$$(B. $B$^$?(B, @var{p} $B$,(B @var{2^14} $B0J>e$N$H$-(B,
   @var{n} $B$O(B 1 $B$G$J$1$l$P$J$i$J$$(B.
   @item
   $BL50z?t$N;~(B, $B@_Dj$5$l$F$$$k4pACBN$,(B GF(@var{p})$B$N>l9g(B @var{p},
   GF(2^@var{n}) $B$N>l9gDj5AB?9`<0$rJV$9(B.
   $B4pACBN$,(B @code{setmod_ff(@var{defpoly},@var{p})} $B$GDj5A$5$l$?(B
   GF(@var{p}^@var{n}) $B$N>l9g(B, [@var{defpoly},@var{p}] $B$rJV$9(B.
   $B4pACBN$,(B @code{setmod_ff(@var{p},@var{n})} $B$GDj5A$5$l$?(B
   GF(p^@var{n}) $B$N>l9g(B,
   [@var{p},@var{defpoly},@var{prim_elem}] $B$rJV$9(B. $B$3$3$G(B, @var{defpoly}
   $B$O(B, @var{n} $B<!3HBg$NDj5AB?9`<0(B, @var{prim_elem} $B$O(B, GF(@var{p^n})$B$N(B
   $B>hK!72$N@8@.85$r0UL#$9$k(B.
   @item
   GF(2^@var{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  \E
 \BEG  \BEG
 @item  @item
 If the argument is a non-negative integer @var{prime}, GF(@var{prime})  If the argument is a non-negative integer @var{p}, GF(@var{p})
 is set as the current base field.  is set as the current base field.
 @item  @item
 If the argument is a polynomial @var{poly},  If the argument is a polynomial @var{defpoly2},
 GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod2)  GF(2^deg(@var{defpoly2} mod 2)) = GF(2)[t]/(@var{defpoly2}(t) mod2)
 is set as the current base field.  is set as the current base field.
 @item  @item
   If the arguments are a polynomial @var{defpolyp} and a prime @var{p},
   GF(@var{p}^deg(@var{defpolyp})) = GF(@var{p})[t]/(@var{defpolyp}(t))
   is set as the current base field.
   @item
   If the arguments are a prime @var{p} and an extension degree @var{n},
   GF(@var{p^n}) is set as the current base field. @var{p^n} must be
   less than @var{2^29} and if @var{p} is greater than or equal to @var{2^14},
   then @var{n} must be equal to 1.
   @item
 If no argument is specified, the modulus indicating the current base field  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  is returned. If the current base field is GF(@var{p}), @var{p} is
 returned. If it is GF(2^n), the defining polynomial is returned.  returned. If it is GF(2^@var{n}), the defining polynomial is returned.
   If it is GF(@var{p^n}) defined by @code{setmod_ff(@var{defpoly},@var{p})},
   [@var{defpolyp},@var{p}] is returned.
   If it is GF(@var{p^n}) defined by @code{setmod_ff(@var{p},@var{n})},
   [@var{p},@var{defpoly},@var{prim_elem}] is returned. Here, @var{defpoly}
   is the defining polynomial of the @var{n}-th extension,
   and @var{prim_elem} is the generator of the multiplicative group
   of GF(@var{p^n}).
 @item  @item
 Any irreducible univariate polynomial over GF(2) is available to  Any irreducible univariate polynomial over GF(2) is available to
 set GF(2^n). However the use of @code{defpoly_mod2()} is recommended  set GF(2^@var{n}). However the use of @code{defpoly_mod2()} is recommended
 for efficiency.  for efficiency.
 \E  \E
 @end itemize  @end itemize
Line 354  x^100+x^15+1
Line 443  x^100+x^15+1
 x^100+x^15+1  x^100+x^15+1
 [176] setmod_ff();  [176] setmod_ff();
 x^100+x^15+1  x^100+x^15+1
   [177] setmod_ff(x^4+x+1,547);
   [1*x^4+1*x+1,547]
   [178] setmod_ff(2,5);
   [2,x^5+x^2+1,x]
 @end example  @end example
   
 @table @t  @table @t
Line 384  x^100+x^15+1
Line 477  x^100+x^15+1
 @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(@var{p}) $B$J$i(B 1, GF(2^@var{n}) $B$J$i(B 2 $B$rJV$9(B.
 \E  \E
 \BEG  \BEG
 @item  @item
 Returns the type of the current base field.  Returns the type of the current base field.
 @item  @item
 If no field is set, 0 is returned. If GF(p) is set, 1 is returned.  If no field is set, 0 is returned. If GF(@var{p}) is set, 1 is returned.
 If GF(2^n) is set, 2 is returned.  If GF(2^@var{n}) is set, 2 is returned.
 \E  \E
 @end itemize  @end itemize
   
Line 436  x^2+x+1
Line 529  x^2+x+1
 @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(@var{q}) $B$J$i$P(B q $B$rJV$9(B.
 \E  \E
 \BEG  \BEG
 @item  @item
 Returns the order of the current base field.  Returns the order of the current base field.
 @item  @item
 @var{q} is returned if the current base field is GF(q).  @var{q} is returned if the current base field is GF(@var{q}).
 \E  \E
 @end itemize  @end itemize
   
Line 488  x^2+x+1
Line 581  x^2+x+1
 @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(@var{p}) $B$N>l9g(B @var{p}, GF(2^@var{n}) $B$N>l9g(B 2 $B$rJV$9(B.
 \E  \E
 \BEG  \BEG
 @item  @item
 Returns the characteristic of the current base field.  Returns the characteristic of the current base field.
 @item  @item
 @var{p} is returned if @var{GF(p)}, where @var{p} is a prime, is set.  @var{p} is returned if GF(@var{p}), where @var{p} is a prime, is set.
 @var{2} is returned if @var{GF(2^n)} is set.  @var{2} is returned if GF(2^@var{n}) is set.
 \E  \E
 @end itemize  @end itemize
   
Line 541  x^2+x+1
Line 634  x^2+x+1
 @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(@var{p}) $B$N>l9g(B 1, GF(2^@var{n}) $B$N>l9g(B @var{n} $B$rJV$9(B.
 \E  \E
 \BEG  \BEG
 @item  @item
 Returns the extension degree of the current base field over the prime field.  Returns the extension degree of the current base field over the prime field.
 @item  @item
 GF(p) $B$N>l9g(B 1, GF(2^n) $B$N>l9g(B n $B$rJV$9(B.  1 is returned if GF(@var{p}), where @var{p} is a prime, is set.
 1 is returned if @var{GF(p)}, where @var{p} is a prime, is set.  @var{n} is returned if GF(2^@var{n}) is set.
 @var{n} is returned if @var{GF(2^n)} is set.  
 \E  \E
 @end itemize  @end itemize
   
Line 606  in finite fields.
Line 698  in finite fields.
 @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.
   @item
   $B>.I8?tM-8BBN$N85$KJQ49$9$k>l9g(B, $B0lC6AGBN>e$K<M1F$7$F$+$i(B, $B3HBgBN$N(B
   $B85$KJQ49$5$l$k(B. $B3HBgBN$N85$KD>@\JQ49$9$k$K$O(B @code{ptosfp()} $B$r(B
   $BMQ$$$k(B.
 \E  \E
 \BEG  \BEG
 @item  @item
Line 616  It is used to convert integers or intrgral polynomials
Line 712  It is used to convert integers or intrgral polynomials
 elements of finite fields or polynomials over finite fields.  elements of finite fields or polynomials over finite fields.
 @item  @item
 An element of a finite field may not have the reduced representation.  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  In such case an application of @code{simp_ff} ensures that the output has
 the reduced representation.  the reduced representation.
   If a small finite field is set as a ground field,
   an integer is projected the finite prime field, then
   it is embedded into the ground field. @code{ptosfp()}
   can be used for direct projection to the ground field.
 \E  \E
 @end itemize  @end itemize
   
Line 630  x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120
Line 730  x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120
 1*x^10+1*x^9+1*x+1  1*x^10+1*x^9+1*x+1
 [3] ntype(coef(@@@@,10));  [3] ntype(coef(@@@@,10));
 6  6
   [4] setmod_ff(2,3);
   [2,x^3+x+1,x]
   [5] simp_ff(1);
   @@_0
   [6] simp_ff(2);
   0
   [7] ptosfp(2);
   @@_1
 @end example  @end example
   
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
 @fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton}  @fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton}, @fref{ptosfp sfptop}
 @end table  @end table
   
 \JP @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
Line 696  return to toplevel
Line 804  return to toplevel
   
 @table @t  @table @t
 @item lmptop(@var{obj})  @item lmptop(@var{obj})
 \JP :: GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49(B  \JP :: GF(@var{p}) $B78?tB?9`<0$N78?t$r@0?t$KJQ49(B
 \EG :: Converts the coefficients of a polynomial over GF(p) into integers.  \EG :: Converts the coefficients of a polynomial over GF(@var{p}) into integers.
 @end table  @end table
   
 @table @var  @table @var
Line 705  return to toplevel
Line 813  return to toplevel
 \JP $B@0?t78?tB?9`<0(B  \JP $B@0?t78?tB?9`<0(B
 \EG integral polynomial  \EG integral polynomial
 @item obj  @item obj
 \JP GF(p) $B78?tB?9`<0(B  \JP GF(@var{p}) $B78?tB?9`<0(B
 \EG polynomial over GF(p)  \EG polynomial over GF(@var{p})
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
 GF(p) $B78?tB?9`<0$N78?t$r@0?t$KJQ49$9$k(B.  GF(@var{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(@var{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  \E
 \BEG  \BEG
 @item  @item
 Converts the coefficients of a polynomial over GF(p) into integers.  Converts the coefficients of a polynomial over GF(@var{p}) into integers.
 @item  @item
 An element of GF(p) is represented by a non-negative integer @var{r} less than  An element of GF(@var{p}) is represented by a non-negative integer @var{r} less than
 @var{p}.  @var{p}.
 Each coefficient of a polynomial is converted into an integer object  Each coefficient of a polynomial is converted into an integer object
 whose value is @var{r}.  whose value is @var{r}.
Line 738  whose value is @var{r}.
Line 846  whose value is @var{r}.
 [2] setmod_ff(547);  [2] setmod_ff(547);
 547  547
 [3] F=simp_ff((x-1)^10);  [3] F=simp_ff((x-1)^10);
 1*x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3+45*x^2+537*x+1  1*x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3
   +45*x^2+537*x+1
 [4] lmptop(F);  [4] lmptop(F);
 x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3+45*x^2+537*x+1  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3
   +45*x^2+537*x+1
 [5] lmptop(coef(F,1));  [5] lmptop(coef(F,1));
 537  537
 [6] ntype(@@@@);  [6] ntype(@@@@);
Line 760  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
Line 870  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
   
 @table @t  @table @t
 @item ntogf2n(@var{m})  @item ntogf2n(@var{m})
 \JP :: $B<+A3?t$r(B GF(2^n) $B$N85$KJQ49(B  \JP :: $B<+A3?t$r(B GF(2^@var{n}) $B$N85$KJQ49(B
 \EG :: Converts a non-negative integer into an element of GF(2^n).  \EG :: Converts a non-negative integer into an element of GF(2^@var{n}).
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 \JP GF(2^n) $B$N85(B  \JP GF(2^@var{n}) $B$N85(B
 \EG element of GF(2^n)  \EG element of GF(2^@var{n})
 @item m  @item m
 \JP $BHsIi@0?t(B  \JP $BHsIi@0?t(B
 \EG non-negative integer  \EG non-negative integer
Line 777  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
Line 887  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
 \BJP  \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^@var{n})=GF(2)[t]/(g(t)) $B$N85(B
 @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t) $B$rJV$9(B.  @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t) $B$rJV$9(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
Line 788  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
Line 898  x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42
 Let @var{m} be a non-negative integer.  Let @var{m} be a non-negative integer.
 @var{m} has the binary representation  @var{m} has the binary representation
 @var{m}=@var{m0}+@var{m1}*2+...+@var{mk}*2^k.  @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)),  This function returns an element of  GF(2^@var{n}) = GF(2)[t]/(g(t)),
 @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t).  @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t).
 @item  @item
 Apply @code{simp_ff()} to reduce the result.  Apply @code{simp_ff()} to reduce the result.
Line 817  x^30+x+1
Line 927  x^30+x+1
   
 @table @t  @table @t
 @item gf2nton(@var{m})  @item gf2nton(@var{m})
 \JP :: GF(2^n) $B$N85$r<+A3?t$KJQ49(B  \JP :: GF(2^@var{n}) $B$N85$r<+A3?t$KJQ49(B
 \EG :: Converts an element of GF(2^n) into a non-negative integer.  \EG :: Converts an element of GF(2^@var{n}) into a non-negative integer.
 @end table  @end table
   
 @table @var  @table @var
Line 826  x^30+x+1
Line 936  x^30+x+1
 \JP $BHsIi@0?t(B  \JP $BHsIi@0?t(B
 \EG non-negative integer  \EG non-negative integer
 @item m  @item m
 \JP GF(2^n) $B$N85(B  \JP GF(2^@var{n}) $B$N85(B
 \EG element of GF(2^n)  \EG element of GF(2^@var{n})
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
Line 862  x^30+x+1
Line 972  x^30+x+1
   
 @table @t  @table @t
 @item ptogf2n(@var{poly})  @item ptogf2n(@var{poly})
 \JP :: $B0lJQ?tB?9`<0$r(B GF(2^n) $B$N85$KJQ49(B  \JP :: $B0lJQ?tB?9`<0$r(B GF(2^@var{n}) $B$N85$KJQ49(B
 \EG :: Converts a univariate polynomial into an element of GF(2^n).  \EG :: Converts a univariate polynomial into an element of GF(2^@var{n}).
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 \JP GF(2^n) $B$N85(B  \JP GF(2^@var{n}) $B$N85(B
 \EG element of GF(2^n)  \EG element of GF(2^@var{n})
 @item poly  @item poly
 \JP $B0lJQ?tB?9`<0(B  \JP $B0lJQ?tB?9`<0(B
 \EG univariate polynomial  \EG univariate polynomial
Line 878  x^30+x+1
Line 988  x^30+x+1
 @itemize @bullet  @itemize @bullet
 @item  @item
 \BJP  \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^@var{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  \E
 \BEG  \BEG
 Generates an element of GF(2^n) represented by @var{poly}.  Generates an element of GF(2^@var{n}) represented by @var{poly}.
 The coefficients are reduced modulo 2.  The coefficients are reduced modulo 2.
 The output is equal to the result by substituting @code{@@} for  The output is equal to the result by substituting @code{@@} for
 the variable of @var{poly}.  the variable of @var{poly}.
Line 910  x^30+x+1
Line 1020  x^30+x+1
   
 @table @t  @table @t
 @item gf2ntop(@var{m}[,@var{v}])  @item gf2ntop(@var{m}[,@var{v}])
 \JP :: GF(2^n) $B$N85$rB?9`<0$KJQ49(B  \JP :: GF(2^@var{n}) $B$N85$rB?9`<0$KJQ49(B
 \EG :: Converts an element of GF(2^n) into a polynomial.  \EG :: Converts an element of GF(2^@var{n}) into a polynomial.
 @end table  @end table
   
 @table @var  @table @var
Line 919  x^30+x+1
Line 1029  x^30+x+1
 \JP $B0lJQ?tB?9`<0(B  \JP $B0lJQ?tB?9`<0(B
 \EG univariate polynomial  \EG univariate polynomial
 @item m  @item m
 \JP GF(2^n) $B$N85(B  \JP GF(2^@var{n}) $B$N85(B
 \EG an element of GF(2^n)  \EG an element of GF(2^@var{n})
 @item v  @item v
 \JP $BITDj85(B  \JP $BITDj85(B
 \EG indeterminate  \EG indeterminate
Line 963  t^13+t^12+t^11+t^10
Line 1073  t^13+t^12+t^11+t^10
 @fref{ptogf2n}  @fref{ptogf2n}
 @end table  @end table
   
   \JP @node ptosfp sfptop,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node ptosfp sfptop,,, Functions for Finite fields
   @subsection @code{ptosfp}, @code{sfptop}
   @findex ptosfp
   @findex sfptop
   
   @table @t
   @item ptosfp(@var{p})
   @itemx sfptop(@var{p})
   \JP :: $B>.I8?tM-8BBN$X$NJQ49(B, $B5UJQ49(B
   \EG :: Transformation to/from a small finite field
   @end table
   
   @table @var
   @item return
   \JP $BB?9`<0(B
   \EG polynomial
   @item p
   \JP $BB?9`<0(B
   \EG polynomial
   @end table
   
   @itemize @bullet
   \BJP
   @item
   @code{ptosfp()} $B$O(B, $BB?9`<0$N78?t$r(B, $B8=:_@_Dj$5$l$F$$$k>.I8?tM-8BBN(B
   GF(p^@var{n}) $B$N85$KD>@\JQ49$9$k(B. $B78?t$,4{$KM-8BBN$N85$N>l9g$OJQ2=$7$J$$(B.
   $B@5@0?t$N>l9g(B, $B$^$:0L?t$G>jM>$r7W;;$7$?$"$H(B, $BI8?t(B @var{p} $B$K$h$j(B @var{p}
   $B?JE83+$7(B, @var{p} $B$r(B x $B$KCV$-49$($?B?9`<0$r(B, $B86;O85I=8=$KJQ49$9$k(B.
   $BNc$($P(B, GF(3^5) $B$O(B GF(3)[x]/(x^5+2*x+1) $B$H$7$FI=8=$5$l(B, $B$=$N3F(B
   $B85$O86;O85(B x $B$K4X$9$k$Y$-;X?t(B @var{k} $B$K$h$j(B @var{@@_k} $B$H$7$F(B
   $BI=<($5$l$k(B. $B$3$N$H$-(B, $BNc$($P(B @var{23 = 2*3^2+3+2} $B$O(B, 2*x^2+x+2
   $B$HI=8=$5$l(B, $B$3$l$O7k6I(B x^17 $B$HK!(B x^5+2*x+1 $B$GEy$7$$$N$G(B,
   @var{@@_17} $B$HJQ49$5$l$k(B.
   @item
   @code{sfptop()} $B$O(B @code{ptosfp()} $B$N5UJQ49$G$"$k(B.
   \E
   \BEG
   @item
   @code{ptosfp()} converts coefficients of a polynomial to
   elements in a small finite field GF(@var{p^n}) set as a ground field.
   If a coefficient is already an element of the field,
   no conversion is done. If a coefficient is a positive integer,
   then its residue modulo @var{p^n} is expanded as @var{p}-adic integer,
   then @var{p} is substituted by @var{x}, finally the polynomial
   is converted to its correspoding logarithmic representation
   with respect to the primitive element.
   For example, GF(3^5) is represented as F(3)[@var{x}]/(@var{x^5+2*x+1}),
   and each element of the field is represented as @var{@@_k}
   by its exponent @var{k} with respect to the primitive element @var{x}.
   @var{23 = 2*3^2+3+2} is represented as @var{2*x^2+x+2} and
   it is equivalent to @var{x^17} modulo @var{x^5+2*x+1}.
   Therefore an integer @var{23} is conterted to @var{@@_17}.
   @item
   @code{sfptop()} is the inverse of @code{ptosfp()}.
   \E
   @end itemize
   
   @example
   [196] setmod_ff(3,5);
   [3,x^5+2*x+1,x]
   [197] A = ptosfp(23);
   @@_17
   [198] 9*2+3+2;
   23
   [199] x^17-(2*x^2+x+2);
   x^17-2*x^2-x-2
   [200] sremm(@@,x^5+2*x+1,3);
   0
   [201] sfptop(A);
   23
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{setmod_ff}, @fref{simp_ff}
   @end table
 \JP @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  \EG @node defpoly_mod2,,, Functions for Finite fields
 @subsection @code{defpoly_mod2}  @subsection @code{defpoly_mod2}
Line 1020  Then fix @var{m3} as small as possible.
Line 1208  Then fix @var{m3} as small as possible.
 @fref{setmod_ff}  @fref{setmod_ff}
 @end table  @end table
   
   \JP @node sffctr,,, $BM-8BBN$K4X$9$kH!?t$N$^$H$a(B
   \EG @node sffctr,,, Functions for Finite fields
   @subsection @code{sffctr}
   @findex sffctr
   
   @table @t
   @item sffctr(@var{poly})
   \JP :: $BB?9`<0$N>.I8?tM-8BBN>e$G$N4{LsJ,2r(B
   \EG :: Irreducible factorization over a small finite field.
   @end table
   
   @table @var
   @item return
   \JP $B%j%9%H(B
   \EG list
   @item poly
   \JP $BM-8BBN>e$N(B $BB?9`<0(B
   \EG polynomial over a finite field
   @end table
   
   @itemize @bullet
   \BJP
   @item
   $BB?9`<0$r(B, $B8=:_@_Dj$5$l$F$$$k>.I8?tM-8BBN>e$G4{LsJ,2r$9$k(B.
   @item
   $B7k2L$O(B, [[@var{f1},@var{m1}],[@var{f2},@var{m2}],...] $B$J$k(B
   $B%j%9%H$G$"$k(B. $B$3$3$G(B, @var{fi} $B$O(B monic $B$J4{Ls0x;R(B, @var{mi} $B$O$=$N(B
   $B=EJ#EY$G$"$k(B.
   \E
   \BEG
   @item
   Factorize @var{poly} into irreducible factors over
   a small finite field currently set.
   @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.
   \E
   @end itemize
   
   @example
   [0] setmod_ff(2,10);
   [2,x^10+x^3+1,x]
   [1] sffctr((z*y^3+z*y)*x^3+(y^5+y^3+z*y^2+z)*x^2+z^11*y*x+z^10*y^3+z^11);
   [[@@_0,1],[@@_0*z*y*x+@@_0*y^3+@@_0*z,1],[(@@_0*y+@@_0)*x+@@_0*z^5,2]]
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{setmod_ff},
   @fref{modfctr}
   @end table
   
 \JP @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  \EG @node fctr_ff,,, Functions for Finite fields
 @subsection @code{fctr_ff}  @subsection @code{fctr_ff}
Line 1209  The coefficients are generated by @code{random_ff()}.
Line 1451  The coefficients are generated by @code{random_ff()}.
 @item return  @item return
 \JP $B%Y%/%H%k$^$?$O(B 0  \JP $B%Y%/%H%k$^$?$O(B 0
 \EG vector or 0  \EG vector or 0
 @item p1,p2  @item p1 p2
 \JP $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  \EG vector of length 3 or 0
 @item ec  @item ec
Line 1224  The coefficients are generated by @code{random_ff()}.
Line 1466  The coefficients are generated by @code{random_ff()}.
 $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.
 @item  @item
 @var{ec} $B$O(B, $B@_Dj$5$l$F$$$kM-8BBN$,4qI8?tAGBN$N>l9g(B,  @var{ec} $B$O(B, $B@_Dj$5$l$F$$$kM-8BBN$,4qI8?tAGBN$N>l9g(B,
 @var{y^2=x^3+ec[0]x+ec[1]}, $BI8?t(B 2 $B$N>l9g(B @var{y^2+xy=x^3+ec[0]x^2+ec[1]}  y^2=x^3+ec[0]x+ec[1], $BI8?t(B 2 $B$N>l9g(B y^2+xy=x^3+ec[0]x^2+ec[1]
 $B$rI=$9(B.  $B$rI=$9(B.
 @item  @item
 $B0z?t(B, $B7k2L$H$b$K(B, $BL58B1sE@$O(B 0 $B$GI=$5$l$k(B.  $B0z?t(B, $B7k2L$H$b$K(B, $BL58B1sE@$O(B 0 $B$GI=$5$l$k(B.
Line 1247  and ecm_chsgn_ff(@var{p1}) returns
Line 1489  and ecm_chsgn_ff(@var{p1}) returns
 @var{p1+p2}, @var{p1-p2} and @var{-p1} respectively.  @var{p1+p2}, @var{p1-p2} and @var{-p1} respectively.
 @item  @item
 If the current base field is a prime field of odd order, then  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]}.  @var{ec} represents y^2=x^3+ec[0]x+ec[1].
 If the characteristic of the current base field is 2,  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]}.  then @var{ec} represents y^2+xy=x^3+ec[0]x^2+ec[1].
 @item  @item
 The point at infinity is represented by 0.  The point at infinity is represented by 0.
 @item  @item

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

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