=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/builtin/array.texi,v retrieving revision 1.3 retrieving revision 1.8 diff -u -p -r1.3 -r1.8 --- OpenXM/src/asir-doc/parts/builtin/array.texi 2000/02/05 12:01:09 1.3 +++ OpenXM/src/asir-doc/parts/builtin/array.texi 2003/10/19 07:21:57 1.8 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/array.texi,v 1.2 1999/12/21 02:47:33 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/array.texi,v 1.7 2003/04/20 08:01:28 noro Exp $ \BJP @node 配列,,, 組み込み函数 @section 配列 @@ -10,10 +10,11 @@ @menu * newvect:: +* newbytearray:: * vtol:: * newmat:: * size:: -* det:: +* det invmat:: * qsort:: @end menu @@ -196,13 +197,69 @@ A conversion from a list to a vector is done by @code{ @fref{newvect}. @end table +\JP @node newbytearray,,, 配列 +\EG @node newbytearray,,, Arrays +@subsection @code{newbytearray} +@findex newbytearray + +@table @t +@item newbytearray(@var{len},[@var{listorstring}]) +\JP :: 長さ @var{len} の byte array を生成する. +\EG :: Creates a new byte array. +@end table + +@table @var +@item return +byte array +@item len +\JP 自然数 +\EG non-negative integer +@item listorstring +\JP リストまたは文字列 +\EG list or string +@end table + +@itemize @bullet +@item +\JP @code{newvect} と同様にして byte array を生成する. +\EG This function generates a byte array. The specification is +similar to that of @code{newvect}. +@item +\JP 文字列で初期値を指定することも可能である. +\EG The initial value can be specified by a character string. +@item +\JP byte array の要素のアクセスは配列と同様である. +\EG One can access elements of a byte array just as an array. +@end itemize + +@example +[182] A=newbytearray(3); +|00 00 00| +[183] A=newbytearray(3,[1,2,3]); +|01 02 03| +[184] A=newbytearray(3,"abc"); +|61 62 63| +[185] A[0]; +97 +[186] A[1]=123; +123 +[187] A; +|61 7b 63| +@end example + +@table @t +\JP @item 参照 +\EG @item References +@fref{newvect}. +@end table + \JP @node newmat,,, 配列 \EG @node newmat,,, Arrays @subsection @code{newmat} @findex newmat @table @t -@item newmat(@var{row},@var{col} [,@var{[[a,b,}...@var{],[c,d,}...@var{],}...@var{]}]) +@item newmat(@var{row},@var{col} [,[[@var{a},@var{b},...],[@var{c},@var{d},...],...]]) \JP :: @var{row} 行 @var{col} 列の行列を生成する. \EG :: Creates a new matrix with @var{row} rows and @var{col} columns. @end table @@ -211,10 +268,10 @@ A conversion from a list to a vector is done by @code{ @item return \JP 行列 \EG matrix -@item row,col +@item row col \JP 自然数 \EG non-negative integer -@item a,b,c,d +@item a b c d \JP 任意 \EG arbitrary @end table @@ -280,7 +337,7 @@ return to toplevel @table @t \JP @item 参照 \EG @item References -@fref{newvect}, @fref{size}, @fref{det}. +@fref{newvect}, @fref{size}, @fref{det invmat}. @end table \JP @node size,,, 配列 @@ -348,21 +405,25 @@ in a rational expression. @fref{car cdr cons append reverse length}, @fref{nmono}. @end table -\JP @node det,,, 配列 -\EG @node det,,, Arrays -@subsection @code{det} +\JP @node det invmat,,, 配列 +\EG @node det invmat,,, Arrays +@subsection @code{det},@code{invmat} @findex det +@findex invmat @table @t @item det(@var{mat}[,@var{mod}]) \JP :: @var{mat} の行列式を求める. \EG :: Determinant of @var{mat}. +@item invmat(@var{mat}) +\JP :: @var{mat} の逆行列を求める. +\EG :: Inverse matrix of @var{mat}. @end table @table @var @item return -\JP 式 -\EG expression +\JP @code{det}: 式, @code{invmat}: リスト +\EG @code{det}: expression, @code{invmat}: list @item mat \JP 行列 \EG matrix @@ -374,7 +435,9 @@ in a rational expression. @itemize @bullet \BJP @item -行列 @var{mat} の行列式を求める. +@code{det} は行列 @var{mat} の行列式を求める. +@code{invmat} は行列 @var{mat} の逆行列を求める. 逆行列は @code{[分母, 分子]} +の形で返され, @code{分母}が行列, @code{分母/分子} が逆行列となる. @item 引数 @var{mod} がある時, GF(@var{mod}) 上での行列式を求める. @item @@ -383,7 +446,10 @@ in a rational expression. \E \BEG @item -Determinant of matrix @var{mat}. +@code{det} computes the determinant of matrix @var{mat}. +@code{invmat} computes the inverse matrix of matrix @var{mat}. +@code{invmat} returns a list @code{[num,den]}, where @code{num} +is a matrix and @code{num/den} represents the inverse matrix. @item The computation is done over GF(@var{mod}) if @var{mod} is specitied. @item @@ -405,8 +471,26 @@ is more efficient than the fraction free Gaussian algo [ 1 u u^2 u^3 u^4 ] [ 1 v v^2 v^3 v^4 ] [95] fctr(det(A)); -[[1,1],[u-v,1],[-z+v,1],[-z+u,1],[-y+u,1],[y-v,1],[-y+z,1],[-x+u,1],[-x+z,1], -[-x+v,1],[-x+y,1]] +[[1,1],[u-v,1],[-z+v,1],[-z+u,1],[-y+u,1],[y-v,1],[-y+z,1],[-x+u,1], +[-x+z,1],[-x+v,1],[-x+y,1]] +[96] A = newmat(3,3)$ +[97] for(I=0;I<3;I++)for(J=0,B=A[I],W=V[I];J<3;J++)B[J]=W^J; +[98] A; +[ 1 x x^2 ] +[ 1 y y^2 ] +[ 1 z z^2 ] +[99] invmat(A); +[[ -z*y^2+z^2*y z*x^2-z^2*x -y*x^2+y^2*x ] +[ y^2-z^2 -x^2+z^2 x^2-y^2 ] +[ -y+z x-z -x+y ],(-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y] +[100] A*B[0]; +[ (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y 0 0 ] +[ 0 (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y 0 ] +[ 0 0 (-y+z)*x^2+(y^2-z^2)*x-z*y^2+z^2*y ] +[101] map(red,A*B[0]/B[1]); +[ 1 0 0 ] +[ 0 1 0 ] +[ 0 0 1 ] @end example @table @t