=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/ff.texi,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- OpenXM/src/asir-doc/parts/ff.texi 2003/04/19 10:36:30 1.4 +++ OpenXM/src/asir-doc/parts/ff.texi 2003/04/19 15:44:56 1.5 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/ff.texi,v 1.3 2000/01/13 08:29:56 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/ff.texi,v 1.4 2003/04/19 10:36:30 noro Exp $ \BJP @node 有限体に関する演算,,, Top @chapter 有限体に関する演算 @@ -12,12 +12,14 @@ \BJP * 有限体の表現および演算:: * 有限体上での 1 変数多項式の演算:: +* 小標数有限体上での多項式の演算:: * 有限体上の楕円曲線に関する演算:: * 有限体に関する函数のまとめ:: \E \BEG * Representation of finite fields:: * Univariate polynomials on finite fields:: +* Polynomials on small finite fields:: * Elliptic curves on finite fields:: * Functions for Finite fields:: \E @@ -34,15 +36,15 @@ @noindent \BJP -@b{Asir} においては, 有限体は, 正標数素体 GF(p), 標数 2 の有限体 GF(2^n), -GF(p) の n 次拡大 GF(p^n) +@b{Asir} においては, 有限体は, 正標数素体 GF(@var{p}), 標数 2 の有限体 GF(2^@var{n}), +GF(@var{p}) の @var{n} 次拡大 GF(@var{p^n}) が定義できる. これらは全て, @code{setmod_ff()} により定義される. \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 +On @b{Asir} GF(@var{p}), GF(2^@var{n}), GF(@var{p^n}) can be defined, where +GF(@var{p}) is a finite prime field of charateristic @var{p}, +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()}. \E @@ -72,8 +74,8 @@ x^50+x^4+x^3+x^2+1 @end example \BJP @code{setmod_ff()} は, さまざまなタイプの有限体を基礎体としてセットする. -引数が正整数 p の場合 GF(p), n 次多項式 f(x) の場 -合, f(x) mod 2 を定義多項式とする GF(2^n) をそれぞれ基礎体としてセットす +引数が正整数 @var{p} の場合 GF(@var{p}), @var{n} 次多項式 f(x) の場 +合, f(x) mod 2 を定義多項式とする GF(2^@var{n}) をそれぞれ基礎体としてセットす る. また, 有限素体の有限次拡大も定義できる. 詳しくは @xref{数の型}. @code{setmod_ff()} においては引数の既約チェックは行わず, 呼び出し側 が責任を持つ. @@ -85,20 +87,20 @@ x^50+x^4+x^3+x^2+1 る. 0 でない有限体の元は, 数オブジェクトであり, 識別子の値は 1 である. -さらに, 0 でない有限体の元の数識別子は, GF(p) の場合 6, GF(2^n) の場合 7 +さらに, 0 でない有限体の元の数識別子は, GF(@var{p}) の場合 6, GF(2^@var{n}) の場合 7 となる. -有限体の元の入力方法は, 有限体の種類により様々である. GF(p) の場合, +有限体の元の入力方法は, 有限体の種類により様々である. GF(@var{p}) の場合, @code{simp_ff()} による. \E \BEG 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}, -@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 +@code{setmod_ff(@var{f})} sets GF(2^@var{n}) as the current +base field. GF(2^@var{n}) is represented +as an algebraic extension of 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 @@ -113,11 +115,11 @@ a finite field, then the other is automatically regard 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)}. +identifier 1. Its number identifier is 6 if the finite field is GF(@var{p}), +7 if it is GF(2^@var{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()}. +An element of GF(@var{p}) can be input by @code{simp_ff()}. \E @example @@ -131,8 +133,8 @@ An element of @var{GF(p)} can be input by @code{simp_f 6 @end example -\JP また, GF(2^n) の場合いくつかの方法がある. -\EG In the case of @var{GF(2^n)} the following methods are available. +\JP また, GF(2^@var{n}) の場合いくつかの方法がある. +\EG In the case of GF(2^@var{n}) the following methods are available. @example [0] setmod_ff(x^50+x^4+x^3+x^2+1); @@ -149,11 +151,11 @@ x^50+x^4+x^3+x^2+1 \BJP 有限体の元は数であり, 体演算が可能である. @code{@@} は -GF(2^n) の, GF(2)上の生成元である. 詳しくは @xref{数の型}. +GF(2^@var{n}) の, GF(2) 上の生成元である. 詳しくは @xref{数の型}. \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)}. +to them. @code{@@} is a generator of GF(2^@var{n}) over GF(2). @xref{Types of numbers}. \E @@ -204,7 +206,39 @@ The irreducible factorization proceeds as follows. @end enumerate \E +@noindent + \BJP +@node 小標数有限体上での多項式の演算,,, 有限体に関する演算 +@section 小標数有限体上での多項式の演算 +\E +\BEG +@node Polynomials on small finite fields,,, Finite fields +@section Polynomials on small finite fields +\E + +\BJP +小標数有限体係数の多項式に限り, 多変数多項式の因数分解が +組み込み関数として実装されている. 関数は @code{sffctr()} +である. また, @code{modfctr()} も, 有限素体上で多変数 +多項式の因数分解を行うが, 実際には, 内部で十分大きな +拡大体を設定し, @code{sffctr()} を呼び出して, +最終的に素体上の因子を構成する, という方法で計算している. +\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 有限体上の楕円曲線に関する演算,,, 有限体に関する演算 @section 有限体上の楕円曲線に関する演算 \E @@ -217,7 +251,7 @@ The irreducible factorization proceeds as follows. 有限体上の楕円曲線に関するいくつかの基本的な演算が, 組み込み関数として 提供されている. -楕円曲線の指定は, 長さ 2 のベクトル @var{[a b]} で行う. @var{a}, @var{b} +楕円曲線の指定は, 長さ 2 のベクトル [@var{a b}] で行う. @var{a}, @var{b} は有限体の元で, @code{setmod_ff} で定義されている有限体が素体の場合, @var{y^2=x^3+ax+b}, 標数 2 の体の場合 @var{y^2+xy=x^3+ax^2+b} を表す. @@ -229,13 +263,13 @@ The irreducible factorization proceeds as follows. @itemize @bullet @item 無限遠点は 0. -@item それ以外の点は, 長さ 3 のベクトル @var{[x y z]}. ただし, @var{z} は +@item それ以外の点は, 長さ 3 のベクトル [@var{x y z}]. ただし, @var{z} は 0 でない. @end itemize -という点である. @var{[x y z]} は斉次座標による表現であり, アフィン座標 -では @var{[x/z y/z]} なる点を表す. よって, アフィン座標 @var{[x y]} で -表現された点を演算対象とするには, @var{[x y 1]} なるベクトルを +という点である. [@var{x y z}] は斉次座標による表現であり, アフィン座標 +では [@var{x/z y/z}] なる点を表す. よって, アフィン座標 [@var{x y}] で +表現された点を演算対象とするには, [@var{x y 1}] なるベクトルを 生成する必要がある. 演算結果も斉次座標で得られるが, @var{z} 座標が 1 とは限らないため, アフィン座標を求めるためには @var{x}, @var{y} 座標を @var{z} 座標で @@ -246,11 +280,11 @@ The irreducible factorization proceeds as follows. 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, +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 +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}. +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 @@ -260,14 +294,14 @@ 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 +@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. +[@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 @@ -296,6 +330,7 @@ one to obtain the affine coordinate. * gf2nton:: * ptogf2n:: * gf2ntop:: +* ptosfp sfptop:: * defpoly_mod2:: * fctr_ff:: * irredcheck_ff:: @@ -311,6 +346,7 @@ one to obtain the affine coordinate. @table @t @item setmod_ff([@var{prime}|@var{poly}]) +@itemx setmod_ff(@var{prime},@var{n}]) \JP :: 有限体の設定, 設定されている有限体の法, 定義多項式の表示 \EG :: Sets/Gets the current base fields. @end table @@ -325,6 +361,9 @@ one to obtain the affine coordinate. @item poly \JP GF(2) 上既約な 1 変数多項式 \EG univariate polynomial irreducible over GF(2) +@item n +\JP 拡大次数 +\EG the extension degree @end table @itemize @bullet @@ -336,10 +375,20 @@ one to obtain the affine coordinate. GF(2^deg(@var{poly} mod 2)) = GF(2)[t]/(@var{poly}(t) mod 2) を基礎体として設定する. @item -無引数の時, 設定されている基礎体が GF(@var{prime}) の場合 @var{prime}, -GF(2^n) の場合定義多項式を返す. +引数が @var{p} と @var{n} の時, +GF(@var{p^n}) を基礎体として設定する. @var{p^n} は @var{2^29} 未満で +なければならない. また, @var{p} が @var{2^14} 以上のとき, +@var{n} は 1 でなければならない. @item -GF(2^n) の定義多項式は, GF(2) 上 n 次既約ならなんでも良いが, 効率に +無引数の時, 設定されている基礎体が GF(@var{prime})の場合 @var{prime}, +GF(2^@var{n}) の場合定義多項式を返す. +基礎体が GF(p^@var{n}) +(@var{p^n} が @var{2^14} 未満) の場合, +[@var{p},@var{defpoly},@var{prim_elem}] を返す. ここで, @var{defpoly} +は, @var{n} 次拡大の定義多項式, @var{prim_elem} は, GF(@var{p^n}) +乗法群の生成元を意味する. +@item +GF(2^@var{n}) の定義多項式は, GF(2) 上 n 次既約ならなんでも良いが, 効率に 影響するため, @code{defpoly_mod2()} で生成するのがよい. \E \BEG @@ -351,12 +400,22 @@ 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 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 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. +returned. If it is GF(2^@var{n}), the defining polynomial is returned. +If it is GF(@var{p^n}), where @var{p^n} is less than @var{2^14}, +[@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 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. \E @end itemize @@ -368,6 +427,8 @@ x^100+x^15+1 x^100+x^15+1 [176] setmod_ff(); x^100+x^15+1 +[177] setmod_ff(2,5); +[2,x^5+x^2+1,x] @end example @table @t @@ -398,14 +459,14 @@ x^100+x^15+1 @item 設定されている基礎体の種類を返す. @item -設定なしなら 0, GF(p) なら 1, GF(2^n) なら 2 を返す. +設定なしなら 0, GF(@var{p}) なら 1, GF(2^@var{n}) なら 2 を返す. \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. +If no field is set, 0 is returned. If GF(@var{p}) is set, 1 is returned. +If GF(2^@var{n}) is set, 2 is returned. \E @end itemize @@ -450,13 +511,13 @@ x^2+x+1 @item 設定されている基礎体の位数 (元の個数) を返す. @item -設定されている体が GF(q) ならば q を返す. +設定されている体が GF(@var{q}) ならば q を返す. \E \BEG @item Returns the order of the current base field. @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 @end itemize @@ -502,14 +563,14 @@ x^2+x+1 @item 設定されている体の標数を返す. @item -GF(p) の場合 p, GF(2^n) の場合 2 を返す. +GF(@var{p}) の場合 @var{p}, GF(2^@var{n}) の場合 2 を返す. \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. +@var{p} is returned if GF(@var{p}), where @var{p} is a prime, is set. +@var{2} is returned if GF(2^@var{n}) is set. \E @end itemize @@ -555,15 +616,14 @@ x^2+x+1 @item 設定されている基礎体の, 素体に対する拡大次数を返す. @item -GF(p) の場合 1, GF(2^n) の場合 n を返す. +GF(@var{p}) の場合 1, GF(2^@var{n}) の場合 @var{n} を返す. \E \BEG @item Returns the extension degree of the current base field over the prime field. @item -GF(p) の場合 1, GF(2^n) の場合 n を返す. -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. +1 is returned if GF(@var{p}), where @var{p} is a prime, is set. +@var{n} is returned if GF(2^@var{n}) is set. \E @end itemize @@ -620,6 +680,10 @@ in finite fields. @item 有限体の元に対し, 法あるいは定義多項式による reduction を行う場合にも 用いる. +@item +小標数有限体の元に変換する場合, 一旦素体上に射影してから, 拡大体の +元に変換される. 拡大体の元に直接変換するには @code{ptosfp()} を +用いる. \E \BEG @item @@ -630,8 +694,12 @@ It is used to convert integers or intrgral polynomials 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 +In such case an application of @code{simp_ff} ensures that the output has 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 @end itemize @@ -644,12 +712,20 @@ 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 [3] ntype(coef(@@@@,10)); 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 @table @t \JP @item 参照 \EG @item References -@fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton} +@fref{setmod_ff}, @fref{lmptop}, @fref{gf2nton}, @fref{ptosfp sfptop} @end table \JP @node random_ff,,, 有限体に関する函数のまとめ @@ -710,8 +786,8 @@ return to toplevel @table @t @item lmptop(@var{obj}) -\JP :: GF(p) 係数多項式の係数を整数に変換 -\EG :: Converts the coefficients of a polynomial over GF(p) into integers. +\JP :: GF(@var{p}) 係数多項式の係数を整数に変換 +\EG :: Converts the coefficients of a polynomial over GF(@var{p}) into integers. @end table @table @var @@ -719,24 +795,24 @@ return to toplevel \JP 整数係数多項式 \EG integral polynomial @item obj -\JP GF(p) 係数多項式 -\EG polynomial over GF(p) +\JP GF(@var{p}) 係数多項式 +\EG polynomial over GF(@var{p}) @end table @itemize @bullet \BJP @item -GF(p) 係数多項式の係数を整数に変換する. +GF(@var{p}) 係数多項式の係数を整数に変換する. @item -GF(p) の元は, 0 以上 p 未満の整数で表現されている. +GF(@var{p}) の元は, 0 以上 p 未満の整数で表現されている. 多項式の各係数は, その値を整数オブジェクト(数識別子 0)としたものに 変換される. \E \BEG @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 -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}. Each coefficient of a polynomial is converted into an integer object whose value is @var{r}. @@ -774,14 +850,14 @@ x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42 @table @t @item ntogf2n(@var{m}) -\JP :: 自然数を GF(2^n) の元に変換 -\EG :: Converts a non-negative integer into an element of GF(2^n). +\JP :: 自然数を GF(2^@var{n}) の元に変換 +\EG :: Converts a non-negative integer into an element of GF(2^@var{n}). @end table @table @var @item return -\JP GF(2^n) の元 -\EG element of GF(2^n) +\JP GF(2^@var{n}) の元 +\EG element of GF(2^@var{n}) @item m \JP 非負整数 \EG non-negative integer @@ -791,7 +867,7 @@ x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+42 \BJP @item 自然数 @var{m} の 2 進表現 @var{m}=@var{m0}+@var{m1}*2+...+@var{mk}*2^k -に対し, GF(2^n)=GF(2)[t]/(g(t)) の元 +に対し, GF(2^@var{n})=GF(2)[t]/(g(t)) の元 @var{m0}+@var{m1}*t+...+@var{mk}*t^k mod g(t) を返す. @item 定義多項式による剰余は自動的には計算されないため, @code{simp_ff()} を @@ -802,7 +878,7 @@ 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. @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)), +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). @item Apply @code{simp_ff()} to reduce the result. @@ -831,8 +907,8 @@ x^30+x+1 @table @t @item gf2nton(@var{m}) -\JP :: GF(2^n) の元を自然数に変換 -\EG :: Converts an element of GF(2^n) into a non-negative integer. +\JP :: GF(2^@var{n}) の元を自然数に変換 +\EG :: Converts an element of GF(2^@var{n}) into a non-negative integer. @end table @table @var @@ -840,8 +916,8 @@ x^30+x+1 \JP 非負整数 \EG non-negative integer @item m -\JP GF(2^n) の元 -\EG element of GF(2^n) +\JP GF(2^@var{n}) の元 +\EG element of GF(2^@var{n}) @end table @itemize @bullet @@ -876,14 +952,14 @@ x^30+x+1 @table @t @item ptogf2n(@var{poly}) -\JP :: 一変数多項式を GF(2^n) の元に変換 -\EG :: Converts a univariate polynomial into an element of GF(2^n). +\JP :: 一変数多項式を GF(2^@var{n}) の元に変換 +\EG :: Converts a univariate polynomial into an element of GF(2^@var{n}). @end table @table @var @item return -\JP GF(2^n) の元 -\EG element of GF(2^n) +\JP GF(2^@var{n}) の元 +\EG element of GF(2^@var{n}) @item poly \JP 一変数多項式 \EG univariate polynomial @@ -892,12 +968,12 @@ x^30+x+1 @itemize @bullet @item \BJP -@var{poly} の表す GF(2^n) の元を生成する. 係数は, 2 で割った余りに +@var{poly} の表す GF(2^@var{n}) の元を生成する. 係数は, 2 で割った余りに 変換される. @var{poly} の変数に @code{@@} を代入した結果と等しい. \E \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 output is equal to the result by substituting @code{@@} for the variable of @var{poly}. @@ -924,8 +1000,8 @@ x^30+x+1 @table @t @item gf2ntop(@var{m}[,@var{v}]) -\JP :: GF(2^n) の元を多項式に変換 -\EG :: Converts an element of GF(2^n) into a polynomial. +\JP :: GF(2^@var{n}) の元を多項式に変換 +\EG :: Converts an element of GF(2^@var{n}) into a polynomial. @end table @table @var @@ -933,8 +1009,8 @@ x^30+x+1 \JP 一変数多項式 \EG univariate polynomial @item m -\JP GF(2^n) の元 -\EG an element of GF(2^n) +\JP GF(2^@var{n}) の元 +\EG an element of GF(2^@var{n}) @item v \JP 不定元 \EG indeterminate @@ -977,6 +1053,84 @@ t^13+t^12+t^11+t^10 @fref{ptogf2n} @end table +\JP @node ptosfp sfptop,,, 有限体に関する函数のまとめ +\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 :: 小標数有限体への変換, 逆変換 +\EG :: Transformation to/from a small finite field +@end table + +@table @var +@item return +\JP 多項式 +\EG polynomial +@item p +\JP 多項式 +\EG polynomial +@end table + +@itemize @bullet +\BJP +@item +@code{ptosfp()} は, 多項式の係数を, 現在設定されている小標数有限体 +GF(p^@var{n}) の元に直接変換する. 係数が既に有限体の元の場合は変化しない. +正整数の場合, まず位数で剰余を計算したあと, 標数 @var{p} により @var{p} +進展開し, @var{p} を x に置き換えた多項式を, 原始元表現に変換する. +例えば, GF(3^5) は GF(3)[x]/(x^5+2*x+1) として表現され, その各 +元は原始元 x に関するべき指数 @var{k} により @var{@@_k} として +表示される. このとき, 例えば @var{23 = 2*3^2+3+2} は, 2*x^2+x+2 +と表現され, これは結局 x^17 と法 x^5+2*x+1 で等しいので, +@var{@@_17} と変換される. +@item +@code{sfptop()} は @code{ptosfp()} の逆変換である. +\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 参照 +\EG @item References +@fref{setmod_ff}, @fref{simp_ff} +@end table \JP @node defpoly_mod2,,, 有限体に関する函数のまとめ \EG @node defpoly_mod2,,, Functions for Finite fields @subsection @code{defpoly_mod2} @@ -1223,7 +1377,7 @@ The coefficients are generated by @code{random_ff()}. @item return \JP ベクトルまたは 0 \EG vector or 0 -@item p1,p2 +@item p1 p2 \JP 長さ 3 のベクトルまたは 0 \EG vector of length 3 or 0 @item ec @@ -1238,7 +1392,7 @@ The coefficients are generated by @code{random_ff()}. 点 @var{p1}, @var{p2} の和 @var{p1+p2}, 差 @var{p1-p2}, 逆元 @var{-p1} を返す. @item @var{ec} は, 設定されている有限体が奇標数素体の場合, -@var{y^2=x^3+ec[0]x+ec[1]}, 標数 2 の場合 @var{y^2+xy=x^3+ec[0]x^2+ec[1]} +y^2=x^3+ec[0]x+ec[1], 標数 2 の場合 y^2+xy=x^3+ec[0]x^2+ec[1] を表す. @item 引数, 結果ともに, 無限遠点は 0 で表される. @@ -1261,9 +1415,9 @@ 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]}. +@var{ec} represents 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]}. +then @var{ec} represents y^2+xy=x^3+ec[0]x^2+ec[1]. @item The point at infinity is represented by 0. @item