=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/groebner.texi,v retrieving revision 1.11 retrieving revision 1.17 diff -u -p -r1.11 -r1.17 --- OpenXM/src/asir-doc/parts/groebner.texi 2003/04/28 06:43:10 1.11 +++ OpenXM/src/asir-doc/parts/groebner.texi 2006/09/06 23:53:31 1.17 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/groebner.texi,v 1.10 2003/04/28 03:09:23 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/groebner.texi,v 1.16 2004/10/20 00:30:55 fujiwara Exp $ \BJP @node グレブナ基底の計算,,, Top @chapter グレブナ基底の計算 @@ -15,6 +15,7 @@ * 基本的な函数:: * 計算および表示の制御:: * 項順序の設定:: +* Weight:: * 有理式を係数とするグレブナ基底計算:: * 基底変換:: * Weyl 代数:: @@ -26,6 +27,7 @@ * Fundamental functions:: * Controlling Groebner basis computations:: * Setting term orderings:: +* Weight:: * Groebner basis computation with rational function coefficients:: * Change of ordering:: * Weyl algebra:: @@ -1055,6 +1057,139 @@ beforehand, and some heuristic trial may be inevitable \E \BJP +@node Weight ,,, グレブナ基底の計算 +@section Weight +\E +\BEG +@node Weight,,, Groebner basis computation +@section Weight +\E +\BJP +前節で紹介した項順序は, 各変数に weight (重み) を設定することで +より一般的なものとなる. +\E +\BEG +Term orderings introduced in the previous section can be generalized +by setting a weight for each variable. +\E +@example +[0] dp_td(<<1,1,1>>); +3 +[1] dp_set_weight([1,2,3])$ +[2] dp_td(<<1,1,1>>); +6 +@end example +\BJP +単項式の全次数を計算する際, デフォルトでは +各変数の指数の和を全次数とする. これは各変数の weight を 1 と +考えていることに相当する. この例では, 第一, 第二, 第三変数の +weight をそれぞれ 1,2,3 と指定している. このため, @code{<<1,1,1>>} +の全次数 (以下ではこれを単項式の weight と呼ぶ) が @code{1*1+1*2+1*3=6} となる. +weight を設定することで, 同じ項順序型のもとで異なる項順序が定義できる. +例えば, weight をうまく設定することで, 多項式を weighted homogeneous +にすることができる場合がある. +\E +\BEG +By default, the total degree of a monomial is equal to +the sum of all exponents. This means that the weight for each variable +is set to 1. +In this example, the weights for the first, the second and the third +variable are set to 1, 2 and 3 respectively. +Therefore the total degree of @code{<<1,1,1>>} under this weight, +which is called the weight of the monomial, is @code{1*1+1*2+1*3=6}. +By setting weights, different term orderings can be set under a type of +term ordeing. In some case a polynomial can +be made weighted homogeneous by setting an appropriate weight. +\E + +\BJP +各変数に対する weight をまとめたものを weight vector と呼ぶ. +すべての成分が正であり, グレブナ基底計算において, 全次数の +代わりに用いられるものを特に sugar weight と呼ぶことにする. +sugar strategy において, 全次数の代わりに使われるからである. +一方で, 各成分が必ずしも正とは限らない weight vector は, +sugar weight として設定することはできないが, 項順序の一般化には +有用である. これらは, 行列による項順序の設定にすでに現れて +いる. すなわち, 項順序を定義する行列の各行が, 一つの weight vector +と見なされる. また, ブロック順序は, 各ブロックの +変数に対応する成分のみ 1 で他は 0 の weight vector による比較を +最初に行ってから, 各ブロック毎の tie breaking を行うことに相当する. +\E + +\BEG +A list of weights for all variables is called a weight vector. +A weight vector is called a sugar weight vector if +its elements are all positive and it is used for computing +a weighted total degree of a monomial, because such a weight +is used instead of total degree in sugar strategy. +On the other hand, a weight vector whose elements are not necessarily +positive cannot be set as a sugar weight, but it is useful for +generalizing term order. In fact, such a weight vector already +appeared in a matrix order. That is, each row of a matrix defining +a term order is regarded as a weight vector. A block order +is also considered as a refinement of comparison by weight vectors. +It compares two terms by using a weight vector whose elements +corresponding to variables in a block is 1 and 0 otherwise, +then it applies a tie breaker. +\E + +\BJP +weight vector の設定は @code{dp_set_weight()} で行うことができる +が, 項順序を指定する際の他のパラメタ (項順序型, 変数順序) と +まとめて設定できることが望ましい. このため, 次のような形でも +項順序が指定できる. +\E +\BEG +A weight vector can be set by using @code{dp_set_weight()}. +However it is more preferable if a weight vector can be set +together with other parapmeters such as a type of term ordering +and a variable order. This is realized as follows. +\E + +@example +[64] B=[x+y+z-6,x*y+y*z+z*x-11,x*y*z-6]$ +[65] dp_gr_main(B|v=[x,y,z],sugarweight=[3,2,1],order=0); +[z^3-6*z^2+11*z-6,x+y+z-6,-y^2+(-z+6)*y-z^2+6*z-11] +[66] dp_gr_main(B|v=[y,z,x],order=[[1,1,0],[0,1,0],[0,0,1]]); +[x^3-6*x^2+11*x-6,x+y+z-6,-x^2+(-y+6)*x-y^2+6*y-11] +[67] dp_gr_main(B|v=[y,z,x],order=[[x,1,y,2,z,3]]); +[x+y+z-6,x^3-6*x^2+11*x-6,-x^2+(-y+6)*x-y^2+6*y-11] +@end example + +\BJP +いずれの例においても, 項順序は option として指定されている. +最初の例では @code{v} により変数順序を, @code{sugarweight} により +sugar weight vector を, @code{order}により項順序型を指定している. +二つ目の例における @code{order} の指定は matrix order と同様である. +すなわち, 指定された weight vector を左から順に使って weight の比較 +を行う. 三つ目の例も同様であるが, ここでは weight vector の要素を +変数毎に指定している. 指定がないものは 0 となる. 三つ目の例では, +@code{order} による指定では項順序が決定しない. この場合には, +tie breaker として全次数逆辞書式順序が自動的に設定される. +この指定方法は, @code{dp_gr_main}, @code{dp_gr_mod_main} など +の組み込み関数でのみ可能であり, @code{gr} などのユーザ定義関数 +では未対応である. +\E +\BEG +In each example, a term ordering is specified as options. +In the first example, a variable order, a sugar weight vector +and a type of term ordering are specified by options @code{v}, +@code{sugarweight} and @code{order} respectively. +In the second example, an option @code{order} is used +to set a matrix ordering. That is, the specified weight vectors +are used from left to right for comparing terms. +The third example shows a variant of specifying a weight vector, +where each component of a weight vector is specified variable by variable, +and unspecified components are set to zero. In this example, +a term order is not determined only by the specified weight vector. +In such a case a tie breaker by the graded reverse lexicographic ordering +is set automatically. +This type of a term ordering specification can be applied only to builtin +functions such as @code{dp_gr_main()}, @code{dp_gr_mod_main()}, not to +user defined functions such as @code{gr()}. +\E + +\BJP @node 有理式を係数とするグレブナ基底計算,,, グレブナ基底の計算 @section 有理式を係数とするグレブナ基底計算 \E @@ -1329,6 +1464,7 @@ Computation of the global b function is implemented as * tolexm minipolym:: * dp_gr_main dp_gr_mod_main dp_gr_f_main dp_weyl_gr_main dp_weyl_gr_mod_main dp_weyl_gr_f_main:: * dp_f4_main dp_f4_mod_main dp_weyl_f4_main dp_weyl_f4_mod_main:: +* nd_gr nd_gr_trace nd_f4 nd_f4_trace nd_weyl_gr nd_weyl_gr_trace:: * dp_gr_flags dp_gr_print:: * dp_ord:: * dp_ptod:: @@ -1405,13 +1541,21 @@ Computation of the global b function is implemented as strategy による計算, @code{hgr()} は trace-lifting および 斉次化による 矯正された sugar strategy による計算を行う. @item -@code{dgr()} は, @code{gr()}, @code{dgr()} を +@code{dgr()} は, @code{gr()}, @code{hgr()} を 子プロセスリスト @var{procs} の 2 つのプロセスにより同時に計算させ, 先に結果を返した方の結果を返す. 結果は同一であるが, どちらの方法が 高速か一般には不明のため, 実際の経過時間を短縮するのに有効である. @item @code{dgr()} で表示される時間は, この函数が実行されているプロセスでの CPU 時間であり, この函数の場合はほとんど通信のための時間である. +@item +多項式リスト @var{plist} の要素が分散表現多項式の場合は +結果も分散表現多項式のリストである. +この場合, 引数の分散多項式は与えられた順序に従い @code{dp_sort} で +ソートされてから計算される. +多項式リストの要素が分散表現多項式の場合も +変数の数分の不定元のリストを @var{vlist} 引数として与えないといけない +(ダミー). \E \BEG @item @@ -1440,6 +1584,13 @@ Therefore this function is useful to reduce the actual The CPU time shown after an exection of @code{dgr()} indicates that of the master process, and most of the time corresponds to the time for communication. +@item +When the elements of @var{plist} are distributed polynomials, +the result is also a list of distributed polynomials. +In this case, firstly the elements of @var{plist} is sorted by @code{dp_sort} +and the Grobner basis computation is started. +Variables must be given in @var{vlist} even in this case +(these variables are dummy). \E @end itemize @@ -2149,6 +2300,140 @@ except for lack of the argument for controlling homoge @fref{dp_ord}, @fref{dp_gr_flags dp_gr_print}, @fref{gr hgr gr_mod}, +\JP @fref{計算および表示の制御}. +\EG @fref{Controlling Groebner basis computations} +@end table + +\JP @node nd_gr nd_gr_trace nd_f4 nd_f4_trace nd_weyl_gr nd_weyl_gr_trace,,, グレブナ基底に関する函数 +\EG @node nd_gr nd_gr_trace nd_f4 nd_f4_trace nd_weyl_gr nd_weyl_gr_trace,,, Functions for Groebner basis computation +@subsection @code{nd_gr}, @code{nd_gr_trace}, @code{nd_f4}, @code{nd_f4_trace}, @code{nd_weyl_gr}, @code{nd_weyl_gr_trace} +@findex nd_gr +@findex nd_gr_trace +@findex nd_f4 +@findex nd_f4_trace +@findex nd_weyl_gr +@findex nd_weyl_gr_trace + +@table @t +@item nd_gr(@var{plist},@var{vlist},@var{p},@var{order}) +@itemx nd_gr_trace(@var{plist},@var{vlist},@var{homo},@var{p},@var{order}) +@itemx nd_f4(@var{plist},@var{vlist},@var{modular},@var{order}) +@itemx nd_f4_trace(@var{plist},@var{vlist},@var{homo},@var{p},@var{order}) +@item nd_weyl_gr(@var{plist},@var{vlist},@var{p},@var{order}) +@itemx nd_weyl_gr_trace(@var{plist},@var{vlist},@var{homo},@var{p},@var{order}) +\JP :: グレブナ基底の計算 (組み込み函数) +\EG :: Groebner basis computation (built-in functions) +@end table + +@table @var +@item return +\JP リスト +\EG list +@item plist vlist +\JP リスト +\EG list +@item order +\JP 数, リストまたは行列 +\EG number, list or matrix +@item homo +\JP フラグ +\EG flag +@item modular +\JP フラグまたは素数 +\EG flag or prime +@end table + +\BJP +@itemize @bullet +@item +これらの函数は, グレブナ基底計算組み込み関数の新実装である. +@item @code{nd_gr} は, @code{p} が 0 のとき有理数体上の Buchberger +アルゴリズムを実行する. @code{p} が 2 以上の自然数のとき, GF(p) 上の +Buchberger アルゴリズムを実行する. +@item @code{nd_gr_trace} および @code{nd_f4_trace} +は有理数体上で trace アルゴリズムを実行する. +@code{p} が 0 または 1 のとき, 自動的に選ばれた素数を用いて, 成功する +まで trace アルゴリズムを実行する. +@code{p} が 2 以上のとき, trace はGF(p) 上で計算される. trace アルゴリズム +が失敗した場合 0 が返される. @code{p} が負の場合, グレブナ基底チェックは +行わない. この場合, @code{p} が -1 ならば自動的に選ばれた素数が, +それ以外は指定された素数を用いてグレブナ基底候補の計算が行われる. +@code{nd_f4_trace} は, 各全次数について, ある有限体上で F4 アルゴリズム +で行った結果をもとに, その有限体上で 0 でない基底を与える S-多項式のみを +用いて行列生成を行い, その全次数における基底を生成する方法である. 得られる +多項式集合はやはりグレブナ基底候補であり, @code{nd_gr_trace} と同様の +チェックが行われる. +@item +@code{nd_f4} は @code{modular} が 0 のとき有理数体上の, @code{modular} が +マシンサイズ素数のとき有限体上の F4 アルゴリズムを実行する. +@item +@code{nd_weyl_gr}, @code{nd_weyl_gr_trace} は Weyl 代数用である. +@item +いずれの関数も, 有理関数体上の計算は未対応である. +@item +一般に @code{dp_gr_main}, @code{dp_gr_mod_main} より高速であるが, +特に有限体上の場合顕著である. +@end itemize +\E + +\BEG +@itemize @bullet +@item +These functions are new implementations for computing Groebner bases. +@item @code{nd_gr} executes Buchberger algorithm over the rationals +if @code{p} is 0, and that over GF(p) if @code{p} is a prime. +@item @code{nd_gr_trace} executes the trace algorithm over the rationals. +If @code{p} is 0 or 1, the trace algorithm is executed until it succeeds +by using automatically chosen primes. +If @code{p} a positive prime, +the trace is comuted over GF(p). +If the trace algorithm fails 0 is returned. +If @code{p} is negative, +the Groebner basis check and ideal-membership check are omitted. +In this case, an automatically chosen prime if @code{p} is 1, +otherwise the specified prime is used to compute a Groebner basis +candidate. +Execution of @code{nd_f4_trace} is done as follows: +For each total degree, an F4-reduction of S-polynomials over a finite field +is done, and S-polynomials which give non-zero basis elements are gathered. +Then F4-reduction over Q is done for the gathered S-polynomials. +The obtained polynomial set is a Groebner basis candidate and the same +check procedure as in the case of @code{nd_gr_trace} is done. +@item +@code{nd_f4} executes F4 algorithm over Q if @code{modular} is equal to 0, +or over a finite field GF(@code{modular}) +if @code{modular} is a prime number of machine size (<2^29). +@item +@code{nd_weyl_gr}, @code{nd_weyl_gr_trace} are for Weyl algebra computation. +@item +Each function cannot handle rational function coefficient cases. +@item +In general these functions are more efficient than +@code{dp_gr_main}, @code{dp_gr_mod_main}, especially over finite fields. +@end itemize +\E + +@example +[38] load("cyclic")$ +[49] C=cyclic(7)$ +[50] V=vars(C)$ +[51] cputime(1)$ +[52] dp_gr_mod_main(C,V,0,31991,0)$ +26.06sec + gc : 0.313sec(26.4sec) +[53] nd_gr(C,V,31991,0)$ +ndv_alloc=1477188 +5.737sec + gc : 0.1837sec(5.921sec) +[54] dp_f4_mod_main(C,V,31991,0)$ +3.51sec + gc : 0.7109sec(4.221sec) +[55] nd_f4(C,V,31991,0)$ +1.906sec + gc : 0.126sec(2.032sec) +@end example + +@table @t +\JP @item 参照 +\EG @item References +@fref{dp_ord}, +@fref{dp_gr_flags dp_gr_print}, \JP @fref{計算および表示の制御}. \EG @fref{Controlling Groebner basis computations} @end table