=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/builtin/misc.texi,v retrieving revision 1.3 retrieving revision 1.28 diff -u -p -r1.3 -r1.28 --- OpenXM/src/asir-doc/parts/builtin/misc.texi 1999/12/21 02:47:33 1.3 +++ OpenXM/src/asir-doc/parts/builtin/misc.texi 2019/06/06 04:33:11 1.28 @@ -1,4 +1,4 @@ -@comment $OpenXM$ +@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/misc.texi,v 1.27 2019/03/29 01:57:46 noro Exp $ \BJP @node その他,,, 組み込み函数 @section その他 @@ -15,6 +15,9 @@ * help:: * time:: * cputime tstart tstop:: +* timer:: +* currenttime:: +* sleep:: * heap:: * version:: * shell:: @@ -35,6 +38,12 @@ @item ctrl("@var{switch}"[,@var{obj}]) \JP :: 環境設定 \EG :: Sets the value of @var{switch}. +@item ctrl() +\JP :: 環境の表示 +\EG :: Show the values of @var{switch}'s. +@item ctrl(|desc=1) +\JP :: 環境およびその短い説明の表示 +\EG :: Show the values of @var{swtich}'s and short descriptions @end table @table @var @@ -58,42 +67,169 @@ @item スイッチは文字列として入力する. すなわちダブルクォートで囲む. @item -スイッチは次の通り. 以下で, on は 1, off は 0 を意味する. +スイッチは次の通り. + @table @code -@item cputime -on の時 CPU time および GC time を表示, off の時 表示しない. @code{cputime()} -を参照. -@code{ctrl("cputime",@var{onoff})} は @code{cputime(@var{onoff})} と同じである. -@item nez -EZGCD のアルゴリズムの切替え. デフォルトで 1 であり, とくに切替える必要 -はない. -@item echo -on の時は標準入力を繰り返して出力し, off の時は標準入力を繰り返さない. -@code{output} コマンドを用いる際に有効である. -@item bigfloat -on の時, 入力された浮動小数は @b{bigfloat} に変換され, 浮動小数演算は -@b{PARI} (@xref{pari}) により行われる. デフォルトの有効桁数は 9 桁である. -有効桁数を増やしたい時には @code{setprec()} を用いる. -off の時, 入力された浮動小数は, 倍精度浮動小数に変換される. -@cindex PARI @item adj ガーベッジコレクションの頻度の変更. 1 以上の有理数が指定できる. デフォルト値は 3. 1 に近い程, ガーベッジコレクションせずにヒープを 大きくとるようになる. 整数値はコマンドラインで指定できる. @xref{コマンドラインオプション}. -@item verbose -on の時, 函数の再定義時にメッセージを表示する. + +@item allow_laurent +1 の時, 単項式の指数に負の整数を許す. + +@item bigfloat +1 の時, 入力された浮動小数は @b{bigfloat} に変換され, 浮動小数演算は +@b{PARI} (@ref{pari}) により行われる. デフォルトの有効桁数は 9 桁である. +有効桁数を増やしたい時には @code{setprec()} を用いる. +0 の時, 入力された浮動小数は, 倍精度浮動小数に変換される. +@cindex PARI + +@item cputime +1 の時 CPU time および GC time を表示, 0 の時表示しない. @code{cputime()} +を参照. +@code{ctrl("cputime",@var{onoff})} は @code{cputime(@var{onoff})} と同じである. + +@item debug_plot +1 の時, @code{ox_plot} がメッセージウィンドウつきで起動される. + +@item debug_up +1の時, 1変数専用多項式環関数(@code{umul()}など)実行時にメッセージを表示する. + +@item debug_window +1 の時 debug_window がポップアップして開く. +(デフォルト値は 0.) + +@item diag_period +@code{nd_gr()}, @code{nd_gr_trace()} を斉次イデアルに対して実行する際, 途中で実行される中間基底間の相互簡約 +の頻度を指定する. 値が @code{n} なら, 新しく基底が @code{n}個生成されるたびに相互簡約が +実行される. + +@item double_output +1 の時, 倍精度浮動小数はつねに ddd.ddd の形で表示される. + +@item echo +1 の時は標準入力を繰り返して出力し, 0 の時は標準入力を繰り返さない. +@code{output} コマンドを用いる際に有効である. + +@item evalef +0 の時 eval の引数が評価されたときそれ以上評価できなくなった場合, 不定元リストに +登録される. たとえば eval(sin(0.1)) と実行すると sin(0.1) がそれ以上評価できないため +不定元リストに登録される. +1 の時は, 登録されない. +初等関数の数値評価を繰り返し行う時はこのオプションを使用すべきである. +(デフォルト値は 0.) +@xref{ord} + +@item error_in_timer +1 の時, タイマー終了時に通常のエラー処理が実行される. + +@item f4_nocheck +1の時, @code{nd_f4}, @code{nd_f4_trace} における行列の簡約をCRTで行う際に, 結果の +チェックを行わない. + +@item fake_ox_reset +@itemx no_ox_reset +1 のとき, ox_reset を実装してないサーバーには代わりに ox_shutdown を送信する. +ox_reset の実装の有無は mathcap の optional argument (第四引数) +に文字列 no_ox_reset が設定されているかどうかで判断する. +ox_pari を利用するときはこのフラグを1にしておくことが望ましい. +(デフォルト値は 0.) +@xref{分散計算}. + +@item fortran_output +1 の時, 多項式の表示が FORTRAN スタイルになる. すなわち冪が +@samp{^} の代わりに @samp{**} で表される. +(デフォルト値は 0.) + @item hex -1 のとき, 整数は 0x で始まる 16 進数として表示される. -1 のとき, 16 進数は, +1 の時, 整数は 0x で始まる 16 進数として表示される. -1 のとき, 16 進数は, 間に @samp{|} をはさんで 8 桁ごとに区切って表示される. + +@item hideargs +1の時, 関数呼び出しを表示する際に引数が表示されない. + +@item loadpath +@code{ASIRLOADPATH} を上書きする. + +@item message +1 の時, @code{ox_asir}, @code{ox_plot} 実行時に開始メッセージを表示する. + +@item new_hensel +1 の時, 有理数体上の1変数多項式の因数分解において, 関数 @code{hensel2()} が用いられる. + +@item nez +EZGCD のアルゴリズムの切替え. デフォルトで 1 であり, とくに切替える必要 +はない. + +@item no_debug_on_error +1 の時, エラー時にデバッグモードに入らない. + +@item no_prompt +1の時, プロンプトが表示されない. + +@item outputstyle +1 の時, 行列, ベクトルが @code{mat(...)}, @code{vect(...)} の形で表示される. + @item ox_batch 1 のとき, 送信バッファがいっぱいになった時のみ自動的に flush. 0 のとき, データ, コマンド送信毎に flush. (デフォルト値は 0.) -@xref{分散計算} +@xref{分散計算}. + @item ox_check 1 のとき, 送信データを相手プロセスが受け取れるかどうかチェックする. 0 のときしない. (デフォルト値は 1.) -@xref{分散計算} +@xref{分散計算}. + +@item ox_exchange_mathcap +1 のとき, OX server との接続開始時に, 自動的に mathcap の交換を行う. +(デフォルト値は 1.) +@xref{分散計算}. + +@item plot_by_bigfloat +N のとき, 10進数での精度を N 桁として, bigfloat を用いて plot を行う. +(デフォルトでは double を用いて plot を行う.) + +@item print_quote +quote データの表示方法を指定する. +0 の時, quote データは単に @code{<...quoted...>}と表示される. 1 の時, リスト形式で表示される. +2 の時, 自然な数式の形で表示される. + +@item prompt +0 のときプロンプトを表示しない. 1 のとき標準プロンプトを表示. +C スタイルのフォマット文字列をもちいるとユーザ定義のプロンプト. +例(asirgui では不可): +@code{ ctrl("prompt","\033[32m[%d]:= \033[0m")} + +@item quiet_mode +1 のとき, 起動時に著作権表示を行わない. +@xref{コマンドラインオプション}. + +@item real_binary +1の時, 倍精度浮動小数を2進表示する. + +@item real_digit +倍精度浮動小数の表示の桁数を指定する. + +@item show_crossref +1 の時, 関数定義を読み込む際に, クロスリファレンスが表示される. + +@item show_orderspec +1 の時, dp 系関数によるグレブナー基底計算関数に対する複合的な項順序の指定時に +その詳細を表示する. + +@item StrassenSize +Strassen-Winograd による行列の高速乗算アルゴリズム実行におけるパラメタの値を設定する. + +@item terse +1 の時, ユーザ定義 callback 実行時にメッセージを表示しない. + +@item weight_check +1 の時, nd 系関数によるグレブナー基底において, 指定された weight を用いたweight のoverflow チェックを行う. +@item verbose +1 の時, 函数の再定義時にメッセージを表示する. + @end table \E \BEG @@ -128,7 +264,7 @@ This command will be useful when used with command @co If `on', floating operations will be done by @b{PARI} system with arbitrary precision floating point operations. Default precision is set to 9 digits. To change the precision, use -command @code{setprec}. +command @code{setbprec setprec}. If `off', floating operations will be done by @b{Asir}'s own floating operation routines with a fixed precision operations of standard floating double. @@ -141,30 +277,108 @@ and as a result, the frequency of garbage collection d @xref{Command line options}. @item verbose If `on' a warning messages is displayed when a function is redefined. +@item quiet_mode +If 1 is set, the copyright notice has been displayed at boot time. +@item prompt +If the value is 0, then prompt is not output. +If the value is 1, then the standard prompt is output. +Asir prompt can be customized by giving a C-style format string. +Example (for unix asir); +@code{ ctrl("prompt","\033[32m[%d]:= \033[0m")} + @item hex If 1 is set, integers are displayed as hexadecimal numbers with prefix -@code{0x}. if -1 is set, hexadecimal numbers are desplayed with +@code{0x}. if -1 is set, hexadecimal numbers are displayed with @samp{|} inserted at every 8 hexadecimal digits. +@item real_digit +Sets the number of digits used to print a floating double. +@item double_output +If set to 1, any floating double is printed in the style ddd.ddd. +@item fortran_output +If `on' polynomials are displayed in FORTRAN style. That is, a power +is represented by @samp{**} instead of @samp{^}. +The default value is 'off. @item ox_batch If 'on', the OpenXM send buffer is flushed only when the buffer is full. If 'off', the buffer is always flushed at each sending of data or command. The default value is 'off'. -@xref{Distributed computation} +@xref{Distributed computation}. @item ox_check If 'on' the check by mathcap is done before sending data. The default value is 'on'. -@xref{Distributed computation} +@xref{Distributed computation}. +@item ox_exchange_mathcap +If 'on' Asir forces the exchange of mathcaps at the communication startup. +The default value is 'on'. +@xref{Distributed computation}. +@item debug_window +When 1, a debug window pops up. +(The default value is 0.) +@item no_debug_on_error +When 1, asir or ox_asir do not get into the debug mode. +@item fake_ox_reset +When 1, the function ox_reset sends ox_shutdown insread of ox_reset +to servers which do not implement ox_reset protocol. +It is checked by the optional argument (the fourth argument) +containing the string "no_ox_reset" +of mathcap if ox_reset is implemented or not. +When you use ox_pari, it is recommended to set this flag 1. +(The default value is 0.) +@xref{Distributed computation}. +@item plot_by_bigfloat +If its value N is not equal to zero, then plotting is done by bigfloat. +(The double numbers are used as the default.) +@item evalef +When it is set to 0, the arguments of eval are registered to the list of +indeterminants when arguments are no longer to be simplified. +For example, when this flag is 0, sin(0.1) is registered to the list of +indeterminants when eval(sin(0.1)) is evaluated. +When it is set to 1, arguments are numerically evaluated. +It is recommended to turn on this option, when you repeat to evaluate elementary functions numerically. +(The default value is 0.) +@xref{ord} @end table \E @end itemize +@example +[1917] ctrl(); +[[oxpari_start,0],[oxpari_id,-1],... snip ....,[plot_by_bigfloat,0],[debug_plot,0]] +[1918] map(print,ctrl(|desc=1)); +[oxpari_start,0,oxpari starting function.] +[oxpari_id,-1,Id of ox_pari.] +... snip ... +[plot_by_bigfloat,0,If set to 1, computation is done by using MPFR bigfloat functions in ox_plot.] +[debug_plot,0,If set to 1, ox_plot is executed with the message window.] +@end example + @table @t \JP @item 参照 \EG @item References @fref{cputime tstart tstop}, @fref{output}, -@fref{pari}, @fref{setprec}, @fref{eval}. +@fref{pari}, @fref{setbprec setprec}, @fref{eval deval}. @end table +@noindent +ChangeLog +@itemize @bullet +@item @xref{ChangeLog} +\BEG +@item plot_by_bigfloat switch is added on 2017.09.04. The following files are changed. +\E +\BJP +@item 欠けていたスイッチの説明を追加した (2018.3.29). +@item plot_by_bigfloat スイッチは 2017.09.04 に加えられた. 変更を受けたファイルは下記のとおり. +\E +@item 1.54 ctrl.c, + 1.14 bf.c, + 1.75 tcpf.c, + 1.13 calc.c, + 1.36 if.c, + 1.25 ifplot.h, + 1.33 plotf.c +@end itemize + \JP @node debug,,, その他 \EG @node debug,,, Miscellaneouses @subsection @code{debug} @@ -195,7 +409,7 @@ the debugger is ready for commands. Typing in @code{quit} (Note! without a semicolon.) brings you to exit the debug-mode. @item -@xref{Debugger} for details. +See @ref{Debugger} for details. \E @end itemize @@ -313,6 +527,11 @@ return to toplevel に同名のファイルがあれば, 環境変数 @code{PAGER} に設定されているコマンド, あるいは @samp{more} を呼び出してそのファイルを表示する. @item +環境変数 @code{LANG} が設定されている場合, その値が @code{"japan"} または +@code{"ja_JP"} で始まるなら, @samp{help} の代わりに @samp{help-ja} +にあるファイルが表示される. そうでない場合, @samp{help-en} +にあるファイルが表示される. +@item Windows 版では, コマンドラインからのヘルプ呼び出しは未サポートだが, メニューから HTML 形式のものを呼び出し用いることができる. \E @@ -325,6 +544,12 @@ same name in the directory @samp{help} under standard the file is displayed by a command set to the environmental variable @code{PAGER} or else command @samp{more}. @item +If the @code{LANG} environment variable is set and its value +begins with @code{"japan"} or @code{"ja_JP"}, then the file in +@samp{help-ja} is displayed. If its value does not begin with +@code{"japan"} or @code{"ja_JP"}, then the file in @samp{help-en} +is displayed. +@item On Windows HTML-style help is available from the menu. \E @end itemize @@ -435,7 +660,7 @@ for a reply to interruption prompting are added to the @table @t \JP @item 参照 \EG @item References -@fref{cputime tstart tstop}. +@fref{cputime tstart tstop}, @fref{currenttime}. @end table \JP @node cputime tstart tstop,,, その他 @@ -532,9 +757,137 @@ the debug-mode and execute @code{cputime(1)}. @table @t \JP @item 参照 \EG @item References -@fref{time}, @fref{ctrl}. +@fref{time}, @fref{currenttime}, @fref{ctrl}. @end table +\JP @node timer,,, その他 +\EG @node timer,,, Miscellaneouses +@subsection @code{timer} +@findex timer + +@table @t +@item timer(@var{interval},@var{expr},@var{val}) +\JP :: 制限時間つきで計算を実行する. +\EG :: Compute an expression under the interval timer. +@end table + +@table @var +@item return +\JP 結果 +\EG result + +@item interval +\JP 制限時間 (秒) +\EG interval (second) + +@item expr +\JP 計算する式 +\EG expression to be computed + +@item val +\JP タイマによる中断時の戻り値 +\EG a value to be returned when the timer is expired +@end table + +@itemize @bullet + +\BJP +@item +@code{timer()} は, 時間を指定して計算を実行する. 指定時間内に計算が完了 +した場合その値を返す. 指定時間内に計算が完了しなかった場合, 第 3 引数 +を返す. + +@item +第 3 引数の値は, 計算が完了した場合の値と区別できる必要がある. +\E + +\BEG +@item +@code{timer()} computes an expression under the interval timer. +If the computation finishes within the specified interval, it +returns the result of the computation. Otherwise it returns the third +argument. + +@item +The third argument should be distinguishable from the result on success. +\E + +@end itemize + +@example +[0] load("cyclic"); +1 +[10] timer(10,dp_gr_main(cyclic(7),[c0,c1,c2,c3,c4,c5,c6],1,1,0),0); +interval timer expired (VTALRM) +0 +[11] +@end example + +\JP @node currenttime,,, その他 +\EG @node currenttime,,, Miscellaneouses +@subsection @code{currenttime} +@findex currenttime + +@table @t +@item currenttime() +\JP :: 現在時刻を取得 +\EG :: Get current time. +@end table + +@table @var +@item return +\JP 1970年1月1日0時0分0秒からの経過秒数. +\EG UNIX time. +@end table + +@itemize @bullet + +@item +\JP @code{currenttime()} は現在時刻を返す. UNIX の場合, time(3) を呼んでいるだけである. +\EG See also time(3) in UNIX manuals. + +@end itemize + +@example +[0] currenttime(); +1071639228 +[1] +@end example + +\JP @node sleep,,, その他 +\EG @node sleep,,, Miscellaneouses +@subsection @code{sleep} +@findex sleep + +@table @t +@item sleep(@var{interval}) +\JP :: プロセスの実行を停止 +\EG :: Suspend computation for an interval. +@end table + +@table @var +@item return +1 + +@item interval +\JP 停止時間 (マイクロ秒) +\EG interval (micro second) +@end table + +@itemize @bullet + +@item +\JP @code{sleep()} は, プロセスの実行を停止する. UNIX の場合, usleep を呼んでいるだけである. +\EG See also usleep(3) in UNIX manuals. + +@end itemize + +@example +[0] sleep(1000); +1 +[1] +@end example + \JP @node heap,,, その他 \EG @node heap,,, Miscellaneouses @subsection @code{heap} @@ -643,8 +996,9 @@ at the activation of @b{Asir}. (@xref{Command line opt @b{Asir} のバージョンを自然数で返す. \E \BEG -Command @code{version()} returns the version identification number -, an integer of @b{Asir} in use. +@item +Command @code{version()} returns the version identification number, +an integer of @b{Asir} in use. \E @end itemize @@ -688,16 +1042,16 @@ as its return value. @example [0] shell("ls"); -alg da katsura ralg suit -algt defs.h kimura ratint test -alpi edet kimura3 robot texput.log -asir.o fee mfee sasa wang -asir_symtab gr mksym shira wang_data -base gr.h mp snf1 wt -bgk help msubst solve -chou hom p sp -const ifplot proot strum -cyclic is r sugar +alg da katsura ralg suit +algt defs.h kimura ratint test +alpi edet kimura3 robot texput.log +asir.o fee mfee sasa wang +asir_symtab gr mksym shira wang_data +base gr.h mp snf1 wt +bgk help msubst solve +chou hom p sp +const ifplot proot strum +cyclic is r sugar 0 [1] @end example @@ -723,7 +1077,7 @@ cyclic is r sugar @item arg0 \JP リスト, ベクトル, 行列 \EG list, vector or matrix -@item arg1, ... +@item arg1 ... \JP 任意 (残りの引数) \EG arbitrary (the rest of arguments) @end table @@ -742,6 +1096,12 @@ cyclic is r sugar @var{arg0} がリスト, ベクトル, 行列以外の場合, 単に @var{arg0}, @var{arg1}, ... を引数として @var{function} を呼び出しその 結果を返す. +@item +@code{map} の引数 @var{function} で与えられる函数は, 内部的にも函数と +して実装されていなければならない. そうでなければ parse error になる. +例えば @code{map} 自身や @code{car}, @code{cdr} などは内部的には函数で +はなく, Asir の文法におけるキーワードとして実装されている. したがって +@code{map} の引数に @code{map} をとることはできない. \E \BEG @item @@ -772,9 +1132,12 @@ returns the value of @var{function}(@var{arg0},@var{ar @findex flist @table @t -@item flist() +@item flist([mname]) \JP :: 現在定義されている函数名を文字列リストとして返す. \EG :: Returns the list of function names currently defined. +@item mname +\JP モジュール名 +\EG a module name @end table @table @var @@ -787,7 +1150,8 @@ returns the value of @var{function}(@var{arg0},@var{ar \BJP @item 現在定義されている組み込み函数, ユーザ定義函数の函数名を文字列リスト -として返す. +として返す. モジュール名が指定された場合, そのモジュールで定義されている +関数名のみを返す. @item システム函数の後にユーザ定義函数が続く. \E @@ -795,6 +1159,8 @@ returns the value of @var{function}(@var{arg0},@var{ar @item Returns the list of names of built-in functions and user defined functions currently defined. The return value is a list of character strings. +If a module name is specified, only the names of functions defined in the module +are returned. @item The names of built-in functions are followed by those of user defined functions. @@ -914,7 +1280,7 @@ of the install directory. @findex getopt @table @t -@item getopt(@var{key}) +@item getopt([@var{key}]) \JP :: オプションの値を返す. \EG :: Returns the value of an option. @end table @@ -933,6 +1299,11 @@ of the install directory. がある (@pxref{オプション指定}). 指定されたオプションを関数内で 受け取るためにこの関数を用いる. @item +無引数で呼び出された場合, @code{getopt()} は +@code{[[key1,value1],[key2,value2],...]} なるリストを返す. +ここで, @code{key} は関数呼び出し時に指定されたオプション, @code{value} +はその値である. +@item 関数呼び出しの際に @var{key} がオプションとして指定されている 場合には, その値を返す. もし指定がない場合には, VOID 型オブジェクト (型識別子 -1) を返す. @code{getopt()} が返した値の型を @code{type()} @@ -954,6 +1325,12 @@ must be equal to that in the declaration of the functi A function with indefinite number of arguments can be realized by using @var{options} (@pxref{option}). The value of a specified option is retrieved by @code{getopt}. +@item +If @code{getopt()} is called with no argument, then it returns a list +@code{[[key1,value1],} @code{[key2,value2],@dots{}]}. +In the list, each @code{key} +is an option which was specified when the function executing @code{getopt} +was invoked, and @code{value} is the value of the option. @item If an option @var{key} is specified upon a function call, @code{getopt} return the value of the option. If such an option is not specified,