[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.9 and 1.13

version 1.9, 2003/12/18 10:26:20 version 1.13, 2009/03/24 17:02:06
Line 1 
Line 1 
 @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/array.texi,v 1.8 2003/10/19 07:21:57 takayama Exp $  @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/array.texi,v 1.12 2009/03/24 08:21:45 ohara 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::  * ltov::
 * vtol::  * vtol::
 * newbytearray::  * newbytearray::
 * newmat::  * newmat matrix::
   * mat matr matc::
 * size::  * size::
 * det invmat::  * det nd_det invmat::
   * rowx rowm rowa colx colm cola::
   
 * 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 40 
Line 49 
 @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 71 
Line 87 
 $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 136  separated simply by a `blank space', while those of a 
Line 156  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{ltov}, @fref{vtol}.  @fref{newmat matrix}, @fref{size}, @fref{ltov}, @fref{vtol}.
 @end table  @end table
   
 \JP @node ltov,,, $BG[Ns(B  \JP @node ltov,,, $BG[Ns(B
Line 191  See also @code{newvect()}.
Line 215  See also @code{newvect()}.
 @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{vtol}.  @fref{newvect vector vect}, @fref{vtol}.
 @end table  @end table
   
 \JP @node vtol,,, $BG[Ns(B  \JP @node vtol,,, $BG[Ns(B
Line 241  A conversion from a list to a vector is done by @code{
Line 265  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}.  @fref{newvect vector vect}, @fref{ltov}.
 @end table  @end table
   
 \JP @node newbytearray,,, $BG[Ns(B  \JP @node newbytearray,,, $BG[Ns(B
Line 297  similar to that of @code{newvect}.
Line 321  similar to that of @code{newvect}.
 @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{newvect vector vect}.
 @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},@var{b},...],[@var{c},@var{d},...],...]])  @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 326  similar to that of @code{newvect}.
Line 352  similar to that of @code{newvect}.
 @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 342  similar to that of @code{newvect}.
Line 370  similar to that of @code{newvect}.
 $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 384  return to toplevel
Line 414  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 invmat}.  @fref{newvect vector vect}, @fref{size}, @fref{det nd_det invmat}.
 @end table  @end table
   
   \JP @node mat matr matc,,, $BG[Ns(B
   \EG @node mat matr matc,,, Arrays
   @subsection @code{mat}, @code{matr}, @code{matc}
   @findex mat
   @findex matr
   @findex matc
   
   @table @t
   @item mat(@var{vector}[,...])
   @item matr(@var{vector}[,...])
   \JP :: $B9T%Y%/%H%k$NJB$S$+$i9TNs$r@8@.$9$k(B.
   \EG :: Creates a new matrix by list of row vectors.
   @item matc(@var{vector}[,...])
   \JP :: $BNs%Y%/%H%k$NJB$S$+$i9TNs$r@8@.$9$k(B.
   \EG :: Creates a new matrix by list of column vectors.
   @end table
   
   @table @var
   @item return
   \JP $B9TNs(B
   \EG matrix
   @item @var{vector}
   \JP $BG[Ns$^$?$O%j%9%H(B
   \EG array or list
   @end table
   
   @itemize @bullet
   \BJP
   @item
   @code{mat} $B$O(B @code{matr} $B$NJLL>$G$"$k(B.
   @item
   $B0z?t$N3F%Y%/%H%k$OF1$8D9$5$r$b$D(B.
   $B3FMWAG$O(B, $B@hF,$+$i=g$K;H$o$l(B, $BB-$j$J$$J,$O(B 0 $B$,Kd$a$i$l$k(B.
   \E
   \BEG
   @item
   @code{mat} is an alias of @code{matr}.
   @item
   Each vector has same length.
   Elements are used from the first through the last.
   If the list is short, 0's are filled in the remaining matrix elements.
   \E
   @end itemize
   
   @example
   [0] matr([1,2,3],[4,5,6],[7,8]);
   [ 1 2 3 ]
   [ 4 5 6 ]
   [ 7 8 0 ]
   [1] matc([1,2,3],[4,5,6],[7,8]);
   [ 1 4 7 ]
   [ 2 5 8 ]
   [ 3 6 0 ]
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{newmat matrix}
   @end table
   
 \JP @node size,,, $BG[Ns(B  \JP @node size,,, $BG[Ns(B
 \EG @node size,,, Arrays  \EG @node size,,, Arrays
 @subsection @code{size}  @subsection @code{size}
Line 456  in a rational expression.
Line 547  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 invmat,,, $BG[Ns(B  \JP @node det nd_det invmat,,, $BG[Ns(B
 \EG @node det invmat,,, Arrays  \EG @node det nd_det invmat,,, Arrays
 @subsection @code{det},@code{invmat}  @subsection @code{det}, @code{nd_det}, @code{invmat}
 @findex det  @findex det
   @findex nd_det
 @findex invmat  @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})  @item invmat(@var{mat})
Line 486  in a rational expression.
Line 579  in a rational expression.
 @itemize @bullet  @itemize @bullet
 \BJP  \BJP
 @item  @item
 @code{det} $B$O9TNs(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]}  @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.  $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
Line 494  in a rational expression.
Line 587  in a rational expression.
 @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
 @code{det} computes the 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} computes the inverse matrix of matrix @var{mat}.
 @code{invmat} returns a list @code{[num,den]}, where @code{num}  @code{invmat} returns a list @code{[num,den]}, where @code{num}
 is a matrix and @code{num/den} represents the inverse matrix.  is a matrix and @code{num/den} represents the inverse matrix.
Line 507  The computation is done over GF(@var{mod}) if @var{mod
Line 605  The computation is done over GF(@var{mod}) if @var{mod
 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 547  is more efficient than the fraction free Gaussian algo
Line 650  is more efficient than the fraction free Gaussian algo
 @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{newmat matrix}.
 @end table  @end table
   
 \JP @node qsort,,, $BG[Ns(B  \JP @node qsort,,, $BG[Ns(B
Line 616  are exchanged.
Line 719  are exchanged.
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
 @fref{ord}, @fref{vars}.  @fref{ord}, @fref{vars}.
   @end table
   
   \JP @node rowx rowm rowa colx colm cola,,, $BG[Ns(B
   \EG @node rowx rowm rowa colx colm cola,,, Arrays
   @subsection @code{rowx}, @code{rowm}, @code{rowa}, @code{colx}, @code{colm}, @code{cola}
   @findex rowx
   @findex rowm
   @findex rowa
   @findex colx
   @findex colm
   @findex cola
   
   @table @t
   @item rowx(@var{matrix},@var{i},@var{j})
   \JP :: $BBh(B @var{i} $B9T$HBh(B @var{j} $B9T$r8r49$9$k(B.
   \EG :: Exchanges the @var{i}-th and @var{j}-th rows.
   @item rowm(@var{matrix},@var{i},@var{c})
   \JP :: $BBh(B @var{i} $B9T$r(B @var{c} $BG\$9$k(B.
   \EG :: Multiplies the @var{i}-th row by @var{c}.
   @item rowa(@var{matrix},@var{i},@var{c})
   \JP :: $BBh(B @var{i} $B9T$KBh(B @var{i} $B9T$N(B @var{c} $BG\$r2C$($k(B.
   \EG :: Appends @var{c} times the @var{j}-th row to the @var{j}-th row.
   @item colx(@var{matrix},@var{i},@var{j})
   \JP :: $BBh(B @var{i} $B9T$HBh(B @var{j} $B9T$r8r49$9$k(B.
   \EG :: Exchanges the @var{i}-th and @var{j}-th columns.
   @item colm(@var{matrix},@var{i},@var{c})
   \JP :: $BBh(B @var{i} $B9T$r(B @var{c} $BG\$9$k(B.
   \EG :: Multiplies the @var{i}-th column by @var{c}.
   @item cola(@var{matrix},@var{i},@var{c})
   \JP :: $BBh(B @var{i} $B9T$KBh(B @var{i} $B9T$N(B @var{c} $BG\$r2C$($k(B.
   \EG :: Appends @var{c} times the @var{j}-th column to the @var{j}-th column.
   @end table
   
   @table @var
   @item return
   \JP $B9TNs(B
   \EG matrix
   @item @var{i}, @var{j}
   \JP $B@0?t(B
   \EG integers
   @item @var{c}
   \JP $B78?t(B
   \EG coefficient
   @end table
   
   @itemize @bullet
   \BJP
   @item
   $B9TNs$N4pK\JQ7A$r9T$&$?$a$N4X?t$G$"$k(B.
   @item
   $B9TNs$,GK2u$5$l$k$3$H$KCm0U$9$k(B.
   \E
   \BEG
   @item
   These operations are destructive for the matrix.
   \E
   @end itemize
   
   @example
   [0] A=newmat(3,3,[[1,2,3],[4,5,6],[7,8,9]]);
   [ 1 2 3 ]
   [ 4 5 6 ]
   [ 7 8 9 ]
   [1] rowx(A,1,2)$
   [2] A;
   [ 1 2 3 ]
   [ 7 8 9 ]
   [ 4 5 6 ]
   [3] rowm(A,2,x);
   [ 1 2 3 ]
   [ 7 8 9 ]
   [ 4*x 5*x 6*x ]
   [4] rowa(A,0,1,z);
   [ 7*z+1 8*z+2 9*z+3 ]
   [ 7 8 9 ]
   [ 4*x 5*x 6*x ]
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{newmat matrix}
 @end table  @end table

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.13

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