version 1.4, 2017/03/03 09:00:26 |
version 1.19, 2019/06/12 05:53:29 |
|
|
%% $OpenXM: OpenXM/src/asir-contrib/packages/doc/gtt_ekn/gtt_ekn-ja.texi,v 1.3 2016/03/28 23:14:54 takayama Exp $ |
%% $OpenXM: OpenXM/src/asir-contrib/packages/doc/gtt_ekn/gtt_ekn-ja.texi,v 1.18 2019/04/09 00:48:14 takayama Exp $ |
%% ptex -kanji euc gtt_ekn.texi (.texi までつける. platex でなく ptex) |
%% xetex gtt_ekn-ja.texi (.texi 障сゃ. ) |
%% 以下コメントは @comment で始める. \input texinfo 以降は普通の tex 命令は使えない. |
%% 篁ヤ潟<潟 @comment у. \input texinfo 篁ラ tex 巡擦篏帥. |
\input texinfo |
\input texinfo-ja |
@iftex |
@iftex |
@catcode`@#=6 |
@catcode`@#=6 |
@def@fref#1{@xrefX[#1,,@code{#1},,,]} |
@def@fref#1{@xrefX[#1,,@code{#1},,,]} |
@def@b#1{{@bf@gt #1}} |
@def@b#1{{@bf #1}} |
@catcode`@#=@other |
@catcode`@#=@other |
@end iftex |
@end iftex |
@overfullrule=0pt |
@overfullrule=0pt |
|
@documentlanguage ja |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
@comment %**start of header |
@comment %**start of header |
@comment --- おまじない終り --- |
@comment --- 障腟 --- |
|
|
@comment --- GNU info ファイルの名前 --- |
@comment --- GNU info <ゃ --- |
@setfilename xyzman |
@setfilename xyzman |
|
|
@comment --- タイトル --- |
@comment --- 帥ゃ --- |
@settitle 2元分割表HGM |
@settitle 2画;HGM |
|
|
@comment %**end of header |
@comment %**end of header |
@comment %@setchapternewpage odd |
@comment %@setchapternewpage odd |
|
|
@comment --- おまじない --- |
@comment --- 障 --- |
@ifinfo |
@ifinfo |
@macro fref{name} |
@macro fref{name} |
@ref{\name\,,@code{\name\}} |
@ref{\name\,,@code{\name\}} |
|
|
@end iftex |
@end iftex |
|
|
@titlepage |
@titlepage |
@comment --- おまじない終り --- |
@comment --- 障腟 --- |
|
|
@comment --- タイトル, バージョン, 著者名, 著作権表示 --- |
@comment --- 帥ゃ, 若吾с, , 篏罔茵腓 --- |
@title 2元分割表HGM関数 |
@title 2画;HGM∽ |
@subtitle Risa/Asir 2元分割表HGM関数説明書 |
@subtitle Risa/Asir 2画;HGM∽域 |
@subtitle 1.1 版 |
@subtitle 3.0 |
@subtitle 2017 年 3 月 3 日 |
@subtitle 2019 綛 6 7 |
|
|
@author by Y.Goto, Y.Tachibana, N.Takayama |
@author by Y.Goto, Y.Tachibana, N.Takayama |
@page |
@page |
@vskip 0pt plus 1filll |
@vskip 0pt plus 1filll |
Copyright @copyright{} Risa/Asir committers |
Copyright @copyright{} Risa/Asir committers |
2004--2010. All rights reserved. |
2004--2019. All rights reserved. |
@end titlepage |
@end titlepage |
|
|
@comment --- おまじない --- |
@comment --- 障 --- |
@synindex vr fn |
@synindex vr fn |
@comment --- おまじない終り --- |
@comment --- 障腟 --- |
|
|
@comment --- @node は GNU info, HTML 用 --- |
@comment --- @node GNU info, HTML --- |
@comment --- @node の引数は node-name, next, previous, up --- |
@comment --- @node 綣違 node-name, next, previous, up --- |
@node Top,, (dir), (dir) |
@node Top,, (dir), (dir) |
|
|
@comment --- @menu は GNU info, HTML 用 --- |
@comment --- @menu GNU info, HTML --- |
@comment --- chapter 名を正確に並べる --- |
@comment --- chapter 罩g∈筝鴻 --- |
@comment --- この文書では chapter XYZ, Chapter Index がある. |
@comment --- 吾с chapter XYZ, Chapter Index . |
@comment --- Chapter XYZ には section XYZについて, section XYZに関する関数がある. |
@comment --- Chapter XYZ section XYZゃ, section XYZ≪∽違. |
@menu |
@menu |
* 2元分割表HGMの関数説明書について:: |
* 2画;HGM∽域吾ゃ:: |
* 2元分割表HGMの関数:: |
* 2画;HGM∽:: |
* modular計算 |
* modular荐膊 |
|
* Binary splitting |
* Index:: |
* Index:: |
@end menu |
@end menu |
|
|
@comment --- chapter の開始 --- |
@comment --- chapter 紮 --- |
@comment --- 親 chapter 名を正確に. 親がない場合は Top --- |
@comment --- 荀 chapter 罩g∈. 荀翫 Top --- |
@node 2元分割表HGMの関数説明書について,,, Top |
@node 2画;HGM∽域吾ゃ,,, Top |
@chapter 2元分割表HGMの関数説明書について |
@chapter 2画;HGM∽域吾ゃ |
|
|
この説明書では |
茯吾с |
HGM(holonomic gradient method) を用いた2元分割表の関数について説明する. |
HGM(holonomic gradient method) 2画;∽違ゃ茯. |
ChangeLog の項目は www.openxm.org の cvsweb で |
ChangeLog www.openxm.org cvsweb |
ソースコードを読む時の助けになる情報が書かれている. |
純若鴻潟若茯宴吾. |
|
宴若吾筝荐若. |
本文中で引用している文献を列挙する. |
@example |
|
load("gtt_ekn3.rr"); |
|
@end example |
|
gtt_ekn3.rr gtt_ekn.rr 臀紊с壕宴若吾с. |
|
@noindent |
|
亥 asir-contrib package 緇, 筝荐贋育∽違若喝冴. |
|
@example |
|
import("names.rr"); |
|
asir_contrib_update(|update=1); |
|
@end example |
|
@noindent |
|
筝у. |
@itemize @bullet |
@itemize @bullet |
@item [GM2016] |
@item [GM2016] |
Y.Goto, K.Matsumoto, Pfaffian equations and contiguity relations of the hypergeometric function of type (k+1,k+n+2) and their applications, arxiv:1602.01637 (version 1) |
Y.Goto, K.Matsumoto, Pfaffian equations and contiguity relations of the hypergeometric function of type (k+1,k+n+2) and their applications, |
|
@uref{http://arxiv.org/abs/1602.01637,arxiv:1602.01637 (version 1)} |
@item [T2016] |
@item [T2016] |
Y.Tachibana, 差分ホロノミック勾配法のモジュラーメソッドによる計算の高速化, |
Y.Tachibana, 綏冗羈≪吾ャ若<純荐膊蕭, |
2016, 神戸大学修士論文. |
2016, 腑後ぇ絖篆紕茫. |
@item [GTT2016] |
@item [GTT2016] |
Y.Goto, Y.Tachibana, N.Takayama, 2元分割表に対する差分ホロノミック勾配法の実装, |
Y.Goto, Y.Tachibana, N.Takayama, 2画;絲障綏冗羈絎茖, |
数理研講究録(掲載予定). |
亥茗腥狗. |
|
@item [TGKT] |
|
Y.Tachibana, Y.Goto, T.Koyama, N.Takayama, |
|
Holonomic Gradient Method for Two Way Contingency Tables, |
|
@uref{https://arxiv.org/abs/1803.04170, arxiv:1803.04170 (the 2nd version)} |
@item [TKT2015] |
@item [TKT2015] |
N.Takayama, S.Kuriki, A.Takemura, |
N.Takayama, S.Kuriki, A.Takemura, |
$A$-hypergeometric distributions and Newton polytopes. |
$A$-hypergeometric distributions and Newton polytopes. |
arxiv:1510.02269 |
@uref{http://arxiv.org/abs/1510.02269,arxiv:1510.02269} |
@end itemize |
@end itemize |
|
|
このマニュアルで説明する関数を用いたプログラム例は |
ャ≪ц∽違違箴 |
gtt_ekn/test-t1.rr |
gtt_ekn3/test-t1.rr |
など. |
. |
|
|
|
|
@node 2元分割表HGMの関数,,, Top |
@node 2画;HGM∽,,, Top |
@chapter 2元分割表HGMの関数 |
@chapter 2画;HGM∽ |
|
|
@comment --- section ``実験的関数'' の subsection xyz_abc |
@comment --- section ``絎薑∽'' subsection xyz_abc |
@comment --- subsection xyz_pqr xyz_stu がある. |
@comment --- subsection xyz_pqr xyz_stu . |
@menu |
@menu |
* gtt_ekn.gmvector:: |
* gtt_ekn3.gmvector:: |
* gtt_ekn.nc:: |
* gtt_ekn3.nc:: |
* gtt_ekn.lognc:: |
* gtt_ekn3.lognc:: |
* gtt_ekn.expectation:: |
* gtt_ekn3.expectation:: |
* gtt_ekn.setup:: |
* gtt_ekn3.setup:: |
* gtt_ekn.upAlpha:: |
* gtt_ekn3.upAlpha:: |
|
* gtt_ekn3.cmle:: |
|
* gtt_ekn3.set_debug_level:: |
|
* gtt_ekn3.contiguity_mat_list_2:: |
|
* gtt_ekn3.show_path:: |
|
* gtt_ekn3.get_svalue:: |
|
* gtt_ekn3.assert1:: |
|
* gtt_ekn3.assert2:: |
|
* gtt_ekn3.assert3:: |
|
* gtt_ekn3.prob1:: |
@end menu |
@end menu |
|
|
@node 超幾何関数E(k,n),,, 2元分割表HGMの関数 |
@node 莇綛鞘∽E(k,n),,, 2画;HGM∽ |
@section 超幾何関数E(k,n) |
@section 莇綛鞘∽E(k,n) |
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@comment --- ◯◯◯◯ の説明 |
@comment --- 茯 |
@comment --- 個々の関数の説明の開始 --- |
@comment --- ∽違茯紮 --- |
@comment --- section 名を正確に --- |
@comment --- section 罩g∈ --- |
@node gtt_ekn.gmvector,,, 超幾何関数E(k,n) |
@node gtt_ekn3.gmvector,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.gmvector} |
@subsection @code{gtt_ekn3.gmvector} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.gmvector |
@findex gtt_ekn3.gmvector |
|
|
@table @t |
@table @t |
@item gtt_ekn.gmvector(@var{beta},@var{p}) |
@item gtt_ekn3.gmvector(@var{beta},@var{p}) |
:: 周辺和 @var{beta}, セルの確率 @var{p} の二元分割表に付随する超幾何関数 |
:: 莨阪 @var{beta}, 祉腆榊 @var{p} 篋画;篁莇綛鞘∽ |
E(k,n) の値およびその微分の値を戻す. |
E(k,n) ゃ潟緇ゃ祉. |
@item gtt_ekn.ekn_cBasis_2(@var{beta},@var{p}) |
@item gtt_ekn3.ekn_cBasis_2(@var{beta},@var{p}) |
の別名である. |
ュс. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return |
@item return |
ベクトル, 超幾何関数の値とその微分. 詳しくは下記. |
, 莇綛鞘∽違ゃ緇. 荅潟筝荐. |
@item beta |
@item beta |
行和, 列和のリスト. 成分はすべて正であること. |
茵, 鴻. 鴻罩cс. |
@item p |
@item p |
二元分割表のセルの確率のリスト |
篋画;祉腆榊鴻 |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
gmvector は Gauss-Manin vector の略である [GM2016]. |
gmvector Gauss-Manin vector ャс [GM2016]. |
@item |
@item |
gmvector の戻り値は |
gmvector 祉ゃ |
[GM2016] の 6章 p.23 のベクトル Sである. |
[GM2016] 6腴 p.23 Sс. |
これは |
|
[GM2016] の4章で定義されているベクトル F の定数倍であり, |
[GM2016] 鐚腴у臂 F 絎医с, |
その定数は |
絎違 |
第一成分が [GM2016] の6章で定義されている級数 S の値と等しく |
膃筝 [GM2016] 鐚腴у臂膣 S ゃ膈 |
なるように決められている. |
羆冴. |
@item |
@item |
r1 x r2 分割表を考える. |
r1 x r2 画;. |
m+1=r1, n+1=r2 とおく. |
m+1=r1, n+1=r2 . |
正規化定数 Z は分割表 u を (m+1) × (n+1) 行列とするとき p^u/u! の和である. |
罩h絎 Z 画; u (m+1) (n+1) 茵 p^u/u! с. |
ここで和は行和列和が @var{beta} であるような u 全体でとる |
у茵 @var{beta} с u 篏с |
[TKT2015], [GM2016]. |
[TKT2015], [GM2016]. |
S はこの多項式 Z の p を |
S 紊綣 Z p |
@verbatim |
@verbatim |
[[1,y11,...,y1n], |
[[1,y11,...,y1n], |
[1,y21,...,y2n],..., |
[1,y21,...,y2n],..., |
[1,ym1, ...,ymn], |
[1,ym1, ...,ymn], |
[1,1, ..., 1]] |
[1,1, ..., 1]] |
@end verbatim |
@end verbatim |
(1 が L 字型に並ぶ), |
(1 L 絖筝), |
と正規化した級数である. |
罩h膣違с. |
@item |
@item |
2x(n+1)分割表で, gmvector の戻り値を Lauricella F_D で書くことが |
2x(n+1)画;, gmvector 祉ゃ Lauricella F_D ф吾 |
以下のようにできる |
篁ヤс |
(b[2][1]-b[1][1] >= 0 の場合). |
(b[2][1]-b[1][1] >= 0 翫). |
ここで b[1][1], b[1][2] は, それぞれ 1 行目の行和, 2 行目の行和, |
b[1][1], b[1][2] , 1 茵茵, 2 茵茵, |
b[2][i] は i 列目の列和である. |
b[2][i] i с. |
@comment ekn/Talks/2015-12-3-goto.tex |
@comment ekn/Talks/2015-12-3-goto.tex |
@verbatim |
@verbatim |
S=F_D(-b[1,1], [-b[2,2],...,-b[2,n+1]], b[2,1]-b[1,1]+1 ; y)/C, |
S=F_D(-b[1,1], [-b[2,2],...,-b[2,n+1]], b[2,1]-b[1,1]+1 ; y)/C, |
@end verbatim |
@end verbatim |
C=b[1,1]! b[2,2]! ... b[2][n+1]! (b[2,1]-b[1,1])! |
C=b[1,1]! b[2,2]! ... b[2,n+1]! (b[2,1]-b[1,1])! |
とおく. |
. |
1/C は L 字型の分割表 |
1/C L 絖画; |
@verbatim |
@verbatim |
[[b[1,1], 0, ..., 0 ], |
[[b[1,1], 0, ..., 0 ], |
[b[2,1]-b[1,1],b[2,2], ..., b[2,n+1]]] |
[b[2,1]-b[1,1],b[2,2], ..., b[2,n+1]]] |
@end verbatim |
@end verbatim |
に対応. |
絲上. |
gmvector は |
gmvector |
@verbatim |
@verbatim |
[S,(y11/a2) d_11 S,(y12/a3) d_12 S, ..., (y1n/a_(n+1)) d_1n S] |
[S,(y11/a2) d_11 S,(y12/a3) d_12 S, ..., (y1n/a_(n+1)) d_1n S] |
@end verbatim |
@end verbatim |
である. |
с. |
ここで d_ij は yij についての微分, |
d_ij yij ゃ緇, |
@verbatim |
@verbatim |
[a0, a1, ... ,a_(n+2)] |
[a0, a1, ... ,a_(n+2)] |
= [-b[1,2],-b[1,1],b[2,2], ..., b[2,n+1],b[2,1]] |
= [-b[1,2],-b[1,1],b[2,2], ..., b[2,n+1],b[2,1]] |
@end verbatim |
@end verbatim |
である. |
с. |
@item |
@item |
周辺和 @var{beta}の時の正規化定数のセル確率 @var{p} に対する値は 多項式に退化した E(k,n) の値で表現できる. 文献 [TKT2015], [GM2016] 参照. |
莨阪 @var{beta}罩h絎違祉腆榊 @var{p} 絲障ゃ 紊綣 E(k,n) ゃц;憗с. [TKT2015], [GM2016] . |
@item |
@item |
option crt=1 (crt = Chinese remainder theorem) を与えると, 分散計算をおこなう |
篁ヤ option expectation 篁с篏帥. |
|
@item |
|
option crt=1 (crt = Chinese remainder theorem) 筝, h膊 |
[T2016]. |
[T2016]. |
分散計算用の各種パラメータの設定は |
h膊腮<若帥荐絎 |
gtt_ekn.setup で行なう. |
gtt_ekn3.setup ц. |
|
@item |
|
option bs=1. binary splitting method matrix factorial 荐膊. |
|
筝 3x3 с号(assert2(15|bs=1)), 5x5 (test5x5(20|bs=1))с. |
|
若 bs=0. |
|
@item |
|
option path. contiguity path ≪眼冴絎. |
|
path=2 (緇, 丈茫 [GM2016] path). path=3 (茫 [TGKT] path). |
|
若 path=3. |
|
@item |
|
option interval. 絽吾 matrix factorial 荐膊с, 罸絖贋域膊ц膊緇膣. 違筝綣泣筝榊筝綣泣茹f |
|
膣筝絎ц荐膊合. |
|
interval 贋医ゃ荐絎茵筝罨≦ interval 潟膣茵. |
|
interval ゃ馹罸違激鴻若ゃ荐絎. |
|
@item |
|
option x=1. subprocess 罸 window . |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: 次は2 x 2 分割表で行和が [5,1], 列和が [3,3], 各セルの確率が |
箴: 罨<2 x 2 画;ц [5,1], [3,3], 祉腆榊 |
[[1/2,1/3],[1/7,1/5]] の場合の gmvector の値である. |
[[1/2,1/3],[1/7,1/5]] 翫 gmvector ゃс. |
@example |
@example |
[3000] load("gtt_ekn.rr"); |
[3000] load("gtt_ekn3.rr"); |
[3001] ekn_gtt.gmvector([[5,1],[3,3]],[[1/2,1/3],[1/7,1/5]]) |
[3001] gtt_ekn3.gmvector([[5,1],[3,3]],[[1/2,1/3],[1/7,1/5]]) |
[775/27783] |
[775/27783] |
[200/9261] |
[200/9261] |
@end example |
@end example |
|
|
参考: 2 x m 分割表(Lauricella FD)についてはパッケージ tk_fd でも下記のように同等な |
箴: N 2篁ヤ倶違, Gauss 莇綛鞘∽(翫紊綣) |
計算ができる. |
F(-36N,-11N,2N,(1-1/N)/56) ゃ T3 篁eャ ( [TGKT] ). |
守備範囲の異なるプログラム同士の比較, debug 用参考. |
@comment ekn/Prog2/2x2.rr |
@example |
@example |
|
N=2; |
|
T2=gtt_ekn3.gmvector([[36*N,13*N-1],[38*N-1,11*N]],[[1,(1-1/N)/56],[1,1]])[0][0]; |
|
D=fac(36*N)*fac(11*N)*fac(2*N-1); |
|
T3=T2*D; |
|
@end example |
|
<帥ゃ Mathematica 荐膊 |
|
@example |
|
n=2; Hypergeometric2F1[-36*n,-11*n,2*n,(1-1/n)/56] |
|
@end example |
|
|
|
箴: interval option |
|
@example |
|
[4009] P=gtt_ekn3.prob1(5,5,100); |
|
[[[100,200,300,400,500],[100,200,300,400,500]],[[1,1/2,1/3,1/5,1/7],[1,1/11,1/13,1/17,1/19],[1,1/23,1/29,1/31,1/37],[1,1/41,1/43,1/47,1/53],[1,1,1,1,1]]] |
|
|
|
[4010] util_timing(quote(gtt_ekn3.gmvector([[100,200,300,400,500],[100,200,300,400,500]], [[1,1/2,1/3,1/5,1/7],[1,1/11,1/13,1/17,1/19],[1,1/23,1/29,1/31,1/37],[1,1/41,1/43,1/47,1/53],[1,1,1,1,1]])))[1]; |
|
[cpu,72.852,gc,0,memory,4462742364,real,72.856] |
|
|
|
[4011] util_timing(quote(gtt_ekn3.gmvector([[100,200,300,400,500],[100,200,300,400,500]], [[1,1/2,1/3,1/5,1/7],[1,1/11,1/13,1/17,1/19],[1,1/23,1/29,1/31,1/37],[1,1/41,1/43,1/47,1/53],[1,1,1,1,1]]|interval=100)))[1]; |
|
[cpu,67.484,gc,0,memory,3535280544,real,67.4844] |
|
@end example |
|
|
|
: 2 x m 画;(Lauricella FD)ゃ宴若 tk_fd с筝荐膈 |
|
荐膊с. |
|
絎膀蚊違違紕罸莠, debug . |
|
@example |
[3080] import("tk_fd.rr"); |
[3080] import("tk_fd.rr"); |
[3081] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3081] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[-4,[-4,-3],-1] // 2変数 FD のパラメータ. a,[b1,b2],c |
[-4,[-4,-3],-1] // 2紊 FD <若. a,[b1,b2],c |
[3082] tk_fd.fd_hessian2(A[0],A[1],A[2],[1/2,1/3]); |
[3082] tk_fd.fd_hessian2(A[0],A[1],A[2],[1/2,1/3]); |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[4483/124416,[ 1961/15552 185/1728 ], |
[4483/124416,[ 1961/15552 185/1728 ], |
[ 79/288 259/864 ] |
[ 79/288 259/864 ] |
[ 259/864 47/288 ]] |
[ 259/864 47/288 ]] |
// 戻値は [F=F_D, gradient(F), Hessian(F)] |
// 糸ゃ [F=F_D, gradient(F), Hessian(F)] |
|
|
// ekn_gt での例と同じパラメータ. |
// ekn_gt с箴<若. |
[3543] A=tk_fd.marginal2abc([5,1],[3,3]); |
[3543] A=tk_fd.marginal2abc([5,1],[3,3]); |
[-5,[-3],-1] |
[-5,[-3],-1] |
[3544] tk_fd.fd_hessian2(A[0],A[1],A[2],[(1/3)*(1/7)/((1/2)*(1/5))]); |
[3544] tk_fd.fd_hessian2(A[0],A[1],A[2],[(1/3)*(1/7)/((1/2)*(1/5))]); |
Line 242 Computing Dmat(ca) for parameters B=[-3],X=[ 10/21 ] |
|
Line 312 Computing Dmat(ca) for parameters B=[-3],X=[ 10/21 ] |
|
[775/27783,[ 20/147 ],[ 17/42 ]] |
[775/27783,[ 20/147 ],[ 17/42 ]] |
@end example |
@end example |
|
|
参考: 一般の A 分布の正規化定数についての Hessian の計算は実験的 package ot_hessian_ahg.rr |
: 筝 A 絽罩h絎違ゃ Hessian 荐膊絎薑 package ot_hessian_ahg.rr |
で実装のテストがされている. (これはまだ未完成のテスト版なので出力形式等も将来的には変更される.) |
у茖鴻. (障絎鴻у阪綵√靁絨ョ紊眼.) |
@example |
@example |
import("ot_hgm_ahg.rr"); |
import("ot_hgm_ahg.rr"); |
import("ot_hessian_ahg.rr"); |
import("ot_hessian_ahg.rr"); |
|
|
[(b1^2+(-2*b0-1)*b1+b0^2+b0)/(x0^2),[]],[(x6)/(x0),[6,0]],[(x4)/(x0),[4,0]]] |
[(b1^2+(-2*b0-1)*b1+b0^2+b0)/(x0^2),[]],[(x6)/(x0),[6,0]],[(x4)/(x0),[4,0]]] |
@end example |
@end example |
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.setup} |
@ref{gtt_ekn3.setup} |
@ref{gtt_ekn.pfaffian_basis} |
@ref{gtt_ekn3.pfaffian_basis} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
この関数は |
∽違 |
[GM2016] のアルゴリズムおよび |
[GM2016] ≪眼冴 |
[T2016] による modular method を用いた高速化を実装したものである. |
[T2016] modular method 蕭, |
|
[TGKT] 蕭絎茖с. |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, gtt_ekn/ekn_pfaffian_8.rr |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, gtt_ekn/ekn_pfaffian_8.rr |
|
@item |
|
interval option ゃ紊眼<ゃ |
|
OpenXM/src/asir-contrib/packages/src/gtt_ekn3/ekn_eval.rr 1.6 |
@end itemize |
@end itemize |
|
|
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@node gtt_ekn.nc,,, 超幾何関数E(k,n) |
@node gtt_ekn3.nc,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.nc} |
@subsection @code{gtt_ekn3.nc} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.nc |
@findex gtt_ekn3.nc |
|
|
@table @t |
@table @t |
@item gtt_ekn.nc(@var{beta},@var{p}) |
@item gtt_ekn3.nc(@var{beta},@var{p}) |
:: 周辺和 @var{beta}, セルの確率 @var{p} の二元分割表の条件付き確率の正規化定数 Z |
:: 莨阪 @var{beta}, 祉腆榊 @var{p} 篋画;>散篁腆榊罩h絎 Z |
およびその微分の値を戻す. |
潟緇ゃ祉. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return |
@item return |
ベクトル [Z,[[d_11 Z, d_12 Z, ...], ..., [d_m1 Z, d_m2 Z, ...., d_mn Z]]] |
[Z,[[d_11 Z, d_12 Z, ...], ..., [d_m1 Z, d_m2 Z, ...., d_mn Z]]] |
@item beta |
@item beta |
行和, 列和のリスト. 成分はすべて正であること. |
茵, 鴻. 鴻罩cс. |
@item p |
@item p |
二元分割表のセルの確率のリスト |
篋画;祉腆榊鴻 |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
r1 x r2 分割表を考える. |
r1 x r2 画;. |
m=r1, n=r2 とおく. |
m=r1, n=r2 . |
正規化定数 Z は分割表 u を m × n 行列とするとき p^u/u! の和である. |
罩h絎 Z 画; u m n 茵 p^u/u! с. |
ここで和は行和列和が @var{beta} であるような u 全体でとる |
у茵 @var{beta} с u 篏с |
[TKT2015], [GM2016]. |
[TKT2015], [GM2016]. |
p^u は p_ij^u_ij の積, u! は u_ij! の積である. |
p^u p_ij^u_ij 腥, u! u_ij! 腥с. |
d_ij Z で Z の変数 p_ij についての偏微分を表す. |
d_ij Z Z 紊 p_ij ゃ鏅茵. |
@item |
@item |
nc は gmvector の値を元に, [GM2016] の Prop |
nc gmvector ゃ, [GM2016] Prop |
7.1 に基づいて Z の値を計算する. |
7.1 冴ャ Z ゃ荐膊. |
@item |
@item |
option crt=1 (crt = Chinese remainder theorem) を与えると, 分散計算をおこなう. |
option crt=1 (crt = Chinese remainder theorem) 筝, h膊. |
分散計算用の各種パラメータの設定は |
h膊腮<若帥荐絎 |
gtt_ekn.setup で行なう. |
gtt_ekn3.setup ц. |
|
篁 option gmvector . |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: 2x3 分割表での Z とその微分の計算. |
箴: 2x3 画;с Z 緇荐膊. |
@example |
@example |
[2237] gtt_ekn.nc([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[2237] gtt_ekn3.nc([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[4483/124416,[ 353/7776 1961/15552 185/1728 ] |
[4483/124416,[ 353/7776 1961/15552 185/1728 ] |
[ 553/20736 1261/15552 1001/13824 ]] |
[ 553/20736 1261/15552 1001/13824 ]] |
@end example |
@end example |
|
|
参考: 2 x m 分割表(Lauricella FD)についてはパッケージ tk_fd でも下記のように同等な |
: 2 x m 画;(Lauricella FD)ゃ宴若 tk_fd с筝荐膈 |
計算ができる. |
荐膊с. |
@example |
@example |
[3076] import("tk_fd.rr"); |
[3076] import("tk_fd.rr"); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
Line 357 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Line 432 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[4483/124416,[[353/7776,1961/15552,185/1728], |
[4483/124416,[[353/7776,1961/15552,185/1728], |
[553/20736,1261/15552,1001/13824]]] |
[553/20736,1261/15552,1001/13824]]] |
// 戻値は [Z, [[d_11 Z, d_12 Z, d_13 Z], |
// 糸ゃ [Z, [[d_11 Z, d_12 Z, d_13 Z], |
// [d_21 Z, d_22 Z, d_23 Z]]] の値. |
// [d_21 Z, d_22 Z, d_23 Z]]] . |
// ここで d_ij は i,j 成分についての微分を表す. |
// d_ij i,j ゃ緇茵. |
@end example |
@end example |
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.setup} |
@ref{gtt_ekn3.setup} |
@ref{gtt_ekn.lognc} |
@ref{gtt_ekn3.lognc} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, gtt_ekn/ekn_eval.rr |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, gtt_ekn/ekn_eval.rr |
@end itemize |
@end itemize |
|
|
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@node gtt_ekn.lognc,,, 超幾何関数E(k,n) |
@node gtt_ekn3.lognc,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.lognc} |
@subsection @code{gtt_ekn3.lognc} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.lognc |
@findex gtt_ekn3.lognc |
|
|
@table @t |
@table @t |
@item gtt_ekn.lognc(@var{beta},@var{p}) |
@item gtt_ekn3.lognc(@var{beta},@var{p}) |
:: 周辺和 @var{beta}, セルの確率 @var{p} の二元分割表の条件付き確率の正規化定数 Z |
:: 莨阪 @var{beta}, 祉腆榊 @var{p} 篋画;>散篁腆榊罩h絎 Z |
の log の近似値およびその微分の近似値を戻す. |
log 菴篌弱ゃ潟緇菴篌弱ゃ祉. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return |
@item return |
ベクトル [log(Z), [[d_11 log(Z), d_12 log(Z), ...], [d_21 log(Z),...], ... ] |
[log(Z), [[d_11 log(Z), d_12 log(Z), ...], [d_21 log(Z),...], ... ] |
@item beta |
@item beta |
行和, 列和のリスト. 成分はすべて正であること. |
茵, 鴻. 鴻罩cс. |
@item p |
@item p |
二元分割表のセルの確率のリスト |
篋画;祉腆榊鴻 |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
条件付き最尤推定に利用する [TKT2015]. |
>散篁絨ゆィ絎 [TKT2015]. |
@item option crt=1 (crt = Chinese remainder theorem) を与えると, 分散計算をおこなう. |
@item option crt=1 (crt = Chinese remainder theorem) 筝, h膊. |
分散計算用の各種パラメータの設定は |
h膊腮<若帥荐絎 |
gtt_ekn.setup で行なう. |
gtt_ekn3.setup ц. |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: 2 × 3 分割表での例. 第一成分のみ近似値. |
箴: 2 3 画;с箴. 膃筝粋篌弱. |
@example |
@example |
[2238] gtt_ekn.lognc([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[2238] gtt_ekn3.lognc([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[-3.32333832422461674630,[ 5648/4483 15688/4483 13320/4483 ] |
[-3.32333832422461674630,[ 5648/4483 15688/4483 13320/4483 ] |
[ 3318/4483 10088/4483 9009/4483 ]] |
[ 3318/4483 10088/4483 9009/4483 ]] |
@end example |
@end example |
|
|
参考: 2 x m 分割表(Lauricella FD)についてはパッケージ tk_fd でも下記のように同等な |
: 2 x m 画;(Lauricella FD)ゃ宴若 tk_fd с筝荐膈 |
計算ができる. |
荐膊с. |
@example |
@example |
[3076] import("tk_fd.rr"); |
[3076] import("tk_fd.rr"); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
Line 433 Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/ |
|
Line 508 Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/ |
|
[-3.32333832422461674639485797719209322217260539267246045320, |
[-3.32333832422461674639485797719209322217260539267246045320, |
[[1.2598706, 3.499442, 2.971224], |
[[1.2598706, 3.499442, 2.971224], |
[0.7401293, 2.250278, 2.009591]]] |
[0.7401293, 2.250278, 2.009591]]] |
// 戻値は [log(Z), |
// 糸ゃ [log(Z), |
// [[d_11 log(Z), d_12 log(Z), d_13 log(Z)], |
// [[d_11 log(Z), d_12 log(Z), d_13 log(Z)], |
// [d_21 log(Z), d_22 log(Z), d_23 log(Z)]]] |
// [d_21 log(Z), d_22 log(Z), d_23 log(Z)]]] |
// の近似値. |
// 菴篌弱. |
@end example |
@end example |
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.setup} |
@ref{gtt_ekn3.setup} |
@ref{gtt_ekn.nc} |
@ref{gtt_ekn3.nc} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1. |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1. |
@end itemize |
@end itemize |
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@node gtt_ekn.expectation,,, 超幾何関数E(k,n) |
@node gtt_ekn3.expectation,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.expectation} |
@subsection @code{gtt_ekn3.expectation} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.expectation |
@findex gtt_ekn3.expectation |
|
|
@table @t |
@table @t |
@item gtt_ekn.expectation(@var{beta},@var{p}) |
@item gtt_ekn3.expectation(@var{beta},@var{p}) |
:: 周辺和 @var{beta}, セルの確率 @var{p} の二元分割表の期待値を計算する. |
:: 莨阪 @var{beta}, 祉腆榊 @var{p} 篋画;緇ゃ荐膊. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return |
@item return |
二元分割表の各セルの期待値のリスト. |
篋画;祉緇ゃ鴻. |
@item beta |
@item beta |
行和, 列和のリスト. 成分はすべて正であること. |
茵, 鴻. 鴻罩cс. |
@item p |
@item p |
二元分割表のセルの確率のリスト |
篋画;祉腆榊鴻 |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
[GM2016] の Algorithm 7.8 の実装. |
[GM2016] Algorithm 7.8 絎茖. [TGKT] 蕭 (path=3) 若. |
@item option crt=1 (crt = Chinese remainder theorem) を与えると, 分散計算をおこなう. |
@item option crt=1 (crt = Chinese remainder theorem) 筝, h膊. |
分散計算用の各種パラメータの設定は |
h膊腮<若帥荐絎 |
gtt_ekn.setup で行なう. |
gtt_ekn3.setup ц. |
@item option index を与えると, 指定された成分の期待値のみ計算する. |
@item option index 筝, 絎緇ゃ粋膊. |
たとえば 2 x 2 分割表で index=[[0,0],[1,1]] と指定すると, 1 のある成分の期待値のみ計算する. |
2 x 2 画; index=[[0,0],[1,1]] 絎, 1 緇ゃ粋膊. |
|
@item 篁 option gmvector . |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
|
|
2×2, 3×3 の分割表の期待値計算例. |
22, 33 画;緇よ膊箴. |
@example |
@example |
[2235] gtt_ekn.expectation([[1,4],[2,3]],[[1,1/3],[1,1]]); |
[2235] gtt_ekn3.expectation([[1,4],[2,3]],[[1,1/3],[1,1]]); |
[ 2/3 1/3 ] |
[ 2/3 1/3 ] |
[ 4/3 8/3 ] |
[ 4/3 8/3 ] |
[2236] gtt_ekn.expectation([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[2236] gtt_ekn3.expectation([[4,5],[2,4,3]],[[1,1/2,1/3],[1,1,1]]); |
[ 5648/4483 7844/4483 4440/4483 ] |
[ 5648/4483 7844/4483 4440/4483 ] |
[ 3318/4483 10088/4483 9009/4483 ] |
[ 3318/4483 10088/4483 9009/4483 ] |
|
|
[2442] gtt_ekn.expectation([[4,14,9],[11,6,10]],[[1,1/2,1/3],[1,1/5,1/7],[1,1,1]]); |
[2442] gtt_ekn3.expectation([[4,14,9],[11,6,10]],[[1,1/2,1/3],[1,1/5,1/7],[1,1,1]]); |
[ 207017568232262040/147000422096729819 163140751505489940/147000422096729819 |
[ 207017568232262040/147000422096729819 163140751505489940/147000422096729819 |
217843368649167296/147000422096729819 ] |
217843368649167296/147000422096729819 ] |
[ 1185482401011137878/147000422096729819 358095302885438604/147000422096729819 |
[ 1185482401011137878/147000422096729819 358095302885438604/147000422096729819 |
Line 509 gtt_ekn.setup で行なう. |
|
Line 585 gtt_ekn.setup で行なう. |
|
737732646860489910/147000422096729819 ] |
737732646860489910/147000422096729819 ] |
@end example |
@end example |
|
|
参考: 2 x m 分割表(Lauricella FD)についてはパッケージ tk_fd でも下記のように同等な |
: 2 x m 画;(Lauricella FD)ゃ宴若 tk_fd с筝荐膈 |
計算ができる. |
荐膊с. |
@example |
@example |
[3076] import("tk_fd.rr"); |
[3076] import("tk_fd.rr"); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
Line 521 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Line 597 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[[5648/4483,7844/4483,4440/4483], |
[[5648/4483,7844/4483,4440/4483], |
[3318/4483,10088/4483,9009/4483]] |
[3318/4483,10088/4483,9009/4483]] |
// 各セルの期待値. |
// 祉緇. |
@end example |
@end example |
|
|
参考: 一般の A 分布の計算は ot_hgm_ahg.rr. まだ実験的なため, module 化されていない. |
: 筝 A 絽荐膊 ot_hgm_ahg.rr. 障絎薑, module . |
ot_hgm_ahg.rr についての参考文献: |
ot_hgm_ahg.rr ゃ: |
K.Ohara, N.Takayama, Pfaffian Systems of A-Hypergeometric Systems II --- Holonomic Gradient Method, arxiv:1505.02947 |
K.Ohara, N.Takayama, Pfaffian Systems of A-Hypergeometric Systems II --- Holonomic Gradient Method, arxiv:1505.02947 |
@example |
@example |
[3237] import("ot_hgm_ahg.rr"); |
[3237] import("ot_hgm_ahg.rr"); |
// 2 x 2 分割表. |
// 2 x 2 画;. |
[3238] hgm_ahg_expected_values_contiguity([[0,0,1,1],[1,0,1,0],[0,1,0,1]], |
[3238] hgm_ahg_expected_values_contiguity([[0,0,1,1],[1,0,1,0],[0,1,0,1]], |
[9,6,8],[1/2,1/3,1/5,1/7],[x1,x2,x3,x4]|geometric=1); |
[9,6,8],[1/2,1/3,1/5,1/7],[x1,x2,x3,x4]|geometric=1); |
oohg_native=0, oohg_curl=1 |
oohg_native=0, oohg_curl=1 |
[1376777025/625400597,1750225960/625400597, |
[1376777025/625400597,1750225960/625400597, |
2375626557/625400597,3252978816/625400597] |
2375626557/625400597,3252978816/625400597] |
// 2 x 2 分割表の期待値. |
// 2 x 2 画;緇. |
|
|
// 2 x 3 分割表. |
// 2 x 3 画;. |
[3238] hgm_ahg_expected_values_contiguity( |
[3238] hgm_ahg_expected_values_contiguity( |
[[0,0,0,1,1,1],[1,0,0,1,0,0],[0,1,0,0,1,0],[0,0,1,0,0,1]], |
[[0,0,0,1,1,1],[1,0,0,1,0,0],[0,1,0,0,1,0],[0,0,1,0,0,1]], |
[5,2,4,3],[1,1/2,1/3,1,1,1],[x1,x2,x3,x4,x5,x6]|geometric=1); |
[5,2,4,3],[1,1/2,1/3,1,1,1],[x1,x2,x3,x4,x5,x6]|geometric=1); |
[5648/4483,7844/4483,4440/4483,3318/4483,10088/4483,9009/4483] |
[5648/4483,7844/4483,4440/4483,3318/4483,10088/4483,9009/4483] |
// 2 x 3 分割表の期待値. 上と同じ問題. |
// 2 x 3 画;緇. 筝馹. |
@end example |
@end example |
|
|
3 x 3 分割表. 構造的0が一つ. |
3 x 3 画;. 罕0筝. |
@example |
@example |
/* |
/* |
dojo, p.221 のデータ. 成績3以下の生徒は集めてひとつに. |
dojo, p.221 若. 膰3篁ヤ緇蚊ゃ. |
2 1 1 |
2 1 1 |
8 3 3 |
8 3 3 |
0 2 6 |
0 2 6 |
|
|
row sum: 4,14,8 |
row sum: 4,14,8 |
column sum: 10,6,10 |
column sum: 10,6,10 |
0 を一つ含むので, (3,6) 型の A から 7 列目を抜く. |
0 筝ゅ, (3,6) A 7 . |
*/ |
*/ |
|
|
A=[[0,0,0,1,1,1, 0,0], |
A=[[0,0,0,1,1,1, 0,0], |
Line 565 A=[[0,0,0,1,1,1, 0,0], |
|
Line 641 A=[[0,0,0,1,1,1, 0,0], |
|
[0,0,1,0,0,1, 0,1]]; |
[0,0,1,0,0,1, 0,1]]; |
B=[14,8,10,6,10]; |
B=[14,8,10,6,10]; |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1], |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1], |
[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
|
|
// 答. |
// 膈. |
[14449864949304/9556267369631, |
[14449864949304/9556267369631, |
10262588586540/9556267369631, 13512615942680/9556267369631, |
10262588586540/9556267369631, 13512615942680/9556267369631, |
81112808747006/9556267369631, |
81112808747006/9556267369631, |
Line 576 hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/ |
|
Line 652 hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/ |
|
25258717886900/9556267369631,51191421070148/9556267369631] |
25258717886900/9556267369631,51191421070148/9556267369631] |
@end example |
@end example |
|
|
3 x 3 分割表. |
3 x 3 画;. |
@example |
@example |
/* |
/* |
上のデータで 0 を 1 に変更. |
筝若帥 0 1 紊. |
2 1 1 |
2 1 1 |
8 3 3 |
8 3 3 |
1 2 6 |
1 2 6 |
Line 596 B=[14,9,11,6,10]; |
|
Line 672 B=[14,9,11,6,10]; |
|
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1,1], |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1,1], |
[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
|
|
// 期待値, 答. x9 を指定していないので, 9番目の期待値は出力してない. |
// 緇, 膈. x9 絎, 9緇ゃ阪. |
[207017568232262040/147000422096729819, |
[207017568232262040/147000422096729819, |
163140751505489940/147000422096729819,217843368649167296/147000422096729819, |
163140751505489940/147000422096729819,217843368649167296/147000422096729819, |
1185482401011137878/147000422096729819, |
1185482401011137878/147000422096729819, |
358095302885438604/147000422096729819,514428205457640984/147000422096729819, |
358095302885438604/147000422096729819,514428205457640984/147000422096729819, |
224504673820628091/147000422096729819,360766478189450370/147000422096729819] |
224504673820628091/147000422096729819,360766478189450370/147000422096729819] |
|
|
// Z やその微分の計算は hgm_ahg_contiguity 関数がおこなうが, これの簡易インターフェースは |
// Z 緇荐膊 hgm_ahg_contiguity ∽違, 膂≧ゃ潟帥若с若鴻 |
// まだ書いてない. |
// 障吾. |
@end example |
@end example |
|
|
|
|
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.setup} |
@ref{gtt_ekn3.setup} |
@ref{gtt_ekn.nc} |
@ref{gtt_ekn3.nc} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1. |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1. |
@end itemize |
@end itemize |
|
|
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@comment --- ◯◯◯◯ の説明 |
@comment --- 茯 |
@comment --- 個々の関数の説明の開始 --- |
@comment --- ∽違茯紮 --- |
@comment --- section 名を正確に --- |
@comment --- section 罩g∈ --- |
@node gtt_ekn.setup,,, 超幾何関数E(k,n) |
@node gtt_ekn3.setup,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.setup} |
@subsection @code{gtt_ekn3.setup} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.setup |
@findex gtt_ekn3.setup |
|
|
@table @t |
@table @t |
@item gtt_ekn.setup() |
@item gtt_ekn3.setup() |
:: 分散計算用の環境設定をおこなう. 現在の環境を報告する. |
:: h膊医荐絎. 憜医怨. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return |
@item return |
|
|
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item 使用するプロセスと素数の個数, 最小の素数を表示する. 準備されていない場合はその旨を表示. |
@item 篏睡祉鴻膣違, 絨膣違茵腓冴. 羣翫茵腓. |
@item このパッケージでの分散計算は複数のcpuを搭載した計算機で実行されることを想定している. |
@item 宴若吾сh膊茲違cpu莠荐膊罘у茵喝. |
@item option nps (または number_of_processes)を与えると指定した数だけプロセスを用意する. |
@item option nps (障 number_of_processes)筝絎違祉鴻. |
@item option nprm (または number_of_primes)を与えるとnprmが文字列の場合指定された素数リストのファイルを読み込む. nprmが自然数の場合さらにoption minp (minp =MINimum Prime)を与えるとminpより大きな素数をnprm個生成する. その際option fgp (または file_of_generated_primes)を与えると生成した素数リストをファイル名をfgpとして保存する. |
@item option nprm (障 number_of_primes)筝nprm絖翫絎膣違鴻<ゃ茯粋昭. nprm倶違翫option minp (minp =MINimum Prime)筝minp紊с膣違nprm. option fgp (障 file_of_generated_primes)筝膣違鴻<ゃfgp篆絖. |
@item 上記のoption を指定しなかった場合次のデフォルト値が用いられる. nps=1. nprm=10. fgp=0. |
@item 筝荐option 絎c翫罨<ゃ. nps=1. nprm=10. fgp=0. |
@item option report=1を与えると現在の環境の報告のみを行う. setup(|report=1)の別名としてreport関数を使用することもできる. |
@item option report=1筝憜医怨帥茵. setup(|report=1)ュreport∽違篏睡с. |
@item option subprogs=[file1,file2,...] により分散計算の子供プロセスにロードすべきファイル file1, file2, ... を指定する. default は subprogs=["gtt_ekn/childprocess.rr"] である. |
@item option subprogs=[file1,file2,...] h膊絖箴祉鴻若鴻<ゃ file1, file2, ... 絎. default subprogs=["gtt_ekn3/childprocess.rr"] с. |
|
@item gtt_ekn3.set_debug_level(Mode) Ekn_debug ゃ荐絎. |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: 素数のリストを生成してファイル p.txt へ書き出す. |
箴: 膣違鴻<ゃ p.txt 御吾冴. |
@example |
@example |
gtt_ekn.setup(|nps=2,nprm=20,minp=10^10,fgp="p.txt")$ |
gtt_ekn3.setup(|nps=2,nprm=20,minp=10^10,fgp="p.txt")$ |
@end example |
@end example |
|
|
|
箴: chinese remainder theorem (crt) 篏帥c gmvector 荐膊. |
|
@example |
|
[2867] gtt_ekn3.setup(|nprm=20,minp=10^20); |
|
[2868] N=2; T2=gtt_ekn3.gmvector([[36*N,13*N-1],[38*N-1,11*N]], |
|
[[1,(1-1/N)/56],[1,1]] | crt=1)$ |
|
@end example |
|
|
@comment --- 参照(リンク)を書く --- |
|
|
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.nc} |
@ref{gtt_ekn3.nc} |
@ref{gtt_ekn.gmvector} |
@ref{gtt_ekn3.gmvector} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, |
OpenXM/src/asir-contrib/packages/src/gtt_ekn.rr 1.1, |
gtt_ekn/g_mat_fac.rr |
gtt_ekn/g_mat_fac.rr |
|
|
@end itemize |
@end itemize |
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@comment --- ◯◯◯◯ の説明 |
@comment --- 茯 |
@comment --- 個々の関数の説明の開始 --- |
@comment --- ∽違茯紮 --- |
@comment --- section 名を正確に --- |
@comment --- section 罩g∈ --- |
@node gtt_ekn.upAlpha,,, 超幾何関数E(k,n) |
@node gtt_ekn3.upAlpha,,, 莇綛鞘∽E(k,n) |
@subsection @code{gtt_ekn.upAlpha} |
@node gtt_ekn3.downAlpha,,, 莇綛鞘∽E(k,n) |
@comment --- 索引用キーワード |
@subsection @code{gtt_ekn3.upAlpha}, @code{gtt_ekn3.downAlpha} |
@findex gtt_ekn.upAlpha |
@comment --- 膣√若若 |
|
@findex gtt_ekn3.upAlpha |
|
@findex gtt_ekn3.downAlpha |
|
|
@table @t |
@table @t |
@item gtt_ekn.upAlpha(@var{i},@var{k},@var{n}) |
@item gtt_ekn3.upAlpha(@var{i},@var{k},@var{n}) |
|
@item gtt_ekn3.downAlpha(@var{i},@var{k},@var{n}) |
:: |
:: |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item i a_i を a_i+1 と変化させる contiguity relation. |
@item i a_i a_i+1 (a_i a_i-1) 紊 contiguity relation. |
@item k E(k+1,n+k+2)型の超幾何関数の k. 分割表では (k+1)×(n+1). |
@item k E(k+1,n+k+2)莇綛鞘∽違 k. 画;с (k+1)(n+1). |
@item n E(k+1,n+k+2)型の超幾何関数の n. 分割表では (k+1)×(n+1). |
@item n E(k+1,n+k+2)莇綛鞘∽違 n. 画;с (k+1)(n+1). |
@item return contiguity relation の pfaffian_basis についての行列表現を戻す. [GM2016] の Cor 6.3. |
@item return contiguity relation pfaffian_basis ゃ茵茵憗祉. [GM2016] Cor 6.3. |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
upAlpha は [GM2016] の Cor 6.3 の行列 U_i を戻す. |
upAlpha [GM2016] Cor 6.3 茵 U_i 祉. |
@item 関連する各関数の簡潔な説明と例も加える. |
@item ∫c∽違膂≧茯箴. |
@item a_i を a_i-1 と変化させたい場合は関数 downAlpha を用いる. |
@item a_i a_i-1 紊翫∽ downAlpha . |
@item a_i と分割表の周辺和を見るには, 関数 marginaltoAlpha([行和,列和]) を用いる. |
@item a_i 画;莨阪荀, ∽ marginaltoAlpha([茵,]) . |
@item |
@item |
pfaffian_basis は [GM2016] の4章のベクトル F に対応する偏微分を戻す. |
pfaffian_basis [GM2016] 鐚腴 F 絲上鏅祉. |
|
@item optional 綣 arule, xrule a_i x_i_j 違合羆с. 紊<若帥違障c鴻取;腓冴. a_0 у>散茯炊眼ф絵(Todo, double check). |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: 以下の例は 2×2分割表(E(2,4)), 2×3分割表(E(2,5))の場合である. |
箴: 篁ヤ箴 22画;(E(2,4)), 23画;(E(2,5))翫с. |
[2225] までは出力を略している. |
[2225] 障с阪ャ. |
@example |
@example |
[2221] gtt_ekn.marginaltoAlpha([[1,4],[2,3]]); |
[2221] gtt_ekn3.marginaltoAlpha([[1,4],[2,3]]); |
[[a_0,-4],[a_1,-1],[a_2,3],[a_3,2]] |
[[a_0,-4],[a_1,-1],[a_2,3],[a_3,2]] |
[2222] gtt_ekn.upAlpha(1,1,1); // E(2,4) の a_1 方向の |
[2222] gtt_ekn3.upAlpha(1,1,1); // E(2,4) a_1 劫 |
// contiguity を表現する行列 |
// contiguity 茵憗茵 |
[2223] gtt_ekn.upAlpha(2,1,1); // E(2,4) の a_2 方向 |
[2223] gtt_ekn3.upAlpha(2,1,1); // E(2,4) a_2 劫 |
[2224] gtt_ekn.upAlpha(3,1,1); // E(2,4) の a_3 方向 |
[2224] gtt_ekn3.upAlpha(3,1,1); // E(2,4) a_3 劫 |
[2225] function f(x_1_1); |
[2225] function f(x_1_1); |
[2232] gtt_ekn.pfaffian_basis(f(x_1_1),1,1); |
[2232] gtt_ekn3.pfaffian_basis(f(x_1_1),1,1); |
[ f(x_1_1) ] |
[ f(x_1_1) ] |
[ (f{1}(x_1_1)*x_1_1)/(a_2) ] |
[ (f{1}(x_1_1)*x_1_1)/(a_2) ] |
[2233] function f(x_1_1,x_1_2); |
[2233] function f(x_1_1,x_1_2); |
f() redefined. |
f() redefined. |
[2234] gtt_ekn.pfaffian_basis(f(x_1_1,x_1_2),1,2); // E(2,5), 2*3 分割表 |
[2234] gtt_ekn3.pfaffian_basis(f(x_1_1,x_1_2),1,2); // E(2,5), 2*3 画; |
[ f(x_1_1,x_1_2) ] |
[ f(x_1_1,x_1_2) ] |
[ (f{1,0}(x_1_1,x_1_2)*x_1_1)/(a_2) ] |
[ (f{1,0}(x_1_1,x_1_2)*x_1_1)/(a_2) ] |
[ (f{0,1}(x_1_1,x_1_2)*x_1_2)/(a_3) ] |
[ (f{0,1}(x_1_1,x_1_2)*x_1_2)/(a_3) ] |
|
|
|
[2235] RuleA=[[a_2,1/3],[a_3,1/2]]$ RuleX=[[x_1_1,1/5]]$ |
|
base_replace(gtt_ekn3.upAlpha(1,1,1),append(RuleA,RuleX)) |
|
-gtt_ekn3.upAlpha(1,1,1 | arule=RuleA, xrule=RuleX); |
|
|
|
[ 0 0 ] |
|
[ 0 0 ] |
|
|
@end example |
@end example |
|
|
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.nc} |
@ref{gtt_ekn3.nc} |
@ref{gtt_ekn.gmvector} |
@ref{gtt_ekn3.gmvector} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
この関数は [GM2016] |
∽違 [GM2016] |
で与えられたアルゴリズムに従い contiguity relation を導出する. |
т≪眼冴緇 contiguity relation 絨冴. |
@item |
@item |
変更を受けたファイルは |
紊眼<ゃ |
OpenXM/src/asir-contrib/packages/src/gtt_ekn/ekn_pfaffian_8.rr 1.1. |
OpenXM/src/asir-contrib/packages/src/gtt_ekn/ekn_pfaffian_8.rr 1.1. |
@end itemize |
@end itemize |
|
|
|
|
@node modular計算,,, 2元分割表HGMの関数 |
@comment ********************************************************** |
@chapter modular計算 |
@comment --- 茯 |
|
@comment --- ∽違茯紮 --- |
|
@comment --- section 罩g∈ --- |
|
@node gtt_ekn3.cmle,,, 莇綛鞘∽E(k,n) |
|
@subsection @code{gtt_ekn3.cmle} |
|
@comment --- 膣√若若 |
|
@findex gtt_ekn3.cmle |
|
|
|
@table @t |
|
@item gtt_ekn3.cmle(@var{u}) u 荀恰謙若帥, P(U=u | row sum, column sum = these of U) 紊у, 祉腆榊菴篌弱ゃ羆. |
|
:: |
|
@end table |
|
|
|
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
|
@table @var |
|
@item u 荀恰謙若(画;) |
|
@item return 祉腆榊(画;綵√) |
|
@end table |
|
|
|
@comment --- ч∽違荅潟茯 --- |
|
@comment --- @itemize@end itemize 膊≧吾 --- |
|
@comment --- @bullet 藥剛 --- |
|
@itemize @bullet |
|
@item u 荀恰謙若帥, P(U=u | row sum, column sum = these of U) 紊у, 祉腆榊菴篌弱ゃ羆. |
|
@item optional parameter algorithm (井違菴篌若, 罸絖絨違, gradient descent step綛)茯炊眼鴻, 篏罐筝. 2017.03.03 |
|
@end itemize |
|
|
|
@comment --- @example@end example 絎茵箴茵腓 --- |
|
箴: 2 x 4 画;. |
|
@example |
|
U=[[1,1,2,3],[1,3,1,1]]; |
|
gtt_ekn3.cmle(U); |
|
[[ 1 1 2 3 ] |
|
[ 1 3 1 1 ],[[7,6],[2,4,3,4]], // Data, row sum, column sum |
|
[ 1 67147/183792 120403/64148 48801/17869 ] // probability obtained. |
|
[ 1 1 1 1 ]] |
|
@end example |
|
|
|
箴: 筝箴罨<∽違. |
|
@example |
|
gtt_ekn3.cmle_test3(); |
|
@end example |
|
|
|
@comment --- (潟)吾 --- |
|
@table @t |
|
@item |
|
@ref{gtt_ekn3.expectation} |
|
@end table |
|
|
|
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
|
@noindent |
|
ChangeLog |
|
@itemize @bullet |
|
@item gtt_ekn3/mle.rr 篏. |
|
@item gtt_ekn3.rr cmle ∽違 wrapper. |
|
@end itemize |
|
@comment end cmle. |
|
|
|
@comment ********************************************************** |
|
@comment --- 茯 |
|
@comment --- ∽違茯紮 --- |
|
@comment --- section 罩g∈ --- |
|
@node gtt_ekn3.set_debug_level,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.contiguity_mat_list_2,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.show_path,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.get_svalue,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.assert1,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.assert2,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.assert3,,, 莇綛鞘∽E(k,n) |
|
@node gtt_ekn3.prob1,,, 莇綛鞘∽E(k,n) |
|
@subsection @code{gtt_ekn3.set_debug_level}, @code{gtt_ekn3.show_path}, @code{gtt_ekn3.get_svalue}, @code{gtt_ekn3.assert1}, @code{gtt_ekn3.assert2}, @code{gtt_ekn3.assert3}, @code{gtt_ekn3.prob1} |
|
@comment --- 膣√若若 |
|
@findex gtt_ekn3.set_debug_level |
|
@findex gtt_ekn3.contiguity_mat_list_2 |
|
@findex gtt_ekn3.show_path |
|
@findex gtt_ekn3.get_svalue |
|
@findex gtt_ekn3.assert1 |
|
@findex gtt_ekn3.assert2 |
|
@findex gtt_ekn3.assert3 |
|
@findex gtt_ekn3.prob1 |
|
|
|
@table @t |
|
@item gtt_ekn3.set_debug_level(@var{m}) debug <祉若吾荐絎. |
|
@item gtt_ekn3.contiguity_mat_list_2 篏睡 contiguity 罕. |
|
@item gtt_ekn3.show_path() contiguity . |
|
@item gtt_ekn3.get_svalue() static 紊違ゃ緇. |
|
@item gtt_ekn3.assert1(@var{N}) 2x2 画;у篏с. |
|
@item gtt_ekn3.assert2(@var{N}) 3x3 画;у篏с. |
|
@item gtt_ekn3.assert3(@var{R1}, @var{R2}, @var{Size}) R1 x R2 画;т研篏篏с. |
|
@item gtt_ekn3.prob1(@var{R1},@var{R2},@var{Size}) R1 x R2 画;鴻若帥篏. |
|
:: |
|
@end table |
|
|
|
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
|
@table @var |
|
@item m . |
|
@end table |
|
|
|
@comment --- ч∽違荅潟茯 --- |
|
@comment --- @itemize@end itemize 膊≧吾 --- |
|
@comment --- @bullet 藥剛 --- |
|
@itemize @bullet |
|
@item (@var{m} & 0x1) == 0x1 g_mat_fac_test_plain g_mat_fac_itor 筝≧鴻若喝冴ゃ罸莠 (gtt_ekn3.setup 倶). |
|
@item (@var{m} & 0x2) == 0x2 g_mat_fac_test 吾綣違 tmp-input-.ab 篆絖. |
|
@item (@var{m} & 0x4) == 0x4 matrix factorial 荐膊若喝冴綣違茵腓. |
|
@item @var{N} 馹莨阪泣ゃ. |
|
@item @code{get_svalue} 祉ゃ @code{[Ekn_plist,Ekn_IDL,Ekn_debug,Ekn_mesg,XRule,ARule,Verbose,Ekn_Rq]} . |
|
@item assert3 options: x=1, subprocess window 茵腓. nps=m, m 祉鴻 contiguity 羆 (contiguity_mat_list_3). crt, interval gmvector 演 |
|
option. timing data 茵腓冴 load("gtt_ekn3/ekn_eval-timing.rr"); . |
|
@end itemize |
|
|
|
@comment --- @example@end example 絎茵箴茵腓 --- |
|
箴. |
|
@example |
|
[2846] gtt_ekn3.set_debug_level(0x4); |
|
[2847] N=2; T2=gtt_ekn3.gmvector([[36*N,13*N-1],[38*N-1,11*N]], |
|
[[1,(1-1/N)/56],[1,1]])$ |
|
[2848] level&0x4: g_mat_fac_test([ 113/112 ] |
|
[ 1/112 ],[ (t+225/112)/(t^2+4*t+4) (111/112*t+111/112)/(t^2+4*t+4) ] |
|
[ (1/112)/(t^2+4*t+4) (111/112*t+111/112)/(t^2+4*t+4) ],0,20,1,t) |
|
Note: we do not use g_mat_fac_itor. Call gtt_ekn3.setup(); to use the crt option. |
|
level&0x4: g_mat_fac_test([ 67/62944040755546030080000 ] |
|
[ 1/125888081511092060160000 ],[ (t+24)/(t^2+25*t+46) (2442)/(t^2+25*t+46) ] |
|
[ (1)/(t^2+25*t+46) (-111*t-111)/(t^2+25*t+46) ],0,73,1,t) |
|
level&0x4: g_mat_fac_test ------ snip |
|
@end example |
|
|
|
箴. |
|
@example |
|
[2659] gtt_ekn3.nc([[4,5,6],[2,4,9]],[[1,1/2,1/3],[1,1/5,1/7],[1,1,1]])$ |
|
[2660] L=matrix_transpose(gtt_ekn3.show_path())$ |
|
[2661] L[2]; |
|
[2 1] |
|
@end example |
|
[2 1] index ゃ<若帥 alpha 劫 contigity 羆 |
|
荐膊. L[0] contiguity 茵. |
|
L[1] contiguity step . |
|
|
|
箴. ゃ荐膊 path 炊翫. |
|
@example |
|
A=gtt_ekn3.marginaltoAlpha_list([[400,410,1011],[910,411,500]])$ |
|
[2666] gtt_ekn3.contiguity_mat_list_2(A,2,2)$ |
|
[2667] L=matrix_transpose(gtt_ekn3.show_path())$ |
|
[2668] L[2]; |
|
[ 2 1 5 4 3 ] |
|
[2669] gtt_ekn3.contiguity_mat_list_3(A,2,2)$ // new alg in [TGKT] |
|
[2670] L=matrix_transpose(gtt_ekn3.show_path())$ |
|
[2671] L[2]; |
|
[2 1] // shorter |
|
@end example |
|
|
|
箴. ゃ荐膊 path 炊翫. |
|
gtt_ekn3 違≪眼冴 path 茵腓. |
|
@example |
|
A=gtt_ekn3.marginaltoAlpha_list([[10,20],[15,15]])$ |
|
[2666] gtt_ekn3.contiguity_mat_list_3(A,1,1 | xrule=[[x_1_1,1/2]])$ |
|
[t,[[ (-t-43/2)/(t-2) (-15/2)/(t-2) ] |
|
[ 1/2 -1/2 ],-9]] |
|
@end example |
|
|
|
箴. 0 祉 g_mat_fac_plain 絎荐膊号腟筝眼. |
|
option 吾 g_mat_fac_int 罸莠. |
|
@example |
|
[8859] gtt_ekn3.assert2(1); |
|
Marginal=[[130,170,353],[90,119,444]] |
|
P=[[17/100,1,10],[7/50,1,33/10],[1,1,1]] |
|
Try g_mat_fac_test_int: Note: we do not use g_mat_fac_itor. Call gtt_ekn3.setup(); to use the crt option. |
|
Timing (int) =0.413916 (CPU) + 0.590723 (GC) = 1.00464 (total), real time=0.990672 |
|
|
|
Try g_mat_fac_test_plain: Note: we do not use g_mat_fac_itor. Call gtt_ekn3.setup(); to use the crt option. |
|
Timing (rational) =4.51349 (CPU) + 6.32174 (GC) = 10.8352 (total) |
|
diff of both method = |
|
[ 0 0 0 ] |
|
[ 0 0 0 ] |
|
[ 0 0 0 ] |
|
[8860] |
|
|
|
[8863] gtt_ekn3.setup(|nprm=100,minp=10^50); |
|
Number of processes = 1. |
|
Number of primes = 100. |
|
Min of plist = 100000000000000000000000000000000000000000000000151. |
|
0 |
|
[8864] gtt_ekn3.assert2(1 | crt=1); |
|
Marginal=[[130,170,353],[90,119,444]] |
|
P=[[17/100,1,10],[7/50,1,33/10],[1,1,1]] |
|
Try [[crt,1]] |
|
---- snip |
|
@end example |
|
篋箴 timing (total) [箴с] mod 荐膊 subprocess cфcゃс. real time 荐膊絎. |
|
|
|
箴. |
|
@example |
|
3x5 画;. 莨阪 10 罸箴筝絎(factor option ≫. 純若鴻). |
|
cell 腆榊1/膣違х. |
|
@comment grep testnxn ekn/Prog2/*.rr ; grep test_nxn ekn/Prog2/*.rr 荀. |
|
[9054] L=gtt_ekn3.prob1(3,5,10 | factor=1, factor_row=3); |
|
[[[10,20,420],[30,60,90,120,150]],[[1,1/2,1/3,1/5,1/7],[1,1/11,1/13,1/17,1/19],[1,1,1,1,1]]] |
|
[9055] number_eval(gtt_ekn3.expectation(L[0],L[1])); |
|
[ 1.65224223218613 ... snip ] |
|
@end example |
|
|
|
箴: |
|
@example |
|
[5779] import("gtt_ekn3.rr"); load("gtt_ekn3/ekn_eval-timing.rr"); |
|
[5780] gtt_ekn3.assert3(5,5,100 | nps=32, interval=100); |
|
-- snip |
|
Parallel method: Number of process=32, File name tmp-gtt_ekn3/p300.txt is written. |
|
Number of processes = 32. |
|
-- snip |
|
initialPoly of path=3: [ 2.184 0 124341044 2.1831 ] [CPU(s),0,*,real(s)] |
|
contiguity_mat_list_3 of path=3: [ 0.04 0 630644 9.6774 ] [CPU(s),0,*,real(s)] |
|
Note: interval option will lead faster evaluation. We do not use g_mat_fac_itor (crt). Call gtt_ekn3.setup(); to use the crt option. |
|
g_mat_fac of path=3: [ 21.644 0 1863290168 21.6457 ] [CPU(s),0,*,real(s)] |
|
Done. Saved in 2.ab |
|
Diff (should be 0)=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,..., 0,0,0] |
|
@end example |
|
|
|
@comment --- (潟)吾 --- |
|
@table @t |
|
@item |
|
@ref{gtt_ekn3.nc} |
|
@end table |
|
|
|
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
|
@noindent |
|
ChangeLog |
|
@itemize @bullet |
|
@item gtt_ekn3/ekn_eval.rr matrix factorial 荐膊若喝冴綣違茵腓冴. |
|
@item grep 'iand(Ekn_debug,0x1)' *.rr с純若鴻潟若荅峨篏臀. |
|
@end itemize |
|
@comment end set_debug_level |
|
|
|
|
|
|
|
@node modular荐膊,,, Top |
|
@chapter modular荐膊 |
|
|
@menu |
@menu |
* gtt_ekn.chinese_itor:: |
* gtt_ekn3.chinese_itor:: |
@end menu |
@end menu |
|
|
@node 中国剰余定理とitor,,, modular計算 |
@node 筝遵遺絎itor,,, modular荐膊 |
@section 中国剰余定理とitor |
@section 筝遵遺絎itor |
|
|
@comment ********************************************************** |
@comment ********************************************************** |
@comment --- ◯◯◯◯ の説明 |
@comment --- 茯 |
@comment --- 個々の関数の説明の開始 --- |
@comment --- ∽違茯紮 --- |
@comment --- section 名を正確に --- |
@comment --- section 罩g∈ --- |
@node gtt_ekn.chinese_itor,,, |
@node gtt_ekn3.chinese_itor,,, |
@subsection @code{gtt_ekn.chinese_itor} |
@subsection @code{gtt_ekn3.chinese_itor} |
@comment --- 索引用キーワード |
@comment --- 膣√若若 |
@findex gtt_ekn.chinese_itor 中国剰余定理とitor |
@findex gtt_ekn3.chinese_itor 筝遵遺絎itor |
|
|
@table @t |
@table @t |
@item gtt_ekn.chinese_itor(@var{data},@var{idlist}) |
@item gtt_ekn3.chinese_itor(@var{data},@var{idlist}) |
:: mod p で計算した結果(ベクトル)から chinese remainder theorem, itor(integer to rational) で有理数ベクトルを得る. |
:: mod p ц膊腟() chinese remainder theorem, itor(integer to rational) ф違緇. |
@end table |
@end table |
|
|
@comment --- 引数の簡単な説明 --- 以下まだ書いてない. |
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
@table @var |
@table @var |
@item return [val, n] ここで val は答え. また, n = n1*n2*... |
@item return [val, n] val 膈. 障, n = n1*n2*... |
@item data [[val1,n1],[val2,n2], ...], ここで val mod n1 = val1, val mod n2 = val2,... |
@item data [[val1,n1],[val2,n2], ...], val mod n1 = val1, val mod n2 = val2,... |
@item idlist chinese, itor を実行するサーバIDのリスト. |
@item idlist chinese, itor 絎茵泣若ID鴻. |
@end table |
@end table |
|
|
@comment --- ここで関数の詳しい説明 --- |
@comment --- ч∽違荅潟茯 --- |
@comment --- @itemize〜@end itemize は箇条書き --- |
@comment --- @itemize@end itemize 膊≧吾 --- |
@comment --- @bullet は黒点付き --- |
@comment --- @bullet 藥剛 --- |
@itemize @bullet |
@itemize @bullet |
@item 中国剰余定理を用いて val0 mod n1 = val1, val0 mod n2 = val2, ... となる val0 を求める. val に algorithm itor を適用する. |
@item 筝遵遺絎 val0 mod n1 = val1, val0 mod n2 = val2, ... val0 羆. val algorithm itor . |
@item sqrt(n) より val0 が大きい時は itor が適用されて val0 が有理数 val=a/b に変換される. つまり b*x =1 mod n となる逆数 x を考えて, x*a % n = val0 となる数 val を戻す. 見つからないときは failure を戻す. |
@item sqrt(n) val0 紊с itor val0 val=a/b 紊. ゃ障 b*x =1 mod n x , x*a % n = val0 val 祉. 荀ゃ failure 祉. |
@end itemize |
@end itemize |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: [3!, 5^3*3!]=[6,750] が戻り値. |
箴: [3!, 5^3*3!]=[6,750] 祉. |
6 mod 109 =6, 750 mod 109=96 が最初の引数の [[6,96],109]. 以下同様. |
6 mod 109 =6, 750 mod 109=96 綣違 [[6,96],109]. 篁ヤ罕. |
@example |
@example |
gtt_ekn.setup(|nps=2,nprm=3,minp=101,fgp="p_small.txt"); |
gtt_ekn3.setup(|nps=2,nprm=3,minp=101,fgp="p_small.txt"); |
SS=gtt_ekn.get_svalue(); |
SS=gtt_ekn3.get_svalue(); |
SS[0]; |
SS[0]; |
[103,107,109] // list of primes |
[103,107,109] // list of primes |
SS[1]; |
SS[1]; |
[0,2] // list of server ID's |
[0,2] // list of server ID's |
gtt_ekn.chinese_itor([[[ 6,96 ],109],[[ 6,29 ],103],[[ 6,1 ],107]],SS[1]); |
gtt_ekn3.chinese_itor([[[ 6,96 ],109],[[ 6,29 ],103],[[ 6,1 ],107]],SS[1]); |
[[ 6 750 ],1201289] |
[[ 6 750 ],1201289] |
|
|
// 引数はスカラーでもよい. |
// 綣違鴻若с. |
gtt_ekn.chinese_itor([[96,109],[29,103]],SS[1]); |
gtt_ekn3.chinese_itor([[96,109],[29,103]],SS[1]); |
[[ 750 ],11227] |
[[ 750 ],11227] |
@end example |
@end example |
|
|
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: gtt_ekn/childprocess.rr (server で実行される) の関数 chinese (chinese remainder theorem) と euclid. |
箴: gtt_ekn3/childprocess.rr (server у茵) ∽ chinese (chinese remainder theorem) euclid. |
@example |
@example |
load("gtt_ekn/childprocess.rr"); |
load("gtt_ekn3/childprocess.rr"); |
chinese([newvect(2,[6,29]),103],[newvect(2,[6,750]),107*109]); |
chinese([newvect(2,[6,29]),103],[newvect(2,[6,750]),107*109]); |
// mod 103 で [6,29], mod (107*109) で [6,750] となる数を mod 103*(107*109) |
// mod 103 [6,29], mod (107*109) [6,750] 違 mod 103*(107*109) |
// で求めると, |
// ф, |
[[ 6 750 ],1201289] |
[[ 6 750 ],1201289] |
euclid(3,103); // mod 103 での 3 の逆数. つまり 1/3 |
euclid(3,103); // mod 103 с 3 . ゃ障 1/3 |
-34 |
-34 |
3*(-34) % 103; // 確かに逆数. |
3*(-34) % 103; // 腆冴. |
1 |
1 |
@end example |
@end example |
|
|
@comment --- @example〜@end example は実行例の表示 --- |
@comment --- @example@end example 絎茵箴茵腓 --- |
例: gtt_ekn/childprocess.rr (server で実行される) の関数 itor (integer to rational) の例. |
箴: gtt_ekn3/childprocess.rr (server у茵) ∽ itor (integer to rational) 箴. |
itor(Y,Q,Q2,Idx) では Y < Q2 なら Y がそのまま戻る. Idx は 内部用の index で好きな数でよい. 戻り値の第2成分となる. |
itor(Y,Q,Q2,Idx) с Y < Q2 Y 障丈祉. Idx index уソ違с. 祉ゃ膃鐚. |
@example |
@example |
load("gtt_ekn/childprocess.rr"); |
load("gtt_ekn3/childprocess.rr"); |
for (I=1;I<11; I++) print([I,itor(I,11,3,0)]); |
for (I=1;I<11; I++) print([I,itor(I,11,3,0)]); |
[1,[1,0]] |
[1,[1,0]] |
[2,[2,0]] |
[2,[2,0]] |
[3,[-2/3,0]] //euclid(3,11); ->4, 4*(-2)%11 -> 3 なので確かに -2/3 は元の数の候補 |
[3,[-2/3,0]] //euclid(3,11); ->4, 4*(-2)%11 -> 3 х∈ -2/3 違茖 |
[4,[failure,0]] |
[4,[failure,0]] |
[5,[-1/2,0]] |
[5,[-1/2,0]] |
[6,[1/2,0]] |
[6,[1/2,0]] |
Line 853 for (I=1;I<11; I++) print([I,itor(I,11,3,0)]); |
|
Line 1184 for (I=1;I<11; I++) print([I,itor(I,11,3,0)]); |
|
@end example |
@end example |
|
|
|
|
@comment --- 参照(リンク)を書く --- |
@comment --- (潟)吾 --- |
@table @t |
@table @t |
@item 参照 |
@item |
@ref{gtt_ekn.setup} |
@ref{gtt_ekn3.setup} |
@end table |
@end table |
|
|
@comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため |
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
@noindent |
@noindent |
ChangeLog |
ChangeLog |
@itemize @bullet |
@itemize @bullet |
@item |
@item |
関連ファイルは |
∫c<ゃ |
gtt_ekn/g_mat_fac.rr |
gtt_ekn3/g_mat_fac.rr |
gtt_ekn/childprocess.rr |
gtt_ekn3/childprocess.rr |
@end itemize |
@end itemize |
|
|
|
@node Binary splitting,,, Top |
|
@chapter Binary splitting |
|
|
|
@menu |
|
* gtt_ekn3.init_dm_bsplit:: |
|
* gtt_ekn3.setup_dm_bsplit:: |
|
* gtt_ekn3.init_bsplit:: |
|
@end menu |
|
|
@comment --- おまじない --- |
@node matrix factorial,,, Binary splitting |
|
@section matrix factorial |
|
|
|
@comment ********************************************************** |
|
@comment --- 茯 |
|
@comment --- ∽違茯紮 --- |
|
@comment --- section 罩g∈ --- |
|
@node gtt_ekn3.init_bsplit,,, |
|
@node gtt_ekn3.init_dm_bsplit,,, |
|
@node gtt_ekn3.setup_dm_bsplit,,, |
|
@subsection @code{gtt_ekn3.init_bsplit, gtt_ekn3.init_dm_bsplit, gtt_ekn3.setup_dm_bsplit} |
|
@comment --- 膣√若若 |
|
@findex gtt_ekn3.init_dm_bsplit matrix factorial |
|
@findex gtt_ekn3.setup_dm_bsplit matrix factorial |
|
@findex gtt_ekn3.init_bsplit matrix factorial |
|
|
|
@table @t |
|
@item gtt_ekn3.init_bsplit(|minsize=16,levelmax=1); |
|
:: binary split 絎茵<若帥荐絎. |
|
@item gtt_ekn3.init_dm_bsplit(|bsplit_x=0, bsplit_reduce=0) |
|
:: binary split e茵<若帥荐絎. |
|
@item gtt_ekn3.setup_dm_bsplit(C) |
|
:: binary split e茵 C 祉鴻腴>. |
|
@end table |
|
|
|
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
|
@table @var |
|
@item C levelmax-1 荐絎. 鴻 levalmax=1 h膊茵. |
|
@item bsplit_x=1 , debug 祉鴻 xterm ц;腓. |
|
@end table |
|
|
|
@comment --- ч∽違荅潟茯 --- |
|
@comment --- @itemize@end itemize 膊≧吾 --- |
|
@comment --- @bullet 藥剛 --- |
|
@itemize @bullet |
|
@item expectation ∽違 bs=1 激с潟筝 matrix factorial binary |
|
splitting method ц膊. |
|
@end itemize |
|
|
|
@comment --- @example@end example 絎茵箴茵腓 --- |
|
箴: bs=1 <翫罸莠. |
|
@example |
|
[4618] cputime(1)$ |
|
[4619] gtt_ekn3.expectation(Marginal=[[1950,2550,5295],[1350,1785,6660]], |
|
P=[[17/100,1,10],[7/50,1,33/10],[1,1,1]]|bs=1)$ |
|
4.912sec(4.914sec) |
|
[4621] V2=gtt_ekn3.expectation(Marginal=[[1950,2550,5295],[1350,1785,6660]], |
|
P=[[17/100,1,10],[7/50,1,33/10],[1,1,1]])$ |
|
6.752sec(6.756sec) |
|
@end example |
|
|
|
|
|
@comment --- @example@end example 絎茵箴茵腓 --- |
|
箴: h膊翫. |
|
h膊c翫紊ф絵. |
|
筝荐箴с bsplit_x=1 option |
|
debug windows с. |
|
gtt_ekn3.test_bs_dist(); с鴻с. |
|
@example |
|
[3669] C=4$ gtt_ekn3.init_bsplit(|minsize=16,levelmax=C+1)$ gtt_ekn3.init_dm_bsplit(|bsplit_x=1)$ |
|
[3670] [3671] [3672] gtt_ekn3.setup_dm_bsplit(C); |
|
[0,0] |
|
[3673] gtt_ekn3.assert2(10|bs=1)$ |
|
@end example |
|
|
|
@comment --- (潟)吾 --- |
|
@table @t |
|
@item |
|
@ref{gtt_ekn3.gmvector} |
|
@ref{gtt_ekn3.expectation} |
|
@ref{gtt_ekn3.assert1} |
|
@ref{gtt_ekn3.assert2} |
|
@end table |
|
|
|
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
|
@noindent |
|
ChangeLog |
|
@itemize @bullet |
|
@item |
|
∫c<ゃ |
|
gtt_ekn3/mfac_bs.rr |
|
gtt_ekn3/dm_bsplit.rr |
|
@end itemize |
|
|
|
|
|
|
|
@comment --- 障 --- |
@node Index,,, Top |
@node Index,,, Top |
@unnumbered Index |
@unnumbered Index |
@printindex fn |
@printindex fn |
|
|
@summarycontents |
@summarycontents |
@contents |
@contents |
@bye |
@bye |
@comment --- おまじない終り --- |
@comment --- 障腟 --- |
|
|
|
|
// 2 x m 分割表において似た機能を有する関数の利用例を参考までに記載する; |
@comment 潟若. start_of_template. |
// 正規化定数とその微分関連. |
@comment ********************************************************** |
// その1. |
@comment --- 茯 |
|
@comment --- ∽違茯紮 --- |
|
@comment --- section 罩g∈ --- |
|
@node gtt_ekn3.hoge,,, 莇綛鞘∽E(k,n) |
|
@subsection @code{gtt_ekn3.hoge} |
|
@comment --- 膣√若若 |
|
@findex gtt_ekn3.hoge |
|
|
|
@table @t |
|
@item gtt_ekn3.hoge(@var{i}) |
|
:: |
|
@end table |
|
|
|
@comment --- 綣違膂≦茯 --- 篁ヤ障吾. |
|
@table @var |
|
@item i hage |
|
@item return |
|
@end table |
|
|
|
@comment --- ч∽違荅潟茯 --- |
|
@comment --- @itemize@end itemize 膊≧吾 --- |
|
@comment --- @bullet 藥剛 --- |
|
@itemize @bullet |
|
@item 茯. |
|
@end itemize |
|
|
|
@comment --- @example@end example 絎茵箴茵腓 --- |
|
箴: |
|
@example |
|
[2221] gtt_ekn3.hoge([[1,4],[2,3]]); |
|
@end example |
|
|
|
|
|
@comment --- (潟)吾 --- |
|
@table @t |
|
@item |
|
@ref{gtt_ekn3.nc} |
|
@ref{gtt_ekn3.gmvector} |
|
@end table |
|
|
|
@comment --- ChangeLog 吾. 純若鴻潟若篏臀. 紊贋ユ CVS泣若荀 |
|
@noindent |
|
ChangeLog |
|
@itemize @bullet |
|
@item |
|
@end itemize |
|
@comment end_of_template |
|
|
|
|
|
// 2 x m 画;篌若罘純∽違箴障с荐莠; |
|
// 罩h絎違緇∫. |
|
// 1. |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3077] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[-4,[-4,-3],-1] |
[-4,[-4,-3],-1] |
[3078] tk_fd.ahmat_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
[3078] tk_fd.ahmat_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
Line 895 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Line 1370 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
[ 1 1 1 ] |
[ 1 1 1 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[4483/124416,[[353/7776,1961/15552,185/1728],[553/20736,1261/15552,1001/13824]]] |
[4483/124416,[[353/7776,1961/15552,185/1728],[553/20736,1261/15552,1001/13824]]] |
// 戻値は [Z, [[d_11 Z, d_12 Z, d_13 Z],[d_21 Z, d_22 Z, d_23 Z]]] の値. |
// 糸ゃ [Z, [[d_11 Z, d_12 Z, d_13 Z],[d_21 Z, d_22 Z, d_23 Z]]] . |
|
|
// その2. |
// 2. |
[3079] tk_fd.log_ahmat_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
[3079] tk_fd.log_ahmat_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
[ 1 1 1 ] |
[ 1 1 1 ] |
Line 905 Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/ |
|
Line 1380 Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/ |
|
[-3.32333832422461674639485797719209322217260539267246045320, |
[-3.32333832422461674639485797719209322217260539267246045320, |
[[1.25987062235110417131385233102832924380994869507026544724,3.49944233772027660049074280615659156814633058219942003122,2.97122462636627258532232879768012491635065804149007361142], |
[[1.25987062235110417131385233102832924380994869507026544724,3.49944233772027660049074280615659156814633058219942003122,2.97122462636627258532232879768012491635065804149007361142], |
[0.740129377648895828686147668971670756190051304929734552754,2.25027883113986169975462859692170421592683470890028998438,2.00959179121124247155922373410662502788311398616997546285]]] |
[0.740129377648895828686147668971670756190051304929734552754,2.25027883113986169975462859692170421592683470890028998438,2.00959179121124247155922373410662502788311398616997546285]]] |
// 戻値は [log(Z), |
// 糸ゃ [log(Z), |
// [[d_11 log(Z), d_12 log(Z), d_13 log(Z)], |
// [[d_11 log(Z), d_12 log(Z), d_13 log(Z)], |
// [d_21 log(Z), d_22 log(Z), d_23 log(Z)]]] |
// [d_21 log(Z), d_22 log(Z), d_23 log(Z)]]] |
// の近似値. |
// 菴篌弱. |
|
|
// その3. |
// 3. |
[3082] fd_hessian2(A[0],A[1],A[2],[1/2,1/3]); |
[3082] fd_hessian2(A[0],A[1],A[2],[1/2,1/3]); |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[4483/124416,[ 1961/15552 185/1728 ], |
[4483/124416,[ 1961/15552 185/1728 ], |
[ 79/288 259/864 ] |
[ 79/288 259/864 ] |
[ 259/864 47/288 ]] |
[ 259/864 47/288 ]] |
// 戻値は [F=F_D, gradient(F), Hessian(F)] |
// 糸ゃ [F=F_D, gradient(F), Hessian(F)] |
|
|
// 参考. |
// . |
// ygahvec で巾関数分の調整. 独立した関数はないようだ. |
// ygahvec у珪∽医茯炊. 腴∽違. |
|
|
//----------------------------------------------------------------------- |
//----------------------------------------------------------------------- |
// 2 x m 分割表において似た機能を有する関数の利用例を参考までに記載する; |
// 2 x m 画;篌若罘純∽違箴障с荐莠; |
// 期待値関連. |
// 緇ら∫. |
[3079] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[3079] A=tk_fd.marginal2abc([4,5],[2,4,3]); |
[-4,[-4,-3],-1] |
[-4,[-4,-3],-1] |
[3080] tk_fd.expectation_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
[3080] tk_fd.expectation_abc(A[0],A[1],A[2],[[1,1/2,1/3],[1,1,1]]); |
Line 932 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Line 1407 RS=[ 4 5 ], CSnew=[ 2 4 3 ], Ynew=[ 1 1/2 1/3 ] |
|
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
Computing Dmat(ca) for parameters B=[-4,-3],X=[ 1/2 1/3 ] |
[[5648/4483,7844/4483,4440/4483], |
[[5648/4483,7844/4483,4440/4483], |
[3318/4483,10088/4483,9009/4483]] |
[3318/4483,10088/4483,9009/4483]] |
// 各セルの期待値. |
// 祉緇. |
|
|
//----------------------------------------------------------------------- |
//----------------------------------------------------------------------- |
// ot_hgm_ahg.rr の例. 実験的なため module 化されていない. |
// ot_hgm_ahg.rr 箴. 絎薑 module . |
[3237] import("ot_hgm_ahg.rr"); |
[3237] import("ot_hgm_ahg.rr"); |
// 2 x 2 分割表. |
// 2 x 2 画;. |
[3238] hgm_ahg_expected_values_contiguity([[0,0,1,1],[1,0,1,0],[0,1,0,1]], |
[3238] hgm_ahg_expected_values_contiguity([[0,0,1,1],[1,0,1,0],[0,1,0,1]], |
[9,6,8],[1/2,1/3,1/5,1/7],[x1,x2,x3,x4]|geometric=1); |
[9,6,8],[1/2,1/3,1/5,1/7],[x1,x2,x3,x4]|geometric=1); |
oohg_native=0, oohg_curl=1 |
oohg_native=0, oohg_curl=1 |
[1376777025/625400597,1750225960/625400597,2375626557/625400597,3252978816/625400597] |
[1376777025/625400597,1750225960/625400597,2375626557/625400597,3252978816/625400597] |
// 2 x 2 分割表の期待値. |
// 2 x 2 画;緇. |
|
|
// 2 x 3 分割表. |
// 2 x 3 画;. |
[3238] hgm_ahg_expected_values_contiguity( |
[3238] hgm_ahg_expected_values_contiguity( |
[[0,0,0,1,1,1],[1,0,0,1,0,0],[0,1,0,0,1,0],[0,0,1,0,0,1]], |
[[0,0,0,1,1,1],[1,0,0,1,0,0],[0,1,0,0,1,0],[0,0,1,0,0,1]], |
[5,2,4,3],[1,1/2,1/3,1,1,1],[x1,x2,x3,x4,x5,x6]|geometric=1); |
[5,2,4,3],[1,1/2,1/3,1,1,1],[x1,x2,x3,x4,x5,x6]|geometric=1); |
[5648/4483,7844/4483,4440/4483,3318/4483,10088/4483,9009/4483] |
[5648/4483,7844/4483,4440/4483,3318/4483,10088/4483,9009/4483] |
// 2 x 3 分割表の期待値. 上と同じ問題. |
// 2 x 3 画;緇. 筝馹. |
|
|
/* |
/* |
dojo, p.221. 成績3以下の生徒は集めてひとつに. |
dojo, p.221. 膰3篁ヤ緇蚊ゃ. |
2 1 1 |
2 1 1 |
8 3 3 |
8 3 3 |
0 2 6 |
0 2 6 |
|
|
row sum: 4,14,8 |
row sum: 4,14,8 |
column sum: 10,6,10 |
column sum: 10,6,10 |
0 を一つ含むので, (3,6) 型の A から 7 列目を抜く. |
0 筝ゅ, (3,6) A 7 . |
*/ |
*/ |
// 3 x 3 分割表. 構造的0が一つ. |
// 3 x 3 画;. 罕0筝. |
|
|
A=[[0,0,0,1,1,1, 0,0], |
A=[[0,0,0,1,1,1, 0,0], |
[0,0,0,0,0,0, 1,1], |
[0,0,0,0,0,0, 1,1], |
Line 971 A=[[0,0,0,1,1,1, 0,0], |
|
Line 1446 A=[[0,0,0,1,1,1, 0,0], |
|
B=[14,8,10,6,10]; |
B=[14,8,10,6,10]; |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1],[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1],[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
|
|
// 答. |
// 膈. |
[14449864949304/9556267369631,10262588586540/9556267369631,13512615942680/9556267369631, |
[14449864949304/9556267369631,10262588586540/9556267369631,13512615942680/9556267369631, |
81112808747006/9556267369631,21816297744346/9556267369631,30858636683482/9556267369631, |
81112808747006/9556267369631,21816297744346/9556267369631,30858636683482/9556267369631, |
25258717886900/9556267369631,51191421070148/9556267369631] |
25258717886900/9556267369631,51191421070148/9556267369631] |
|
|
|
|
/* |
/* |
上のデータで 0 を 1 に変更. |
筝若帥 0 1 紊. |
2 1 1 |
2 1 1 |
8 3 3 |
8 3 3 |
1 2 6 |
1 2 6 |
Line 986 hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/ |
|
Line 1461 hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/ |
|
row sum: 4,14,9 |
row sum: 4,14,9 |
column sum: 11,6,10 |
column sum: 11,6,10 |
*/ |
*/ |
// 3 x 3 分割表. |
// 3 x 3 画;. |
A=[[0,0,0,1,1,1,0,0,0], |
A=[[0,0,0,1,1,1,0,0,0], |
[0,0,0,0,0,0,1,1,1], |
[0,0,0,0,0,0,1,1,1], |
[1,0,0,1,0,0,1,0,0], |
[1,0,0,1,0,0,1,0,0], |
Line 995 A=[[0,0,0,1,1,1,0,0,0], |
|
Line 1470 A=[[0,0,0,1,1,1,0,0,0], |
|
B=[14,9,11,6,10]; |
B=[14,9,11,6,10]; |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1,1],[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
hgm_ahg_expected_values_contiguity(A,B,[1,1/2,1/3,1,1/5,1/7,1,1,1],[x1,x2,x3,x4,x5,x6,x7,x8]|geometric=1); |
|
|
// 期待値, 答. |
// 緇, 膈. |
[207017568232262040/147000422096729819,163140751505489940/147000422096729819,217843368649167296/147000422096729819, |
[207017568232262040/147000422096729819,163140751505489940/147000422096729819,217843368649167296/147000422096729819, |
1185482401011137878/147000422096729819,358095302885438604/147000422096729819,514428205457640984/147000422096729819, |
1185482401011137878/147000422096729819,358095302885438604/147000422096729819,514428205457640984/147000422096729819, |
224504673820628091/147000422096729819,360766478189450370/147000422096729819] |
224504673820628091/147000422096729819,360766478189450370/147000422096729819] |
|
|
// Z やその微分の計算は hgm_ahg_contiguity 関数がおこなうが, これの簡易インターフェースは |
// Z 緇荐膊 hgm_ahg_contiguity ∽違, 膂≧ゃ潟帥若с若鴻 |
// まだ書いてない. |
// 障吾. |
|
|
|
|
4. x_ij は [GM2016] の1章で, |
4. x_ij [GM2016] 鐚腴, |
たとえば 3x3 の時 [[1,1,1],[x_11,x_12,1],[x_21,x_22,1]] |
3x3 [[1,1,1],[x_11,x_12,1],[x_21,x_22,1]] |
となっているが, [GM2016] の Prop 7.1 の対応では, |
c, [GM2016] Prop 7.1 絲上с, |
p = [[1,x_11,x_12],[1,x_21,x_22],[1,1,1]] となっているので注意. |
p = [[1,x_11,x_12],[1,x_21,x_22],[1,1,1]] cф絵. |