=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/type.texi,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/asir-doc/parts/type.texi 1999/12/10 06:58:49 1.2 +++ OpenXM/src/asir-doc/parts/type.texi 1999/12/21 02:47:32 1.3 @@ -1,68 +1,143 @@ +@comment $OpenXM$ +\BJP @node $B7?(B,,, Top @chapter $B7?(B +\E +\BEG +@node Data types,,, Top +@chapter Data types +\E @menu +\BJP * Asir $B$G;HMQ2DG=$J7?(B:: * $B?t$N7?(B:: * $BITDj85$N7?(B:: +\E +\BEG +* Types in Asir:: +* Types of numbers:: +* Types of indeterminates:: +\E @end menu +\BJP @node Asir $B$G;HMQ2DG=$J7?(B,,, $B7?(B @section @b{Asir} $B$G;HMQ2DG=$J7?(B +\E +\BEG +@node Types in Asir,,, Data types +@section Types in @b{Asir} +\E @noindent +\BJP @b{Asir} $B$K$*$$$F$O(B, $B2DFI$J7A<0$GF~NO$5$l$?$5$^$6$^$JBP>]$O(B, $B%Q!<%6$K$h$j(B $BCf4V8@8l$KJQ49$5$l(B, $B%$%s%?%W%j%?$K$h$j(B @b{Risa} $B$N7W;;%(%s%8%s$r8F$S=P$7(B $B$J$,$iFbIt7A<0$KJQ49$5$l$k(B. $BJQ49$5$l$?BP>]$O(B, $B]$OB8:_$7$J$$(B. 0 $B$O(B, C $B$K$*$1$k(B 0 $B%]%$%s%?$K(B $B$h$jI=8=$5$l$F$$$k(B. $B$7$+$7(B, $BJX59>e(B @b{Asir} $B$N(B @code{type(0)} $B$O(B $BCM(B 0 $B$rJV$9(B. +\E +\BEG +As a matter of fact, no object exists that has 0 as its identification +number. The number 0 is implemented as a null (0) pointer of C language. +For convenience's sake, a 0 is returned for the input @code{type(0)}. +\E -@item 1 @b{$B?t(B} +\JP @item 1 @b{$B?t(B} +\EG @item 1 @b{number} @example 1 2/3 14.5 3+2*@@i @end example -$B?t$O(B, $B$5$i$K$$$/$D$+$N7?$KJ,$1$i$l$k(B. $B$3$l$K$D$$$F$O2<$G=R$Y$k(B. +\JP $B?t$O(B, $B$5$i$K$$$/$D$+$N7?$KJ,$1$i$l$k(B. $B$3$l$K$D$$$F$O2<$G=R$Y$k(B. +\EG Numbers have sub-types. @xref{Types of numbers}. -@item 2 @b{$BB?9`<0(B} ($B?t$G$J$$(B) +\JP @item 2 @b{$BB?9`<0(B} ($B?t$G$J$$(B) +\EG @item 2 @b{polynomial} (but not a number) @example x afo (2.3*x+y)^10 @end example +\BJP $BB?9`<0$O(B, $BA4$FE83+$5$l(B, $B$=$N;~E@$K$*$1$kJQ?t=g=x$K=>$C$F(B, $B:F5"E*$K(B 1 $BJQ?tB?9`<0$H$7$F9_QQ$N=g$K@0M}$5$l$k(B (@xref{$BJ,;6I=8=B?9`<0(B}). $B$3$N;~(B, $B$=$NB?9`<0$K8=$l$k=g=x:GBg$NJQ?t$r(B @b{$B$K(B, $BFI$_=P$7@lMQ$NG[Ns$H$_$J$7$F(B, @code{[@var{index}]} $B$rI,MW$J$@$1$D$1$k$3$H$K$h$j(B $BMWAG$Nl9g$,$"$k$H$$$&$3$H$G$"$k(B. +\E +\BEG +Notice that for lists, matrices and vectors, the index begins with +number 0. Also notice that referencing list elements is done by +following pointers from the first element. Therefore, it sometimes takes +much more time to perform referencing operations on a large list than +on a vectors or a matrices with the same size. +\E -@item 5 @b{$B%Y%/%H%k(B} +\JP @item 5 @b{$B%Y%/%H%k(B} +\EG @item 5 @b{vector} @example newvect(3) newvect(2,[a,1]) @end example +\BJP $B%Y%/%H%k$O(B, @code{newvect()} $B$GL@<(E*$K@8@.$9$kI,MW$,$"$k(B. $BA0]$rBeF~$G$-$k(B $B$N$G(B, $BB?]$rBeF~$G$-$k(B. $B9TNs$N3F(B $B9T$O(B, $B%Y%/%H%k$H$7$F$J$I$KMQ$$$i$l$k(B. $BJ8;zNs$KBP$7$F$O2C;;$N$_$,(B $BDj5A$5$l$F$$$F(B, $B7k2L$O(B 2 $B$D$NJ8;zNs$N7k9g$G$"$k(B. +\E +\BEG +Strings are used mainly for naming files. It is also used for giving +comments of the results. Operator symbol @code{+} denote the +concatenation operation of two strings. +\E @example [0] "afo"+"take"; afotake @end example -@item 8 @b{$B9=B$BN(B} +\JP @item 8 @b{$B9=B$BN(B} +\EG @item 8 @b{structure} @example newstruct(afo) @end example -$B9=B$BN$K4X$7$F$O(B, $B>O$r2~$a$F2r@b$9$kM=Dj$G$"$k(B. +\JP $B9=B$BN$K4X$7$F$O(B, $B>O$r2~$a$F2r@b$9$kM=Dj$G$"$k(B. +\EG For type @b{structure}, we shall describe it in a later chapter. +(Not written yet.) -@item 9 @b{$BJ,;6I=8=B?9`<0(B} +\JP @item 9 @b{$BJ,;6I=8=B?9`<0(B} +\EG @item 9 @b{distributed polynomial} @example 2*<<0,1,2,3>>-3*<<1,2,3,4>> @end example +\BJP $B$3$l$O(B, $B$[$H$s$I%0%l%V%J4pDl@lMQ$N7?$G(B, $BDL>o$N7W;;$G$3$N7?$,I,MW$H(B $B$J$k$3$H$O$^$:$J$$$,(B, $B%0%l%V%J4pDl7W;;%Q%C%1!<%8<+BN$,%f!<%68@8l(B $B$G=q$+$l$F$$$k$?$a(B, $B%f!<%6$,A`:n$G$-$k$h$&FHN)$7$?7?$H$7$F(B @b{Asir} $B$G;HMQ$G$-$k$h$&$K$7$F$"$k(B. $B$3$l$K$D$$$F$O(B @xref{$B%0%l%V%J4pDl$N7W;;(B}. +\E +\BEG +This is the short for `Distributed representation of polynomials.' +This type is specially devised for computation of Groebner bases. +Though for ordinary users this type may never be needed, it is provided +as a distinguished type that user can operate by @code{Asir}. +This is because the Groebner basis package provided with +@code{Risa/Asir} is written in the @code{Asir} user language. +For details @xref{Groebner basis computation}. +\E -@item 10 @b{$BId9f$J$7%^%7%s(B 32bit $B@0?t(B} +\JP @item 10 @b{$BId9f$J$7%^%7%s(B 32bit $B@0?t(B} +\EG @item 10 @b{32bit unsigned integer} -@item 11 @b{$B%(%i!<%*%V%8%'%/%H(B} +\JP @item 11 @b{$B%(%i!<%*%V%8%'%/%H(B} +\EG @item 11 @b{error object} -$B0J>eFs$D$O(B, Open XM $B$K$*$$$FMQ$$$i$l$kFCeFs$D$O(B, Open XM $B$K$*$$$FMQ$$$i$l$kFCe$N9TNs(B} +\JP @item 12 @b{GF(2) $B>e$N9TNs(B} +\EG @item 12 @b{matrix over GF(2)} +\BJP $B8=:_(B, $BI8?t(B 2 $B$NM-8BBN$K$*$1$k4pDlJQ49$N$?$a$N%*%V%8%'%/%H$H$7$FMQ$$$i$l(B $B$k(B. +\E +\BEG +This is used for basis conversion in finite fields of characteristic 2. +\E -@item 13 @b{MATHCAP $B%*%V%8%'%/%H(B} +\JP @item 13 @b{MATHCAP $B%*%V%8%'%/%H(B} +\EG @item 13 @b{MATHCAP object} -Open XM $B$K$*$$$F(B, $Bo$K(B $B4{LsJ,?t$GI=8=$5$l$k(B. +\E +\BEG +Rational numbers are implemented by arbitrary precision integers +(@b{bignum}). A rational number is always expressed by a fraction of +lowest terms. +\E @item 1 -@b{$BG\@:EYIbF0>.?t(B} +\JP @b{$BG\@:EYIbF0>.?t(B} +\EG @b{double precision floating point number (double float)} +\BJP $B%^%7%s$NDs6!$9$kG\@:EYIbF0>.?t$G$"$k(B. @b{Asir} $B$N5/F0;~$K$O(B, $BDL>o$N7A<0$GF~NO$5$l$?IbF0>.?t$O$3$N7?$KJQ49$5$l$k(B. $B$?$@$7(B, @code{ctrl()} $B$K$h$j(B @b{bigfloat} $B$,A*Br$5$l$F$$$k>l9g$K$O(B @b{bigfloat} $B$KJQ49$5$l$k(B. +\E +\BEG +The numbers of this type are numbers provided by the computer hardware. +By default, when @b{Asir} is started, floating point numbers in a +ordinary form are transformed into numbers of this type. However, +they will be transformed into @b{bigfloat} numbers +when the switch @b{bigfloat} is turned on (enabled) by @code{ctrl()} +command. +\E @example [0] 1.2; @@ -210,23 +410,44 @@ quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0( 1.20000000000000000513 E-1000 @end example +\BJP $BG\@:EYIbF0>.?t$HM-M}?t$N1i;;$O(B, $BM-M}?t$,IbF0>.?t$KJQ49$5$l$F(B, $BIbF0>.?t$H$7$F1i;;$5$l$k(B. +\E +\BEG +A rational number shall be converted automatically into a double float +number before the operation with another double float number and the +result shall be computed as a double float number. +\E @item 2 -@b{$BBe?tE*?t(B} +\JP @b{$BBe?tE*?t(B} +\EG @b{algebraic number} -@xref{$BBe?tE*?t$K4X$9$k1i;;(B}. +\JP @xref{$BBe?tE*?t$K4X$9$k1i;;(B}. +\EG @xref{Algebraic numbers}. @item 3 @b{bigfloat} +\BJP @b{bigfloat} $B$O(B, @b{Asir} $B$G$O(B @b{PARI} $B%i%$%V%i%j$K$h$j(B $B?tIt(B $B$N$_G$0UB?G\D9$G(B, $B;X?tIt$O(B 1 $B%o!<%I0JFb$N@0?t$K8B$i$l$F$$$k(B. @code{ctrl()} $B$G(B @b{bigfloat} $B$rA*Br$9$k$3$H$K$h$j(B, $B0J8e$NIbF0>.?t(B $B$NF~NO$O(B @b{bigfloat} $B$H$7$F07$o$l$k(B. $B@:EY$O%G%U%)%k%H$G$O(B 10 $B?J(B 9 $B7eDxEY$G$"$k$,(B, @code{setprec()} $B$K$h$j;XDj2DG=$G$"$k(B. +\E +\BEG +The @b{bigfloat} numbers of @b{Asir} is realized by @b{PARI} library. +A @b{bigfloat} number of @b{PARI} has an arbitrary precision mantissa +part. However, its exponent part admits only an integer with a single +word precision. +Floating point operations will be performed all in @b{bigfloat} after +activating the @b{bigfloat} switch by @code{ctrl()} command. +The default precision is about 9 digits, which can be specified by +@code{setprec()} command. +\E @example [0] ctrl("bigfloat",1); @@ -239,95 +460,214 @@ quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0( 1.41421356237309504880168872420969807856967187537694807317654396116148 @end example +\BJP @code{eval()} $B$O(B, $B0z?t$K4^$^$l$kH!?tCM$r2DG=$J8B$j?tCM2=$9$kH!?t$G$"$k(B. @code{setprec()} $B$G;XDj$5$l$?7e?t$O(B, $B7k2L$N@:EY$rJ]>Z$9$k$b$N$G$O$J$/(B, @b{PARI} $BFbIt$GMQ$$$i$l$kI=8=$N%5%$%:$r<($9$3$H$KCm0U$9$Y$-$G$"$k(B. +\E +\BEG +Function @code{eval()} evaluates numerically its argument as far as +possible. +Notice that the integer given for the argument of @code{setprec()} does +not guarantee the accuracy of the result, +but it indicates the representation size of numbers with which internal +operations of @b{PARI} are performed. +\E (@ref{eval}, @xref{pari}) @item 4 -@b{$BJ#AG?t(B} +\JP @b{$BJ#AG?t(B} +\EG @b{complex number} +\BJP $BJ#AG?t$O(B, $BM-M}?t(B, $BG\@:EYIbF0>.?t(B, @b{bigfloat} $B$r$l(B @code{real()}, @code{imag()} $B$G.I8?t$NM-8BAGBN$N85(B} +\JP @b{$B>.I8?t$NM-8BAGBN$N85(B} +\EG @b{element of a small finite prime field} +\BJP $B$3$3$G8@$&>.I8?t$H$O(B, $BI8?t$,(B 2^27 $BL$K~$N$b$N$N$3$H$G$"$k(B. $B$3$N$h$&$JM-8B(B $BBN$O(B, $B8=:_$N$H$3$m%0%l%V%J4pDl7W;;$K$*$$$FFbItE*$KMQ$$$i$l(B, $BM-8BBN78?t$N(B $BJ,;6I=8=B?9`<0$N78?t$rpJs$O;}$?$:(B, @code{setmod()} $B$G@_Dj$5$l$F$$$kAG?t(B @var{p} $B$rMQ$$$F(B GF(@var{p}) $B>e$G$N1i;;$,E,MQ$5$l$k(B. +\E +\BEG +Here a small finite fieid means that its characteristic is less than +2^27. +At present small finite fields are used mainly +for groebner basis computation, and elements in such finite fields +can be extracted by taking coefficients of distributed polynomials +whose coefficients are in finite fields. Such an element itself does not +have any information about the field to which the element belongs, and +field operations are executed by using a prime @var{p} which is set by +@code{setmod()}. +\E @item 6 -@b{$BBgI8?t$NM-8BAGBN$N85(B} +\JP @b{$BBgI8?t$NM-8BAGBN$N85(B} +\EG @b{element of large finite prime field} +\BJP $BI8?t$H$7$FG$0U$NAG?t$,$H$l$k(B. $B$3$N7?$N?t$O(B, $B@0?t$KBP$7(B@code{simp_ff} $B$rE,MQ$9$k$3$H$K$h$jF@$i$l$k(B. +\E +\BEG +This type expresses an element of a finite prime field whose characteristic +is an arbitrary prime. An object of this type is obtained by applying +@code{simp_ff} to an integer. +\E - @item 7 -@b{$BI8?t(B 2 $B$NM-8BBN$N85(B} +\JP @b{$BI8?t(B 2 $B$NM-8BBN$N85(B} +\EG @b{element of a finite field of characteristic 2} +\BJP $BI8?t(B 2 $B$NG$0U$NM-8BBN$N85$rI=8=$9$k(B. $BI8?t(B 2 $B$NM-8BBN(B F $B$O(B, $B3HBge4{Ls$J(B n $Be$O(B, F $B$N85$O(B, +$B$b4^$a$F<+A3$J;EJ}$G%S%C%HNs$H$_$J$5$l$k$?$a(B, $B7A<0>e$O(B, F $B$N85(B g mod f $B$O(B, g, f $B$r$"$i$o$9(B 2 $B$D$N%S%C%HNs$GI=8=$9$k$3$H$,$G$-$k(B. +\E +\BEG +This type expresses an element of a finite field of characteristic 2. +Let @var{F} be a finite field of characteristic 2. If @var{[F:GF(2)]} +is equal to @var{n}, then @var{F} is expressed as @var{F=GF(2)[t]/(f(t))}, +where @var{f(t)} is an irreducible polynomial over @var{GF(2)} +of degree @var{n}. +As an element @var{g} of @var{GF(2)[t]} can be expressed by a bit string, +An element @var{g mod f} in @var{F} can be expressed by two bit strings +representing @var{g} and @var{f} respectively. +\E -F $B$N85$rF~NO$9$k$$$/$D$+$NJ}K!$,MQ0U$5$l$F$$$k(B. +\JP F $B$N85$rF~NO$9$k$$$/$D$+$NJ}K!$,MQ0U$5$l$F$$$k(B. +\EG Several methods to input an element of @var{F} are provided. @itemize @bullet @item @code{@@} +\BJP @code{@@} $B$O$=$N8e$m$K?t;z(B, $BJ8;z$rH<$C$F(B, $B%R%9%H%j$dFCl9g$K$O(B, F=GF(2)[t]/(f(t)) $B$K$*$1$k(B t mod f $B$r$"$i$o$9(B. $B$h$C$F(B, @@ $B$NB?9`<0$H$7$F(B F $B$N85$rF~NO$G$-$k(B. (@@^10+@@+1 $B$J$I(B) +\E +\BEG +@code{@@} represents @var{t mod f} in @var{F=GF(2)[t](f(t))}. +By using @code{@@} one can input an element of @var{F}. For example +@code{@@^10+@@+1} represents an element of @var{F}. +\E @item @code{ptogf2n} -$BG$0UJQ?t$N(B 1 $BJQ?tB?9`<0$r(B, @code{ptogf2n} $B$K$h$jBP1~$9$k(B F $B$N85$KJQ49$9$k(B. +\JP $BG$0UJQ?t$N(B 1 $BJQ?tB?9`<0$r(B, @code{ptogf2n} $B$K$h$jBP1~$9$k(B F $B$N85$KJQ49$9$k(B. +\BEG +@code{ptogf2n} converts a univariate polynomial into an element of @var{F}. +\E @item @code{ntogf2n} +\BJP $BG$0U$N<+A3?t$r(B, $B<+A3$J;EJ}$G(B F $B$N85$H$_$J$9(B. $B<+A3?t$H$7$F$O(B, 10 $B?J(B, 16 $B?J(B (0x $B$G;O$^$k(B), 2 $B?J(B (0b $B$G;O$^$k(B) $B$GF~NO$,2DG=$G$"$k(B. +\E +\BEG +As a bit string, a non-negative integer can be regarded as an element +of @var{F}. Note that one can input a non-negative integer in decimal, +hexadecimal (@code{0x} prefix) and binary (@code{0b} prefix) formats. +\E @item -@code{$B$=$NB>(B} +\JP @code{$B$=$NB>(B} +\EG @code{micellaneous} +\BJP $BB?9`<0$N78?t$r4]$4$H(B F $B$N85$KJQ49$9$k$h$&$J>l9g(B, @code{simp_ff} $B$K$h$jJQ49$G$-$k(B. +\E +\BEG +@code{simp_ff} is available if one wants to convert the whole +coefficients of a polynomial. +\E @end itemize @end table +\BJP $BBgI8?tAGBN$NI8?t(B, $BI8?t(B 2 $B$NM-8BBN$NDj5AB?9`<0$O(B, @code{setmod_ff} $B$G@_Dj$9$k(B. $BM-8BBN$N85$I$&$7$N1i;;$G$O(B, @code{setmod_ff} $B$K$h$j@_Dj$5$l$F$$$k(B modulus $B$G(B, $BB0$9$kBN$,J,$+$j(B, $B$=$NCf$G1i;;$,9T$o$l$k(B. $B0lJ}$,M-M}?t$N>l9g$K$O(B, $B$=$NM-M}?t$O<+F0E*$K8=:_@_Dj$5$l$F$$$k(B $BM-8BBN$N85$KJQ49$5$l(B, $B1i;;$,9T$o$l$k(B. +\E +\BEG +The characteristic of a large finite prime field and the defining +polynomial of a finite field of characteristic 2 are set by @code{setmod_ff}. +Elements of finite fields do not have informations about the modulus. +Upon an arithmetic operation, the modulus set by @code{setmod_ff} is +used. If one of the operands is a rational number, it is automatically +converted into an element of the finite field currently set and +the operation is done in the finite field. +\E +\BJP @node $BITDj85$N7?(B,,, $B7?(B @section $BITDj85$N7?(B +\E +\BEG +@node Types of indeterminates,,, Data types +@section Types of indeterminates +\E @noindent +\BJP $BB?9`<0$NJQ?t$H$J$jF@$kBP>]$r(B@b{$BITDj85(B}$B$H$h$V(B. @b{Asir} $B$G$O(B, $B1Q>.J8;z$G;O$^$j(B, $BG$0U8D$N%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B $B$rITDj85$H$7$F07$&$,(B, $B$=$NB>$K$b%7%9%F%`$K$h$jITDj85$H$7$F07$o$l$k$b$N(B $B$,$$$/$D$+$"$k(B. @b{Asir} $B$NFbIt7A<0$H$7$F$O(B, $B$3$l$i$OA4$FB?9`<0$H$7$F$N(B $B7?$r;}$D$,(B, $B?t$HF1MM(B, $BITDj85$N7?$K$h$j6hJL$5$l$k(B. +\E +\BEG +An algebraic object is recognized as an indeterminate when it can be +a (so-called) variable in polynomials. +An ordinary indeterminate is usually denoted by a string that start with +a small alphabetical letter followed by an arbitrary number of +alphabetical letters, digits or @samp{_}. +In addition to such ordinary indeterminates, +there are other kinds of indeterminates in a wider sense in @b{Asir}. +Such indeterminates in the wider sense have type @b{polynomial}, +and further are classified into sub-types of the type @b{indeterminate}. +\E @table @code @item 0 -@b{$B0lHLITDj85(B} +\JP @b{$B0lHLITDj85(B} +\EG @b{ordinary indeterminate} -$B1Q>.J8;z$G;O$^$kJ8;zNs(B. $BB?9`<0$NJQ?t$H$7$F:G$bIaDL$KMQ$$$i$l$k(B. +\JP $B1Q>.J8;z$G;O$^$kJ8;zNs(B. $BB?9`<0$NJQ?t$H$7$F:G$bIaDL$KMQ$$$i$l$k(B. +\BEG +An object of this sub-type is denoted by a string that start with +a small alphabetical letter followed by an arbitrary number of +alphabetical letters, digits or @samp{_}. +This kind of indeterminates are most commonly used for variables of +polynomials. +\E @example [0] [vtype(a),vtype(aA_12)]; @@ -335,12 +675,24 @@ modulus $B$G(B, $BB0$9$kBN$,J,$+$j(B, $B$=$NCf$G1 @end example @item 1 -@b{$BL$Dj78?t(B} +\JP @b{$BL$Dj78?t(B} +\EG @b{undetermined coefficient} +\BJP @code{uc()} $B$O(B, @samp{_} $B$G;O$^$kJ8;zNs$rL>A0$H$9$kITDj85$r@8@.$9$k(B. $B$3$l$i$O(B, $B%f!<%6$,F~NO$G$-$J$$$H$$$&$@$1$G(B, $B0lHLITDj85$HJQ$o$i$J$$$,(B, $B%f!<%6$,F~NO$7$?ITDj85$H>WFM$7$J$$$H$$$&@-2A$5$l$F2?$i$+$N(B @b{Asir} $B$N(B $BFbIt7A<0$KJQ49$5$l$k$,(B, @code{sin(x)}, @code{cos(x+1)} $B$J$I$O(B, $BI>2A8e(B $B$b$=$N$^$^$N7A$GB8:_$9$k(B. $B$3$l$OH!?t7A<0$H8F$P$l(B, $B$=$l<+?H$,(B 1 $B$D$N(B $BITDj85$H$7$F07$o$l$k(B. $B$^$?$d$dFC