version 1.5, 2000/01/24 07:36:35 |
version 1.16, 2020/03/14 01:21:56 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/cmo-basic1.tex,v 1.4 2000/01/24 02:48:24 noro Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/cmo-basic1.tex,v 1.15 2016/08/22 05:38:27 takayama Exp $ |
//&jp \section{ 数, 多項式 の CMO 表現 } |
//&jp \section{ , 紊綣 CMO 茵 } |
//&eg \section{ CMOexpressions for numbers and polynomials } |
//&eg \section{ CMOexpressions for numbers and polynomials } |
\label{sec:basic1} |
\label{sec:basic1} |
/*&C |
/*&C |
|
|
#define CMO_RING_BY_NAME 26 |
#define CMO_RING_BY_NAME 26 |
#define CMO_DISTRIBUTED_POLYNOMIAL 31 |
#define CMO_DISTRIBUTED_POLYNOMIAL 31 |
#define CMO_RATIONAL 34 |
#define CMO_RATIONAL 34 |
|
#define CMO_COMPLEX 35 |
|
|
|
#define CMO_BIGFLOAT32 52 |
|
|
#define CMO_INDETERMINATE 60 |
#define CMO_INDETERMINATE 60 |
#define CMO_TREE 61 |
#define CMO_TREE 61 |
|
|
*/ |
*/ |
|
|
/*&jp |
/*&jp |
以下, グループ CMObject/Basic, CMObject/Tree |
篁ヤ, 違若 CMObject/Basic, CMObject/Tree |
および CMObject/DistributedPolynomial |
CMObject/DistributedPolynomial |
に属する CMObject の形式を説明する. |
絮 CMObject 綵√茯. |
|
|
\noindent |
\noindent |
{\tt OpenXM/src/ox\_toolkit} にある {\tt bconv} をもちいると |
{\tt OpenXM/src/ox\_toolkit} {\tt bconv} < |
CMO expression を binary format に変換できるので, |
CMO expression binary format 紊с, |
これを参考にするといい. |
. |
*/ |
*/ |
/*&eg |
/*&eg |
In the sequel, we will explain on the groups |
In the sequel, we will explain on the groups |
|
|
\bigbreak |
\bigbreak |
\noindent |
\noindent |
Group CMObject/Basic requires CMObject/Primitive. \\ |
Group CMObject/Basic requires CMObject/Primitive. \\ |
ZZ, QQ, Zero, Rational, Indeterminate,$\in$ CMObject/Basic. \\ |
ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/Basic. \\ |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{Zero} &:& ({\tt CMO\_ZERO}) \\ |
\mbox{Zero} &:& ({\tt CMO\_ZERO}) \\ |
& & \mbox{ --- ユニバーサルな ゼロを表す. } \\ |
& & \mbox{ --- 若泣 若茵. } \\ |
\mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots |
\mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots , |
{\sl byte}\, \mbox{a[m]} ) \\ |
{\sl byte}\, \mbox{a[$|$f$|$]} ) \\ |
&:& \mbox{ --- bignum をあらわす. a[i] についてはあとで説明}\\ |
&:& \mbox{ --- bignum . a[i] ゃц}\\ |
\mbox{QQ} &:& ({\tt CMO\_QQ}, {\sl ZZ}\, {\rm a}, {\sl ZZ}\, {\rm b}) \\ |
\mbox{QQ} &:& ({\tt CMO\_QQ}, |
& & \mbox{ --- 有理数 $a/b$ を表す. } \\ |
{\sl int32}\, {\rm m}, {\sl byte}\, \mbox{a[1]}, \ldots, {\sl byte}\, \mbox{a[$|$m$|$]}, |
|
{\sl int32}\, {\rm n}, {\sl byte}\, \mbox{b[1]}, \ldots, {\sl byte}\, \mbox{b[$|$n$|$]})\\ |
|
& & \mbox{ --- $a/b$ 茵. } \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
& & \mbox{ --- $a/b$ を表す. } \\ |
& & \mbox{ --- $a/b$ 茵. } \\ |
|
\mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32}, |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\ |
|
&:& \mbox{ --- bigfloat . a[i], k ゃц}\\ |
|
\mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\ |
|
& & \mbox{ --- $a+b\sqrt{-1}$ 茵. } \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
& & \mbox{ --- 変数名 $v$ . } \\ |
& & \mbox{ --- 紊医 $v$ . } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
|
|
|
|
/*&eg |
/*&eg |
|
|
\bigbreak |
\bigbreak |
\noindent |
\noindent |
Group CMObject/Basic requires CMObject/Primitive. \\ |
Group CMObject/Basic requires CMObject/Primitive. \\ |
ZZ, QQ, Zero, Rational, Indeterminate,$\in$ CMObject/Basic. \\ |
ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/Basic. \\ |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{Zero} &:& ({\tt CMO\_ZERO}) \\ |
\mbox{Zero} &:& ({\tt CMO\_ZERO}) \\ |
& & \mbox{ --- Universal zero } \\ |
& & \mbox{ --- Universal zero } \\ |
\mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots |
\mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots , |
{\sl byte}\, \mbox{a[m]} ) \\ |
{\sl byte}\, \mbox{a[$|$m$|$]} ) \\ |
&:& \mbox{ --- bignum. The meaning of a[i] will be explained later.}\\ |
&:& \mbox{ --- bignum. The meaning of a[i] will be explained later.}\\ |
\mbox{QQ} &:& ({\tt CMO\_QQ}, {\sl ZZ}\, {\rm a}, {\sl ZZ}\, {\rm b}) \\ |
\mbox{QQ} &:& ({\tt CMO\_QQ}, |
|
{\sl int32}\, {\rm m}, {\sl byte}\, \mbox{a[1]}, \ldots, {\sl byte}\, \mbox{a[$|$m$|$]}, |
|
{\sl int32}\, {\rm n}, {\sl byte}\, \mbox{b[1]}, \ldots, {\sl byte}\, \mbox{b[$|$n$|$]})\\ |
& & \mbox{ --- Rational number $a/b$. } \\ |
& & \mbox{ --- Rational number $a/b$. } \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
& & \mbox{ --- Rational expression $a/b$. } \\ |
& & \mbox{ --- Rational expression $a/b$. } \\ |
|
\mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32}, |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\ |
|
&:& \mbox{ --- bigfloat. The meaning of a[i], k will be explained later.}\\ |
|
\mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\ |
|
& & \mbox{ --- Complex number $a+b\sqrt{-1}$. } \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
& & \mbox{ --- Variable name $v$ . } \\ |
& & \mbox{ --- Variable name $v$ . } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
Line 97 ZZ, QQ, Zero, Rational, Indeterminate,$\in$ CMObject/B |
|
Line 117 ZZ, QQ, Zero, Rational, Indeterminate,$\in$ CMObject/B |
|
/*&C |
/*&C |
|
|
*/ |
*/ |
|
/*&C |
|
|
|
*/ |
|
|
/*&jp |
/*&jp |
Indeterminate は変数名をあらわす. |
Indeterminate 紊医. |
v はバイト列であればなにを用いてもよいが, |
v ゃс違, |
システム毎に変数名として用いられるバイト列は制限がある. |
激鴻罸紊医ゃ狗. |
各システム xxx は任意の文字列を各システム固有の変数名へ1対1に変換できるように |
激鴻 xxx 篁紙絖激鴻堺紊医1絲1紊с |
実装しないといけない. |
絎茖. |
(これを |
( |
{\tt Dx} は {\tt \#dx} と変換するなどの |
{\tt Dx} {\tt \#dx} 紊 |
escape sequence を用いて実現するのは, 無理があるようである. |
escape sequence 絎憗, ∞с. |
テーブルを作成する必要があるであろう.) |
若篏綽荀с.) |
*/ |
*/ |
/*&eg |
/*&eg |
Indeterminate is a name of a variable. |
The name of a variable should be expressed by using Indeterminate. |
v may be any sequence of bytes, but each system has its own |
v may be any sequence of bytes, but each system has its own |
restrictions on the names of variables. |
restrictions on the names of variables. |
Indeterminates of CMO and internal variable names must be translated |
Indeterminates of CMO and internal variable names must be translated |
in one to one correspondence. |
in one-to-one correspondence. |
*/ |
*/ |
|
|
|
|
/*&jp |
/*&jp |
|
\subsection{Indeterminate Tree} |
|
|
\noindent |
\noindent |
Group CMObject/Tree requires CMObject/Basic. \\ |
Group CMObject/Tree requires CMObject/Basic. \\ |
Tree, Lambda $\in$ CMObject/Basic. \\ |
Tree, Lambda $\in$ CMObject/Tree. \\ |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name}, |
\mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name}, |
{\sl Cstring}\, {\rm cdname}, {\sl List}\, {\rm leaves}) \\ |
{\sl List}\, {\rm attributes}, {\sl List}\, {\rm leaves}) \\ |
& & \mbox{ --- 名前 name の定数または関数. 関数の評価はおこなわない. } \\ |
& & \mbox{ --- name 絎違障∽. ∽違荅箴<. } \\ |
& & \mbox{ --- cdname は空文字列でなければ name の意味が説明されている }\\ |
& & \mbox{ --- attributes 腥冴鴻с name 絮с篆. }\\ |
& & \mbox{ --- OpenMath CD (content dictionary) の名前. } \\ |
& & \mbox{ --- 絮с鴻, key ゃ≪с. }\\ |
\mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args}, |
\mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args}, |
{\sl Tree} {\rm body}) \\ |
{\sl Tree} {\rm body}) \\ |
& & \mbox{ --- body を args を引数とする関数とする. } \\ |
& & \mbox{ --- body args 綣違∽違. } \\ |
& & \mbox{ --- optional な引数が必要なときは, leaves の後へつづける.} \\ |
|
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&eg |
/*&eg |
|
\subsection{Indeterminate and Tree} |
|
|
\noindent |
\noindent |
Group CMObject/Tree requires CMObject/Basic. \\ |
Group CMObject/Tree requires CMObject/Basic. \\ |
Tree, Lambda $\in$ CMObject/Basic. \\ |
Tree, Lambda $\in$ CMObject/Tree. \\ |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name}, |
\mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name}, |
{\sl Cstring}\, {\rm cdname}, {\sl List}\, {\rm leaves}) \\ |
{\sl List}\, {\rm attributes}, {\sl List}\, {\rm leaves}) \\ |
& & \mbox{ --- A function or a constant of name. Functions are not evaluated. } \\ |
& & \mbox{ --- ``name'' is the name of the node of the tree. } \\ |
& & \mbox{ --- cdname may be a null. If it is not null, it is the name of}\\ |
& & \mbox{ --- Attributes may be a null list. If it is not null, it is a list of}\\ |
& & \mbox{ --- the OpenMath CD (content dictionary). } \\ |
& & \mbox{ --- key and value pairs. } \\ |
\mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args}, |
\mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args}, |
{\sl Tree} {\rm body}) \\ |
{\sl Tree} {\rm body}) \\ |
& & \mbox{ --- a function with the arguments body. } \\ |
& & \mbox{ --- a function with the arguments body. } \\ |
& & \mbox{ --- optional arguments come after leaves.} \\ |
|
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
|
|
/*&jp |
/*&jp |
数式を処理するシステムでは, Tree 構造が一般にもちいられる. |
医激鴻с, Tree 罕筝<. |
たとえば, $\sin(x+e)$ は, |
, $\sin(x+e)$ , |
{\tt (sin, (plus, x, e))} |
{\tt (sin, (plus, x, e))} |
なる Tree であらわすのが一般的である. |
Tree с筝с. |
Tree の表現を スタックマシンのレベルでおこなうとすると, |
Tree 茵憗 鴻帥激潟с, |
{\tt ox\_BEGIN\_BLOCK}, {\tt ox\_END\_BLOCK} で評価を抑制するのが |
{\tt ox\_BEGIN\_BLOCK}, {\tt ox\_END\_BLOCK} ц箴<吟 |
一つの方法である (cf. Postscript の {\tt \{ }, {\tt \} }). |
筝ゃ号с (cf. Postscript {\tt \{ }, {\tt \} }). |
たとえば上の方法では |
遺号с |
{\tt x, e, plus, sin } を begin block, end block でかこめばよろしい. |
{\tt x, e, plus, sin } begin block, end block с違. |
われわれはスタックマシンの実装をなるべく簡単にするという立場をとりたい, |
鴻帥激潟絎茖鴻靎≦腴眼, |
また数学オブジェクトを OX スタックマシンと CMObject を混在して表現したく |
障医吾с OX 鴻帥激潟 CMObject 羞桁茵憗 |
ない. |
. |
したがって, |
c, |
Tree 構造は Open Math 風の表現をもちいた CMO を導入することにした. |
Tree 罕 Open Math 蘂茵憗< CMO 絨ャ. |
またこのほうが, われわれの想定するシステム xxx において, Open XM 対応が |
障祉, 喝激鴻 xxx , Open XM 絲上 |
はるかに容易である. |
絎号с. |
なお, Tree は, Open Math では, Symbol, Application のメカニズムに相当する. |
, Tree , Open Math с, Symbol, Application <冴後. |
*/ |
*/ |
/*&eg |
/*&eg |
In many computer algebra systems, mathematical expressions are usually |
In many computer algebra systems, mathematical expressions are usually |
Line 185 stack machine commands for delayed evaluation. |
|
Line 209 stack machine commands for delayed evaluation. |
|
However it makes the implementation of stack machines complicated. |
However it makes the implementation of stack machines complicated. |
It is desirable that CMObject is independent of OX stack machine. |
It is desirable that CMObject is independent of OX stack machine. |
Therefore we introduce an OpenMath like tree representation for CMO |
Therefore we introduce an OpenMath like tree representation for CMO |
tree object. |
Tree object. |
This method allows us to implement tree structure easily |
This method allows us to implement tree structure easily |
on individual OpenXM systems. |
on individual OpenXM systems. |
Note that CMO Tree corresponds to Symbol and Application in OpenMath. |
Note that CMO Tree corresponds to Symbol and Application in OpenMath. |
Line 196 Note that CMO Tree corresponds to Symbol and Applicati |
|
Line 220 Note that CMO Tree corresponds to Symbol and Applicati |
|
|
|
*/ |
*/ |
/*&jp |
/*&jp |
Lambda は関数を定義するための関数である. |
Lambda ∽違絎臂∽違с. |
Lisp の Lambda 表現と同じ. |
Lisp Lambda 茵憗. |
*/ |
*/ |
/*&eg |
/*&eg |
Lambda is used to define functions. |
Lambda is used to define functions. |
It is the same as the Lambda expression in Lisp. |
The notion ``lambda'' is borrowed from the language Lisp. |
*/ |
*/ |
|
|
\noindent |
\noindent |
//&jp 例: $sin(x+e)$ の表現. |
//&jp 箴: $sin(x+e)$ 茵. |
//&eg Example: the expression of $sin(x+e)$. |
//&eg Example: the expression of $sin(x+e)$. |
\begin{verbatim} |
\begin{verbatim} |
(CMO_TREE, (CMO_STRING, "sin"), (CMO_STRING, "basic"), |
(CMO_TREE, (CMO_STRING, "sin"), |
|
(CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"), |
|
(CMO_STRING,"basic"))) |
(CMO_LIST,[size=]1, |
(CMO_LIST,[size=]1, |
(CMO_TREE, (CMO_STRING, "plus"), (CMO_STRING, "basic"), |
(CMO_TREE, (CMO_STRING, "plus"), (CMO_STRING, "basic"), |
(CMO_LIST,[size=]2, (CMO_INDETERMINATE,"x"), |
(CMO_LIST,[size=]2, (CMO_INDETERMINATE,"x"), |
//&jp (CMO_TREE,(CMO_STRING, "e"), 自然対数の底 |
//&jp (CMO_TREE,(CMO_STRING, "e"), 九丈違綺 |
//&eg (CMO_TREE,(CMO_STRING, "e"), Napier's number |
//&eg (CMO_TREE,(CMO_STRING, "e"), the base of natural logarithms |
(CMO_STRING, "basic")) |
(CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"), |
|
(CMO_STRING,"basic"))) |
)) |
)) |
) |
) |
) |
) |
\end{verbatim} |
\end{verbatim} |
|
//&jp Leave , 紊綣篁紙吾с. |
|
//&eg Elements of the leave may be any objects including polynomials. |
|
|
\noindent |
\noindent |
Example: |
Example: |
\begin{verbatim} |
\begin{verbatim} |
sm1> [(plus) (Basic) [(123).. (345)..]] [(class) (tree)] dc :: |
sm1> [(plus) [[(cdname) (basic)]] [(123).. (345)..]] [(class) (tree)] dc :: |
Class.tree [ $plus$ , $Basic$ , [ 123 , 345 ] ] |
Class.tree [$plus$ , [[$cdname$ , $basic$ ]], [ 123 , 345 ] ] |
\end{verbatim} |
\end{verbatim} |
|
|
|
\noindent |
|
Example: |
|
\begin{verbatim} |
|
asir |
|
[753] taka_cmo100_xml_form(quote(sin(x+1))); |
|
<cmo_tree> <cmo_string>"sin"</cmo_string> |
|
<cmo_list><cmo_int32 for="length">1</cmo_int32> |
|
<cmo_list><cmo_int32 for="length">2</cmo_int32> |
|
<cmo_string>"cdname"</cmo_string> |
|
<cmo_string>"basic"</cmo_string> |
|
</cmo_list> </cmo_list> |
|
<cmo_tree> <cmo_string>"plus"</cmo_string> |
|
<cmo_list><cmo_int32 for="length">1</cmo_int32> |
|
<cmo_list><cmo_int32 for="length">2</cmo_int32> |
|
<cmo_string>"cdname"</cmo_string> |
|
<cmo_string>"basic"</cmo_string> |
|
</cmo_list> </cmo_list> |
|
<cmo_indeterminate> <cmo_string>"x"</cmo_string> </cmo_indeterminate> |
|
<cmo_zz>1</cmo_zz> |
|
</cmo_tree></cmo_tree> |
|
\end{verbatim} |
|
|
|
|
\bigbreak |
\bigbreak |
//&jp 次に, 分散表現多項式に関係するグループを定義しよう. |
//&jp 罨<, h;憜綣≫違若絎臂. |
/*&eg |
/*&eg |
Let us define a group for distributed polynomials. In the following |
Let us define a group for distributed polynomials. In the following, |
DMS stands for Distributed Monomial System. |
DMS stands for Distributed Monomial System. |
*/ |
*/ |
|
|
Line 250 CMObject/DistributedPolynomials. \\ |
|
Line 300 CMObject/DistributedPolynomials. \\ |
|
{\sl int32}\, \mbox{e[1]}, \ldots, |
{\sl int32}\, \mbox{e[1]}, \ldots, |
{\sl int32}\, \mbox{e[n]}, \\ |
{\sl int32}\, \mbox{e[n]}, \\ |
& & \ \mbox{Coefficient}) \\ |
& & \ \mbox{Coefficient}) \\ |
& & \mbox{ --- e[i] で, $n$ 変数 monomial |
& & \mbox{ --- e[i] , $n$ 紊 monomial |
$x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
$x^e = x_1^{e_1} \cdots x_n^{e_n}$ $e_i$ |
をあらわす.} \\ |
.} \\ |
\mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\ |
\mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\ |
\mbox{Dpolynomial}&:& \mbox{Zero} \\ |
\mbox{Dpolynomial}&:& \mbox{Zero} \\ |
& & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32} m, \\ |
& & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32}\, m, \\ |
& & \ \ \mbox{DringDefinition}, |
& & \ \ \mbox{DringDefinition}, |
[\mbox{Monomial32}|\mbox{Zero}], \\ |
[\mbox{Monomial32}|\mbox{Zero}], \\ |
& &\ \ |
& &\ \ |
\{\mbox{Monomial32}\}) \\ |
\{\mbox{Monomial32}\}) \\ |
& &\mbox{--- m はモノミアルの個数である.}\\ |
& &\mbox{--- m ≪≪違с.}\\ |
\mbox{DringDefinition} |
\mbox{DringDefinition} |
&:& \mbox{DMS of N variables} \\ |
&:& \mbox{DMS of N variables} \\ |
& & |\ \mbox{RingByName} \\ |
& & |\ \mbox{RingByName} \\ |
& & |\ \mbox{Generic DMS ring} \\ |
& & |\ \mbox{Generic DMS ring} \\ |
& & \mbox{ --- 分散表現多項式環の定義. } \\ |
& & \mbox{ --- h;憜綣違絎臂. } \\ |
\mbox{Generic DMS ring} |
\mbox{Generic DMS ring} |
&:& \mbox{({\tt CMO\_DMS\_GENERIC}) --- 新版はこちら}\\ |
&:& \mbox{({\tt CMO\_DMS\_GENERIC}) --- 亥<}\\ |
\mbox{RingByName}&:& ({\tt CMO\_RING\_BY\_NAME}, {\sl Cstring}\ {\rm s}) \\ |
\mbox{RingByName}&:& ({\tt CMO\_RING\_BY\_NAME}, {\sl Cstring}\ {\rm s}) \\ |
& & \mbox{ --- 名前 s で, 格納された ring 定義.} \\ |
& & \mbox{ --- s , 主 ring 絎臂.} \\ |
\mbox{DMS of N variables} |
\mbox{DMS of N variables} |
&:& ({\tt CMO\_DMS\_OF\_N\_VARIABLES}, \\ |
&:& ({\tt CMO\_DMS\_OF\_N\_VARIABLES}, \\ |
& & \ ({\tt CMO\_LIST}, {\sl int32}\, \mbox{m}, |
& & \ ({\tt CMO\_LIST}, {\sl int32}\, \mbox{m}, |
Line 277 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
Line 327 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
& & \ \ [,{\sl object}\,\mbox{s}, {\sl Cstring}\,\mbox{c}, |
& & \ \ [,{\sl object}\,\mbox{s}, {\sl Cstring}\,\mbox{c}, |
{\sl List}\, \mbox{vlist}, |
{\sl List}\, \mbox{vlist}, |
{\sl List}\, \mbox{wvec}, {\sl List}\, \mbox{outord}]) \\ |
{\sl List}\, \mbox{wvec}, {\sl List}\, \mbox{outord}]) \\ |
& & \mbox{ --- m はあとに続く要素の数} \\ |
& & \mbox{ --- m 膓頳膣} \\ |
& & \mbox{ --- n は変数の数, p は 標数} \\ |
& & \mbox{ --- n 紊違, p 罔} \\ |
& & \mbox{ --- s は ring の名前} \\ |
& & \mbox{ --- s ring } \\ |
& & \mbox{ --- c は係数環, QQ, ZZ の場合は文字列で QQ, ZZ と書く.} \\ |
& & \mbox{ --- c 篆亥, QQ, ZZ 翫絖 QQ, ZZ 吾.} \\ |
& & \mbox{ --- vlist は Indeterminate のリスト(新版). 多項式環の変数リスト} \\ |
& & \mbox{ --- vlist Indeterminate 鴻(亥). 紊綣違紊違鴻} \\ |
& & \mbox{ --- wvec は order をきめる weight vector,} \\ |
& & \mbox{ --- wvec order weight vector,} \\ |
& & \mbox{ --- outord は出力するときの変数順序.} \\ |
& & \mbox{ --- outord 阪紊育綺.} \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&eg |
/*&eg |
Line 297 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
Line 347 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
$x^e = x_1^{e_1} \cdots x_n^{e_n}$. } \\ |
$x^e = x_1^{e_1} \cdots x_n^{e_n}$. } \\ |
\mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\ |
\mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\ |
\mbox{Dpolynomial}&:& \mbox{Zero} \\ |
\mbox{Dpolynomial}&:& \mbox{Zero} \\ |
& & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32} m, \\ |
& & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32}\, m, \\ |
& & \ \ \mbox{DringDefinition}, [\mbox{Monomial32}|\mbox{Zero}], \\ |
& & \ \ \mbox{DringDefinition}, [\mbox{Monomial32}|\mbox{Zero}], \\ |
& &\ \ |
& &\ \ |
\{\mbox{Monomial32}\}) \\ |
\{\mbox{Monomial32}\}) \\ |
Line 326 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
Line 376 $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$ |
|
*/ |
*/ |
|
|
/*&jp |
/*&jp |
RingByName や DMS of N variables はなくても, DMS を定義できる. |
RingByName DMS of N variables , DMS 絎臂с. |
したがって, これらを実装してないシステムで DMS を扱うものが |
c, 絎茖激鴻 DMS 宴 |
あってもかまわない. |
c障. |
|
|
以下, 以上の CMObject にたいする, |
篁ヤ, 篁ヤ CMObject , |
xxx = asir, kan の振舞いを記述する. |
xxx = asir, kan 荐菴違. |
*/ |
*/ |
/*&eg |
/*&eg |
Note that it is possible to define DMS without RingByName and |
Note that it is possible to define DMS without RingByName and |
Line 343 are implemented on Asir and Kan. |
|
Line 393 are implemented on Asir and Kan. |
|
|
|
\subsection{ Zero} |
\subsection{ Zero} |
/*&jp |
/*&jp |
CMO では ゼロの表現法がなんとおりもあるが, |
CMO с 若茵憝羈. |
どのようなゼロをうけとっても, |
%% 若c, |
システムのゼロに変換できるべきである. |
%% 激鴻若紊с鴻с. |
*/ |
*/ |
/*&eg |
/*&eg |
Though CMO has various representations of zero, |
Note that CMO has various representations of zero. |
each representation should be translated into zero |
|
in the system. |
|
*/ |
*/ |
|
|
|
|
//&jp \subsection{ 整数 ZZ } |
//&jp \subsection{ 贋 ZZ } |
//&eg \subsection{ Integer ZZ } |
//&eg \subsection{ Integer ZZ } |
|
|
\begin{verbatim} |
\begin{verbatim} |
|
|
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
この節ではOpen xxx 規約における任意の大きさの整数(bignum)の扱いについ |
膀сOpen xxx 荀靘篁紙紊с贋(bignum)宴ゃ |
て説明する. Open XM 規約における多重精度整数を表すデータ型 CMO\_ZZ は |
茯. Open XM 荀靘紊膕上墾贋違茵若水 CMO\_ZZ |
GNU MPライブラリなどを参考にして設計されていて, 符号付き絶対値表現を用 |
GNU MPゃ荐荐, 膃垬腟九上よ;憗 |
いている. (cf. {\tt kan/sm1} の配布ディレクトリのなかの {\tt |
. (cf. {\tt kan/sm1} 絽c {\tt |
plugin/cmo-gmp.c}) CMO\_ZZ は次の形式をとる. |
plugin/cmo-gmp.c}) CMO\_ZZ 罨<綵√. |
*/ |
*/ |
/*&eg |
/*&eg |
We describe the bignum (multi-precision integer) representation in OpenXM. |
We describe the bignum (multi-precision integer) representation |
In OpenXM {\tt CMO\_ZZ} is used to represent bignum. Its design is similar |
{\tt CMO\_ZZ} in OpenXM. |
|
The format is similar |
to that in GNU MP. (cf. {\tt plugin/cmo-gmp.c} in the {\tt kan/sm1} |
to that in GNU MP. (cf. {\tt plugin/cmo-gmp.c} in the {\tt kan/sm1} |
distribution). CMO\_ZZ is defined as follows. |
distribution). CMO\_ZZ is defined as follows. |
*/ |
*/ |
Line 383 distribution). CMO\_ZZ is defined as follows. |
|
Line 432 distribution). CMO\_ZZ is defined as follows. |
|
\end{tabular} |
\end{tabular} |
|
|
/*&jp |
/*&jp |
$f$ は32bit整数である. $b_0, \ldots, b_n$ は unsigned int32 である. |
$f$ 32bit贋違с. $b_0, \ldots, b_n$ unsigned int32 с. |
$|f|$ は $n+1$ である. この CMO の符号は $f$ の符号で定める. 前述し |
$|f|$ $n+1$ с. CMO 膃垩 $f$ 膃垩у. 菴違 |
たように, 32bit整数の負数は 2 の補数表現で表される. |
, 32bit贋違莢違 2 茖域;憗ц;. |
|
|
Open xxx 規約では上の CMO は以下の整数を意味する. ($R = 2^{32}$) |
Open xxx 荀靘с筝 CMO 篁ヤ贋違潟. ($R = 2^{32}$) |
*/ |
*/ |
/*&eg |
/*&eg |
$f$ is a 32bit integer. $b_0, \ldots, b_n$ are unsigned 32bit integers. |
$f$ is a 32bit integer. $b_0, \ldots, b_n$ are unsigned 32bit integers. |
$|f|$ is equal to $n+1$. |
$|f|$ is equal to $n+1$. |
The sign of $f$ represents that of the above CMO. As stated in Section |
The sign of $f$ represents that of the above integer to be expressed. |
|
As stated in Section |
\ref{sec:basic0}, a negative 32bit integer is represented by |
\ref{sec:basic0}, a negative 32bit integer is represented by |
two's complement. |
two's complement. |
|
|
Line 404 In OpenXM the above CMO represents the following integ |
|
Line 454 In OpenXM the above CMO represents the following integ |
|
\] |
\] |
|
|
/*&jp |
/*&jp |
{\tt int32} を network byte order で表現 |
\noindent 箴: |
しているとすると,例えば, 整数 $14$ は CMO\_ZZ で表わすと, |
{\tt int32} network byte order ц; |
|
,箴, 贋 $14$ CMO\_ZZ ц;, |
*/ |
*/ |
/*&eg |
/*&eg |
|
\noindent Example: |
If we express {\tt int32} by the network byte order, |
If we express {\tt int32} by the network byte order, |
a CMO\_ZZ $14$ is expressed by |
a CMO\_ZZ $14$ is expressed by |
*/ |
*/ |
\[ |
\[ |
\mbox{(CMO\_ZZ, 1, 0, 0, 0, e)}, |
\mbox{(CMO\_ZZ, 1, 0, 0, 0, e)}, |
\] |
\] |
//&jp と表わす. これはバイト列では |
//&jp 茵. ゃс |
//&eg The corresponding byte sequence is |
//&eg The corresponding byte sequence is |
\[ |
\[ |
\mbox{\tt 00 00 00 14 00 00 00 01 00 00 00 0e} |
\mbox{\tt 00 00 00 14 00 00 00 01 00 00 00 0e} |
\] |
\] |
//&jp となる. |
//&jp . |
|
|
|
|
//&jp なお ZZ の 0 ( (ZZ) 0 と書く ) は, {\tt (CMO\_ZZ, 00,00,00,00)} と表現する. |
//&jp ZZ 0 ( (ZZ) 0 吾 ) , {\tt (CMO\_ZZ, 00,00,00,00)} 茵憗. |
//&eg Note that CMO\_ZZ 0 is expressed by {\tt (CMO\_ZZ, 00,00,00,00)}. |
//&eg Note that CMO\_ZZ 0 is expressed by {\tt (CMO\_ZZ, 00,00,00,00)}. |
|
|
|
|
//&jp \subsection{ 分散表現多項式 Dpolynomial } |
//&jp \subsection{ h;憜綣 Dpolynomial } |
//&eg \subsection{ Distributed polynomial Dpolynomial } |
//&eg \subsection{ Distributed polynomial Dpolynomial } |
|
|
/*&jp |
/*&jp |
環とそれに属する多項式は次のような考えかたであつかう. |
違絮紊綣罨<сゃ. |
|
|
Generic DMS ring に属する元は, |
Generic DMS ring 絮, |
変数を $n$ 個持つ 適当な係数集合 $K$ を持つ多項式環 $K[x_1, \ldots, x_n]$ |
紊違 $n$ 綵篆育 $K$ ゅ綣 $K[x_1, \ldots, x_n]$ |
の元である. |
с. |
係数集合 $K$ がなにかは, 実際データを読み込み, Coefficient を見た段階で |
篆育 $K$ , 絎若帥茯粋昭, Coefficient 荀罧級 |
わかる. |
. |
この環に属する多項式を CMO 形式でうけとった場合, 各サーバはその |
違絮紊綣 CMO 綵√сc翫, 泣若 |
サーバの対応する Object に変換しないといけない. |
泣若絲上 Object 紊. |
この変換の仕方は, 各サーバ毎にきめる. |
紊篁鴻, 泣若罸. |
|
|
Asir の場合は, $K[x_1, \ldots, x_n]$ の元は分散表現多項式に変換される. |
Asir 翫, $K[x_1, \ldots, x_n]$ h;憜綣紊. |
\noroa{ でも, order はどうなるの? } |
\noroa{ с, order ? } |
|
|
{\tt kan/sm1} の場合は事情は複雑である. |
{\tt kan/sm1} 翫篋茲с. |
{\tt kan/sm1} は, Generic DMS ring にあたる クラスをもたない. |
{\tt kan/sm1} , Generic DMS ring 鴻. |
つまり, Default で存在する, $n$ 変数の分散表現多項式環は存在しないわけである. |
ゃ障, Default у, $n$ 紊違h;憜綣違絖с. |
したがって, {\tt kan/sm1} では, DMS of N variables が来た場合, |
c, {\tt kan/sm1} с, DMS of N variables ャ翫, |
これを CurrentRing の元として読み込む. CurrentRing の変数の数が $n'$ |
CurrentRing 茯粋昭. CurrentRing 紊違違 $n'$ |
で, $n' < n$ だと新しい多項式環を生成してデータを読み込む. |
, $n' < n$ 違紊綣違若帥茯粋昭. |
Order その他の optional 情報はすべて無視する. |
Order 篁 optional 宴鴻∴. |
|
|
DMS の 2 番目のフィールドで, |
DMS 2 c若, |
Ring by Name を用いた場合, 現在の名前空間で変数 yyy に格納された ring object |
Ring by Name 翫, 憜腥咲у yyy 主 ring object |
の元として, この多項式を変換しなさいという意味になる. |
, 紊綣紊潟. |
{\tt kan/sm1} の場合, 環の定義は ring object として格納されており, |
{\tt kan/sm1} 翫, 違絎臂 ring object 主, |
この ring object を 変数 yyy で参照することにより CMO としてうけとった |
ring object 紊 yyy ус CMO c |
多項式をこの ring の元として格納できる. |
紊綣 ring 主с. |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
We treat polynomial rings and their elements as follows. |
We treat polynomial rings and their elements as follows. |
|
|
Generic DMS ring is an $n$-variate polynomial ring $K[x_1, \ldots, x_n]$, |
Generic DMS ring is an $n$-variate polynomial ring $K[x_1, \ldots, x_n]$, |
where $K$ is some coefficient set. $K$ is unknown in advance |
where $K$ is a coefficient set. $K$ is unknown in advance |
and it is determined when coefficients of an element are received. |
and it is determined when coefficients of an element are received. |
When a server has received an element in Generic DMS ring, |
When a server has received an element in Generic DMS ring, |
the server has to translate it into the corresponding local object |
the server has to translate it into the corresponding local object |
Line 475 In {\tt kan/sm1} things are complicated. |
|
Line 527 In {\tt kan/sm1} things are complicated. |
|
{\tt kan/sm1} translates a DMS of N variables into an element of |
{\tt kan/sm1} translates a DMS of N variables into an element of |
the CurrentRing. |
the CurrentRing. |
If the CurrentRing is $n'$-variate and $n' < n$, then |
If the CurrentRing is $n'$-variate and $n' < n$, then |
an $n$-variate polynomial ring is newly created. Optional informations such as |
an $n$-variate polynomial ring is newly created. |
the term order are all ignored. |
|
|
|
|
|
If RingByName ({\tt CMO\_RING\_BY\_NAME}, yyy) |
If RingByName ({\tt CMO\_RING\_BY\_NAME}, yyy) |
is specified as the second field of DMS, |
is specified as the second field of DMS, |
it requests a sever to use a ring object whose name is yyy |
it requests a sever to use a ring object whose name is yyy |
as the destination ring for the translation. |
as the destination ring for the translation. |
This is done in {\tt kan/sm1}. |
|
*/ |
*/ |
|
|
\medbreak \noindent |
\medbreak \noindent |
//&jp {\bf Example}: (すべての数の表記は 16 進表記) |
//&jp {\bf Example}: (鴻違茵荐 16 画;荐) |
//&eg {\bf Example}: (all numbers are represented in hexadecimal notation) |
//&eg {\bf Example}: (all numbers are represented in hexadecimal notation) |
{\footnotesize \begin{verbatim} |
{\footnotesize \begin{verbatim} |
Z/11Z [6 variables] |
Z/11Z [6 variables] |
|
|
(CMO_MONOMIAL32[13],3*x^2*y),), |
(CMO_MONOMIAL32[13],3*x^2*y),), |
\end{verbatim} } |
\end{verbatim} } |
/*&jp |
/*&jp |
$ 3 x^2 y$ は 6 変数の多項式環の 元としてみなされている. |
$ 3 x^2 y$ 6 紊違紊綣違 帥. |
*/ |
*/ |
/*&eg |
/*&eg |
$3 x^2 y$ is regarded as an element of a six-variate polynomial ring. |
$3 x^2 y$ is regarded as an element of a six-variate polynomial ring. |
*/ |
*/ |
|
|
|
|
//&jp \subsection{再帰表現多項式の定義} |
//&jp \subsection{絽域;憜綣絎臂} |
//&eg \subsection{Recursive polynomials} |
//&eg \subsection{Recursive polynomials} |
|
|
\begin{verbatim} |
\begin{verbatim} |
Line 532 $\in$ CMObject/RecursivePolynomial \\ |
|
Line 583 $\in$ CMObject/RecursivePolynomial \\ |
|
\mbox{Polynomial in 1 variable} &:& |
\mbox{Polynomial in 1 variable} &:& |
\mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\ |
\mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\ |
& & \quad \mbox{ Name of the main variable }, \\ |
& & \quad \mbox{ Name of the main variable }, \\ |
& & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} \\ |
& & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} ) \\ |
& & \mbox{ --- m はモノミアルの個数. } \\ |
& & \mbox{ --- m ≪≪. } \\ |
& & \mbox{ --- e, Coefficieint はモノミアルを表現している. } \\ |
& & \mbox{ --- e, Coefficieint ≪≪茵憗. } \\ |
& & \mbox{ --- 順序の高い順にならべる. 普通は巾の高い順.} \\ |
& & \mbox{ --- 綺蕭鴻. 綏障蕭.} \\ |
& & \mbox{ --- e は 1変数多項式の巾をあらわす. } \\ |
& & \mbox{ --- e 1紊医綣綏障. } \\ |
\mbox{Coefficient} &:& \mbox{ ZZ} \,|\, \mbox{ QQ } \,|\, |
\mbox{Coefficient} &:& \mbox{ ZZ} \,|\, \mbox{ QQ } \,|\, |
\mbox{ integer32 } \,|\, |
\mbox{ integer32 } \,|\, |
\mbox{ Polynomial in 1 variable } \\ |
\mbox{ Polynomial in 1 variable } \\ |
& & \quad \,|\, \mbox{Tree} \,|\, \mbox{Zero} \,|\,\mbox{Dpolynomial}\\ |
& & \quad \,|\, \mbox{Tree} \,|\, \mbox{Zero} \,|\,\mbox{Dpolynomial}\\ |
\mbox{Name of the main variable } &:& |
\mbox{Name of the main variable } &:& |
\mbox{ {\sl int32} v } \\ |
\mbox{ {\sl int32} v } \\ |
& & \mbox{ --- v は 変数番号 (0 からはじまる) を表す. } \\ |
& & \mbox{ --- v 紊亥 (0 障) 茵. } \\ |
\mbox{Recursive Polynomial} &:& |
\mbox{Recursive Polynomial} &:& |
\mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\ |
\mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\ |
& & \quad \mbox{ RringDefinition, } \\ |
& & \quad \mbox{ RringDefinition, } \\ |
& & \quad |
& & \quad |
\mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} \\ |
\mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} ) \\ |
\mbox{RringDefinition} |
\mbox{RringDefinition} |
& : & \mbox{ {\sl List} v } \\ |
& : & \mbox{ {\sl List} v } \\ |
& & \quad \mbox{ --- v は, 変数名(indeterminate) のリスト. } \\ |
& & \quad \mbox{ --- v , 紊医(indeterminate) 障 Tree 鴻. } \\ |
& & \quad \mbox{ --- 順序の高い順. } \\ |
& & \quad \mbox{ --- 綺蕭. } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&eg |
/*&eg |
Line 560 $\in$ CMObject/RecursivePolynomial \\ |
|
Line 611 $\in$ CMObject/RecursivePolynomial \\ |
|
\mbox{Polynomial in 1 variable} &:& |
\mbox{Polynomial in 1 variable} &:& |
\mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\ |
\mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\ |
& & \quad \mbox{ Name of the main variable }, \\ |
& & \quad \mbox{ Name of the main variable }, \\ |
& & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} \\ |
& & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} ) \\ |
& & \mbox{ --- m is the number of monomials. } \\ |
& & \mbox{ --- m is the number of monomials. } \\ |
& & \mbox{ --- A pair of e and Coefficient represents a monomial. } \\ |
& & \mbox{ --- A pair of e and Coefficient represents a monomial. } \\ |
& & \mbox{ --- The pairs of e and Coefficient are sorted in the } \\ |
& & \mbox{ --- The pairs of e and Coefficient are sorted in the } \\ |
Line 578 $\in$ CMObject/RecursivePolynomial \\ |
|
Line 629 $\in$ CMObject/RecursivePolynomial \\ |
|
\mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\ |
\mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\ |
& & \quad \mbox{ RringDefinition, } \\ |
& & \quad \mbox{ RringDefinition, } \\ |
& & \quad |
& & \quad |
\mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} \\ |
\mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} ) \\ |
\mbox{RringDefinition} |
\mbox{RringDefinition} |
& : & \mbox{ {\sl List} v } \\ |
& : & \mbox{ {\sl List} v } \\ |
& & \quad \mbox{ --- v is a list of names of indeterminates. } \\ |
& & \quad \mbox{ --- v is a list of names of indeterminates or trees. } \\ |
& & \quad \mbox{ --- It is sorted in the decreasing order. } \\ |
& & \quad \mbox{ --- It is sorted in the decreasing order. } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
|
|
10, 1, |
10, 1, |
5, 31))) |
5, 31))) |
\end{verbatim} |
\end{verbatim} |
//&jp これは, |
//&jp , |
//&eg This represents |
//&eg This represents |
$$ x^3 (1234 y^5 + 17 ) + x^1 (y^{10} + 31 y^5) $$ |
$$ x^3 (1234 y^5 + 17 ) + x^1 (y^{10} + 31 y^5) $$ |
/*&jp |
/*&jp |
をあらわす. |
. |
非可換多項式もこの形式であらわしたいので, 積の順序を上のように |
%%紊綣綵√с, 腥綺筝 |
すること. つまり, 主変数かける係数の順番. |
%%. ゃ障, 筝糸違篆違. |
*/ |
*/ |
/*&eg |
/*&eg |
We intend to represent non-commutative polynomials with the |
%%We intend to represent non-commutative polynomials with the |
same form. In such a case, the order of products are defined |
%%same form. In such a case, the order of products are defined |
as above, that is a power of the main variable $\times$ a coeffcient. |
%%as above, that is a power of the main variable $\times$ a coeffcient. |
|
|
*/ |
*/ |
|
|
\noindent |
\noindent |
|
|
Class.recursivePolynomial h * ((-1)) + (x^2 * (1)) |
Class.recursivePolynomial h * ((-1)) + (x^2 * (1)) |
\end{verbatim} |
\end{verbatim} |
|
|
//&jp \subsection{CPU依存の double } |
//&jp \subsection{CPU箴絖 double } |
//&eg \subsection{CPU dependent double} |
//&eg \subsection{CPU dependent double} |
|
|
\begin{verbatim} |
\begin{verbatim} |
Line 640 $\in$ CMObject/MachineDouble \\ |
|
Line 692 $\in$ CMObject/MachineDouble \\ |
|
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{64bit machine double} &:& |
\mbox{64bit machine double} &:& |
\mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte}} s8)\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s8 {\tt double} (64bit). } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- 茵憗CPU箴絖с.}\\ |
&& \mbox{\quad\quad mathcap に CPU 情報を付加しておく.} \\ |
&& \mbox{\quad\quad byte order negotiation .} \\ |
\mbox{Array of 64bit machine double} &:& |
\mbox{Array of 64bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の double (64bit) である. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] m double (64bit) с. } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- 茵憗CPU箴絖с.}\\ |
& & \mbox{ \quad\quad mathcap に CPU 情報を付加しておく.} \\ |
& & \mbox{ \quad\quad byte order negotiation .} \\ |
\mbox{128bit machine double} &:& |
\mbox{128bit machine double} &:& |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte}} s16)\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s16 {\tt long double} (128bit). } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- 茵憗CPU箴絖с.}\\ |
&& \mbox{\quad\quad mathcap に CPU 情報を付加しておく.} \\ |
&& \mbox{\quad\quad byte order negotiation .} \\ |
\mbox{Array of 128bit machine double} &:& |
\mbox{Array of 128bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}} s16[1], \ldots , {\sl byte} s16[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の long double (128bit) である. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] m long double (128bit) с. } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- 茵憗CPU箴絖с.}\\ |
& & \mbox{ \quad\quad mathcap に CPU 情報を付加しておく.} |
& & \mbox{ \quad\quad byte order negotiation .} |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&eg |
/*&eg |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{64bit machine double} &:& |
\mbox{64bit machine double} &:& |
\mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte}} s8)\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s8 {\tt double} (64bit). } \\ |
& & \mbox{ --- This depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
&& \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
&& \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{Array of 64bit machine double} &:& |
\mbox{Array of 64bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 64bit double's. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 64bit double's. } \\ |
& & \mbox{ --- This depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{128bit machine double} &:& |
\mbox{128bit machine double} &:& |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte}} s16)\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s16 {\tt long double} (128bit). } \\ |
& & \mbox{ --- This depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{Array of 128bit machine double} &:& |
\mbox{Array of 128bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}} s16[1], \ldots , {\sl byte} s16[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 128bit long double's. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 128bit long double's. } \\ |
& & \mbox{ --- This depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
|
|
\bigbreak |
\bigbreak |
//&jp 次に IEEE 準拠の float および Big float を定義しよう. |
|
//&eg We define float and big float conforming to the IEEE standard. |
|
\begin{verbatim} |
\begin{verbatim} |
#define CMO_BIGFLOAT 50 |
|
#define CMO_IEEE_DOUBLE_FLOAT 51 |
#define CMO_IEEE_DOUBLE_FLOAT 51 |
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
IEEE 準拠の float については, IEEE 754 double precision floating-point |
IEEE 羣 float ゃ, IEEE 754 double precision floating-point |
format (64 bit) の定義を見よ. |
format (64 bit) 絎臂荀. |
|
|
|
256.100006 Intel Pentium double64 с茵憗 |
|
{\tt cd 0c 80 43 } \\ |
|
256.100006 PowerPC (Mac) double64 с茵憗 |
|
{\tt 43 80 0c cd }. |
|
箴с帥 byte 綺с. |
|
潟吾潟鴻帥若 byte order negotiation byte 綺絎. |
|
|
|
|
*/ |
*/ |
/*&eg |
/*&eg |
See IEEE 754 double precision floating-point (64 bit) for the details of |
See IEEE 754 double precision floating-point (64 bit) for the details of |
float conforming to the IEEE standard. |
float compliant to the IEEE standard. |
|
|
|
The internal expression of 256.100006 in the Intel Pentium is |
|
{\tt cd 0c 80 43 } \\ |
|
The internal expression of 256.100006 in the PowerPC (Mac) is |
|
{\tt 43 80 0c cd }. |
|
As you have seen in this example, |
|
the orders of the bytes are opposite each other. |
|
The byte order is specified by the byte order negotiation protocol |
|
when the engine starts. |
|
|
*/ |
*/ |
|
|
\noindent |
\subsection{Bigfloat32} |
Group CMObject/Bigfloat requires CMObject/Primitive, CMObject/Basic.\\ |
/*&jp |
Bigfloat |
int32 堺 bigfloat 茵憝号ゃ菴違鴻. |
$\in$ CMObject/Bigfloat \\ |
綵√ mpfr 32bit CPU т戎茵憗演с. |
|
*/ |
|
/*&eg |
|
This subsection describes our format for bigfloat in terms of the int32. |
|
This format is identical to the internal format of mpfr on 32 bit CPU's. |
|
*/ |
|
Ref: {\tt OpenXM/src/mpfr/bfsize/bfsize.c} |
|
|
\begin{eqnarray*} |
\begin{verbatim} |
\mbox{Bigfloat} &:& |
#define CMO_BIGFLOAT32 52 |
\mbox{({\tt CMO\_BIGFLOAT}, } \\ |
\end{verbatim} |
& & \quad \mbox{ {\sl ZZ} a , {\sl ZZ} e})\\ |
|
& & \mbox{ --- $a \times 2^e$. } \\ |
|
\end{eqnarray*} |
/*&jp |
|
Bigfloat32 罨<綵√ int32 с. |
|
*/ |
|
/*&eg |
|
The bigfloat32 is an array of int32 numbers of the following format. |
|
*/ |
|
|
|
\begin{center} |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} |
|
\end{center} |
|
|
|
/*&jp |
|
p=prec 膕上墾, s=sign 膃(1 罩c, -1 (2茖域;)莢) , |
|
E=exp 育, 筝若帥 |
|
$$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E $$ |
|
茵. |
|
$B=2^{32}$, |
|
$k = \lceil p/32 \rceil$ |
|
с. |
|
*/ |
|
/*&eg |
|
p=prec is the precision, s=sign is the sign(1 means positive, -1 (expressed by two's complement) is nevative), |
|
E=exp is the exponent, and the data above expresses the number |
|
$$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E. $$ |
|
Here, $B=2^{32}$, |
|
$k = \lceil p/32 \rceil$. |
|
*/ |
|
|