[BACK]Return to array.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts / builtin

Diff for /OpenXM/src/asir-doc/parts/builtin/array.texi between version 1.3 and 1.11

version 1.3, 2000/02/05 12:01:09 version 1.11, 2009/03/24 08:00:50
Line 1 
Line 1 
 @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.10 2005/02/10 04:59:21 noro Exp $
 \BJP  \BJP
 @node $BG[Ns(B,,, $BAH$_9~$_H!?t(B  @node $BG[Ns(B,,, $BAH$_9~$_H!?t(B
 @section $BG[Ns(B  @section $BG[Ns(B
Line 9 
Line 9 
 \E  \E
   
 @menu  @menu
 * newvect::  * newvect vector vect::
   * ltov::
 * vtol::  * vtol::
 * newmat::  * newbytearray::
   * newmat matrix::
 * size::  * size::
 * det::  * det nd_det invmat::
   
 * qsort::  * qsort::
 @end menu  @end menu
   
 \JP @node newvect,,, $BG[Ns(B  \JP @node newvect vector vect,,, $BG[Ns(B
 \EG @node newvect,,, Arrays  \EG @node newvect vector vect,,, Arrays
 @subsection @code{newvect}  @subsection @code{newvect}, @code{vector}, @code{vect}
 @findex newvect  @findex newvect
   @findex vector
   @findex vect
   
 @table @t  @table @t
 @item newvect(@var{len}[,@var{list}])  @item newvect(@var{len}[,@var{list}])
   @item vector(@var{len}[,@var{list}])
 \JP :: $BD9$5(B @var{len} $B$N%Y%/%H%k$r@8@.$9$k(B.  \JP :: $BD9$5(B @var{len} $B$N%Y%/%H%k$r@8@.$9$k(B.
 \EG :: Creates a new vector object with its length @var{len}.  \EG :: Creates a new vector object with its length @var{len}.
   @item vect([@var{elements}])
   \JP :: @var{elements} $B$rMWAG$H$9$k%Y%/%H%k$r@8@.$9$k(B.
   \EG :: Creates a new vector object by @var{elements}.
 @end table  @end table
   
 @table @var  @table @var
Line 38 
Line 47 
 @item list  @item list
 \JP $B%j%9%H(B  \JP $B%j%9%H(B
 \EG list  \EG list
   @item elements
   \JP $BMWAG$NJB$S(B
   \EG elements of the vector
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
 $BD9$5(B @var{len} $B$N%Y%/%H%k$r@8@.$9$k(B. $BBh(B 2 $B0z?t$,$J$$>l9g(B,  @code{vect} $B$OMWAG$NJB$S$+$i%Y%/%H%k$r@8@.$9$k(B.
   @item
   @code{vector} $B$O(B @code{newvect} $B$NJLL>$G$"$k(B.
   @item
   @code{newvect} $B$OD9$5(B @var{len} $B$N%Y%/%H%k$r@8@.$9$k(B. $BBh(B 2 $B0z?t$,$J$$>l9g(B,
 $B3F@.J,$O(B 0 $B$K=i4|2=$5$l$k(B. $BBh(B 2 $B0z?t$,$"$k>l9g(B,  $B3F@.J,$O(B 0 $B$K=i4|2=$5$l$k(B. $BBh(B 2 $B0z?t$,$"$k>l9g(B,
 $B%$%s%G%C%/%9$N>.$5$$@.J,$+$i(B, $B%j%9%H$N(B  $B%$%s%G%C%/%9$N>.$5$$@.J,$+$i(B, $B%j%9%H$N(B
 $B3FMWAG$K$h$j=i4|2=$5$l$k(B. $B3FMWAG$O(B, $B@hF,$+$i=g$K(B  $B3FMWAG$K$h$j=i4|2=$5$l$k(B. $B3FMWAG$O(B, $B@hF,$+$i=g$K(B
Line 69 
Line 85 
 $B$r=q$-49$($k$3$H$,$G$-$k(B.  $B$r=q$-49$($k$3$H$,$G$-$k(B.
 \E  \E
 \BEG  \BEG
   @item
   @code{vect} creates a new vector object by its elements.
   @item
   @code{vector} is an alias of @code{newvect}.
 @item  @item
 Creates a new vector object with its length @var{len} and its elements  @code{newvect} creates a new vector object with its length @var{len} and its elements
 all cleared to value 0.  all cleared to value 0.
 If the second argument, a list, is given, the vector is initialized by  If the second argument, a list, is given, the vector is initialized by
 the list elements.  the list elements.
Line 134  separated simply by a `blank space', while those of a 
Line 154  separated simply by a `blank space', while those of a 
 [5,6]  [5,6]
 [4] size(A);  [4] size(A);
 [5]  [5]
 [5] def afo(V) @{ V[0] = x; @}  [5] length(A);
 [6] afo(A)$  5
 [7] A;  [6] vect(1,2,3,4,[5,6]);
   [ 1 2 3 4 [5,6] ]
   [7] def afo(V) @{ V[0] = x; @}
   [8] afo(A)$
   [9] A;
 [ x 2 3 4 [5,6] ]  [ x 2 3 4 [5,6] ]
 @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{newmat}, @fref{size}, @fref{vtol}.  @fref{newmat}, @fref{size}, @fref{ltov}, @fref{vtol}.
 @end table  @end table
   
   \JP @node ltov,,, $BG[Ns(B
   \EG @node ltov,,, Arrays
   @subsection @code{ltov}
   @findex ltov
   
   @table @t
   @item ltov(@var{list})
   \JP :: $B%j%9%H$r%Y%/%H%k$KJQ49$9$k(B.
   \EG :: Converts a list into a vector.
   @end table
   
   @table @var
   @item return
   \JP $B%Y%/%H%k(B
   \EG vector
   @item list
   \JP $B%j%9%H(B
   \EG list
   @end table
   
   @itemize @bullet
   \BJP
   @item
   $B%j%9%H(B @var{list} $B$rF1$8D9$5$N%Y%/%H%k$KJQ49$9$k(B.
   @item
   $B$3$N4X?t$O(B @code{newvect(length(@var{list}), @var{list})} $B$KEy$7$$(B.
   \E
   \BEG
   @item
   Converts a list @var{list} into a vector of same length.
   See also @code{newvect()}.
   \E
   @end itemize
   
   @example
   [3] A=[1,2,3];
   [4] ltov(A);
   [ 1 2 3 ]
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{newvect}, @fref{vtol}.
   @end table
   
 \JP @node vtol,,, $BG[Ns(B  \JP @node vtol,,, $BG[Ns(B
 \EG @node vtol,,, Arrays  \EG @node vtol,,, Arrays
 @subsection @code{vtol}  @subsection @code{vtol}
Line 193  A conversion from a list to a vector is done by @code{
Line 263  A conversion from a list to a vector is done by @code{
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
   @fref{newvect}, @fref{ltov}.
   @end table
   
   \JP @node newbytearray,,, $BG[Ns(B
   \EG @node newbytearray,,, Arrays
   @subsection @code{newbytearray}
   @findex newbytearray
   
   @table @t
   @item newbytearray(@var{len},[@var{listorstring}])
   \JP :: $BD9$5(B @var{len} $B$N(B byte array $B$r@8@.$9$k(B.
   \EG :: Creates a new byte array.
   @end table
   
   @table @var
   @item return
   byte array
   @item len
   \JP $B<+A3?t(B
   \EG non-negative integer
   @item listorstring
   \JP $B%j%9%H$^$?$OJ8;zNs(B
   \EG list or string
   @end table
   
   @itemize @bullet
   @item
   \JP @code{newvect} $B$HF1MM$K$7$F(B byte array $B$r@8@.$9$k(B.
   \EG This function generates a byte array. The specification is
   similar to that of @code{newvect}.
   @item
   \JP $BJ8;zNs$G=i4|CM$r;XDj$9$k$3$H$b2DG=$G$"$k(B.
   \EG The initial value can be specified by a character string.
   @item
   \JP byte array $B$NMWAG$N%"%/%;%9$OG[Ns$HF1MM$G$"$k(B.
   \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 $B;2>H(B
   \EG @item References
 @fref{newvect}.  @fref{newvect}.
 @end table  @end table
   
 \JP @node newmat,,, $BG[Ns(B  \JP @node newmat matrix,,, $BG[Ns(B
 \EG @node newmat,,, Arrays  \EG @node newmat matrix,,, Arrays
 @subsection @code{newmat}  @subsection @code{newmat}, @code{matrix}
 @findex newmat  @findex newmat
   @findex matrix
   
 @table @t  @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},...],...]])
   @item matrix(@var{row},@var{col} [,[[@var{a},@var{b},...],[@var{c},@var{d},...],...]])
 \JP :: @var{row} $B9T(B @var{col} $BNs$N9TNs$r@8@.$9$k(B.  \JP :: @var{row} $B9T(B @var{col} $BNs$N9TNs$r@8@.$9$k(B.
 \EG :: Creates a new matrix with @var{row} rows and @var{col} columns.  \EG :: Creates a new matrix with @var{row} rows and @var{col} columns.
 @end table  @end table
Line 211  A conversion from a list to a vector is done by @code{
Line 339  A conversion from a list to a vector is done by @code{
 @item return  @item return
 \JP $B9TNs(B  \JP $B9TNs(B
 \EG matrix  \EG matrix
 @item row,col  @item row col
 \JP $B<+A3?t(B  \JP $B<+A3?t(B
 \EG non-negative integer  \EG non-negative integer
 @item a,b,c,d  @item a b c d
 \JP $BG$0U(B  \JP $BG$0U(B
 \EG arbitrary  \EG arbitrary
 @end table  @end table
Line 222  A conversion from a list to a vector is done by @code{
Line 350  A conversion from a list to a vector is done by @code{
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
   @code{matrix} $B$O(B @code{newmat} $B$NJLL>$G$"$k(B.
   @item
 @var{row} $B9T(B @var{col} $BNs$N9TNs$r@8@.$9$k(B. $BBh(B 3 $B0z?t$,$J$$>l9g(B,  @var{row} $B9T(B @var{col} $BNs$N9TNs$r@8@.$9$k(B. $BBh(B 3 $B0z?t$,$J$$>l9g(B,
 $B3F@.J,$O(B 0 $B$K=i4|2=$5$l$k(B. $BBh(B 3 $B0z?t$,$"$k>l9g(B,  $B3F@.J,$O(B 0 $B$K=i4|2=$5$l$k(B. $BBh(B 3 $B0z?t$,$"$k>l9g(B,
 $B%$%s%G%C%/%9$N>.$5$$@.J,$+$i(B, $B3F9T$,(B, $B%j%9%H$N(B  $B%$%s%G%C%/%9$N>.$5$$@.J,$+$i(B, $B3F9T$,(B, $B%j%9%H$N(B
Line 238  A conversion from a list to a vector is done by @code{
Line 368  A conversion from a list to a vector is done by @code{
 $B$r=q$-49$($k$3$H$,$G$-$k(B.  $B$r=q$-49$($k$3$H$,$G$-$k(B.
 \E  \E
 \BEG  \BEG
   @item
   @code{matrix} is an alias of @code{newmat}.
 @item  @item
 If the third argument, a list, is given, the newly created matrix  If the third argument, a list, is given, the newly created matrix
 is initialized so that each element of the list (again a list)  is initialized so that each element of the list (again a list)
Line 280  return to toplevel
Line 412  return to toplevel
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
 @fref{newvect}, @fref{size}, @fref{det}.  @fref{newvect}, @fref{size}, @fref{det nd_det invmat}.
 @end table  @end table
   
 \JP @node size,,, $BG[Ns(B  \JP @node size,,, $BG[Ns(B
Line 314  or a list containing row size and column size of the g
Line 446  or a list containing row size and column size of the g
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
 @var{vect} $BKt$O(B, @var{mat} $B$N%5%$%:$r%j%9%H$G=PNO$9$k(B.  @var{vect} $B$ND9$5(B, $B$^$?$O(B @var{mat} $B$NBg$-$5$r%j%9%H$G=PNO$9$k(B.
 @item  @item
 @var{list} $B$N%5%$%:$O(B @code{length()}$B$r(B, $BM-M}<0$K8=$l$kC19`<0$N?t$O(B @code{nmono()} $B$rMQ$$$k(B.  @var{vect} $B$ND9$5$O(B @code{length()} $B$G5a$a$k$3$H$b$G$-$k(B.
   @item
   @var{list} $B$ND9$5$O(B @code{length()}$B$r(B, $BM-M}<0$K8=$l$kC19`<0$N?t$O(B @code{nmono()} $B$rMQ$$$k(B.
 \E  \E
 \BEG  \BEG
 @item  @item
Line 335  in a rational expression.
Line 469  in a rational expression.
 [ 0 0 0 0 ]  [ 0 0 0 0 ]
 [1] size(A);  [1] size(A);
 [4]  [4]
 [2] B = newmat(2,3,[[1,2,3],[4,5,6]]);  [2] length(A);
   4
   [3] B = newmat(2,3,[[1,2,3],[4,5,6]]);
 [ 1 2 3 ]  [ 1 2 3 ]
 [ 4 5 6 ]  [ 4 5 6 ]
 [3] size(B);  [4] size(B);
 [2,3]  [2,3]
 @end example  @end example
   
Line 348  in a rational expression.
Line 484  in a rational expression.
 @fref{car cdr cons append reverse length}, @fref{nmono}.  @fref{car cdr cons append reverse length}, @fref{nmono}.
 @end table  @end table
   
 \JP @node det,,, $BG[Ns(B  \JP @node det nd_det invmat,,, $BG[Ns(B
 \EG @node det,,, Arrays  \EG @node det nd_det invmat,,, Arrays
 @subsection @code{det}  @subsection @code{det}, @code{nd_det}, @code{invmat}
 @findex det  @findex det
   @findex nd_det
   @findex invmat
   
 @table @t  @table @t
 @item det(@var{mat}[,@var{mod}])  @item det(@var{mat}[,@var{mod}])
   @itemx nd_det(@var{mat}[,@var{mod}])
 \JP :: @var{mat} $B$N9TNs<0$r5a$a$k(B.  \JP :: @var{mat} $B$N9TNs<0$r5a$a$k(B.
 \EG :: Determinant of @var{mat}.  \EG :: Determinant of @var{mat}.
   @item invmat(@var{mat})
   \JP :: @var{mat} $B$N5U9TNs$r5a$a$k(B.
   \EG :: Inverse matrix of @var{mat}.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 \JP $B<0(B  \JP @code{det}: $B<0(B, @code{invmat}: $B%j%9%H(B
 \EG expression  \EG @code{det}: expression, @code{invmat}: list
 @item mat  @item mat
 \JP $B9TNs(B  \JP $B9TNs(B
 \EG matrix  \EG matrix
Line 374  in a rational expression.
Line 516  in a rational expression.
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
 $B9TNs(B @var{mat} $B$N9TNs<0$r5a$a$k(B.  @code{det} $B$*$h$S(B @code{nd_det} $B$O9TNs(B @var{mat} $B$N9TNs<0$r5a$a$k(B.
   @code{invmat} $B$O9TNs(B @var{mat} $B$N5U9TNs$r5a$a$k(B. $B5U9TNs$O(B @code{[$BJ,Jl(B, $BJ,;R(B]}
   $B$N7A$GJV$5$l(B, @code{$BJ,Jl(B}$B$,9TNs(B, @code{$BJ,Jl(B/$BJ,;R(B} $B$,5U9TNs$H$J$k(B.
 @item  @item
 $B0z?t(B @var{mod} $B$,$"$k;~(B, GF(@var{mod}) $B>e$G$N9TNs<0$r5a$a$k(B.  $B0z?t(B @var{mod} $B$,$"$k;~(B, GF(@var{mod}) $B>e$G$N9TNs<0$r5a$a$k(B.
 @item  @item
 $BJ,?t$J$7$N%,%&%9>C5nK!$K$h$C$F$$$k$?$a(B, $BB?JQ?tB?9`<0$r@.J,$H$9$k(B  $BJ,?t$J$7$N%,%&%9>C5nK!$K$h$C$F$$$k$?$a(B, $BB?JQ?tB?9`<0$r@.J,$H$9$k(B
 $B9TNs$KBP$7$F$O>.9TNs<0E83+$K$h$kJ}K!$N$[$&$,8zN($,$h$$>l9g$b$"$k(B.  $B9TNs$KBP$7$F$O>.9TNs<0E83+$K$h$kJ}K!$N$[$&$,8zN($,$h$$>l9g$b$"$k(B.
   @item
   @code{nd_det} $B$OM-M}?t$^$?$OM-8BBN>e$NB?9`<09TNs$N9TNs<0(B
   $B7W;;@lMQ$G$"$k(B. $B%"%k%4%j%:%`$O$d$O$jJ,?t$J$7$N%,%&%9>C5nK!$@$,(B,
   $B%G!<%?9=B$$*$h$S>h=|;;$N9)IW$K$h$j(B, $B0lHL$K(B @code{det} $B$h$j9bB.$K(B
   $B7W;;$G$-$k(B.
 \E  \E
 \BEG  \BEG
 @item  @item
 Determinant of matrix @var{mat}.  @code{det} and @code{nd_det} compute 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  @item
 The computation is done over GF(@var{mod}) if @var{mod} is specitied.  The computation is done over GF(@var{mod}) if @var{mod} is specitied.
 @item  @item
 The fraction free Gaussian algorithm is employed.  For matrices with  The fraction free Gaussian algorithm is employed.  For matrices with
 multi-variate polynomial entries, minor expansion algorithm sometimes  multi-variate polynomial entries, minor expansion algorithm sometimes
 is more efficient than the fraction free Gaussian algorithm.  is more efficient than the fraction free Gaussian algorithm.
   @item
   @code{nd_det} can be used for computing the determinant of a matrix with
   polynomial entries over the rationals or finite fields. The algorithm
   is an improved vesion of the fraction free Gaussian algorithm
   and it computes the determinant faster than @code{det}.
 \E  \E
 @end itemize  @end itemize
   
Line 405  is more efficient than the fraction free Gaussian algo
Line 562  is more efficient than the fraction free Gaussian algo
 [ 1 u u^2 u^3 u^4 ]  [ 1 u u^2 u^3 u^4 ]
 [ 1 v v^2 v^3 v^4 ]  [ 1 v v^2 v^3 v^4 ]
 [95] fctr(det(A));  [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],  [[1,1],[u-v,1],[-z+v,1],[-z+u,1],[-y+u,1],[y-v,1],[-y+z,1],[-x+u,1],
 [-x+v,1],[-x+y,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  @end example
   
 @table @t  @table @t

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

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