[BACK]Return to nk_fb_gen_c.oxg CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / packages / doc / nk_fb_gen_c

Annotation of OpenXM/src/asir-contrib/packages/doc/nk_fb_gen_c/nk_fb_gen_c.oxg, Revision 1.1

1.1     ! takayama    1: $OpenXM$
        !             2: test1.c, test1.h $B$O$3$N%W%m%0%i%`$G@8@.$5$l$?Nc(B. data, $B=i4|CM$O$9$G$K@_Dj:Q(B.
        !             3: /*  $B$^$@=q$$$F$J$$(B.
        !             4: begin: include|
        !             5:
        !             6: @include nk_fb_gen_c_intro.ja
        !             7:
        !             8: end:
        !             9: */
        !            10:
        !            11: /* $B$^$@=q$$$F$J$$(B.
        !            12: begin: include|
        !            13:
        !            14: @include nk_fb_gen_c_intro.en
        !            15:
        !            16: end:
        !            17: */
        !            18:
        !            19: /*&usage-ja
        !            20: begin:  nk_fb_gen_c.gen_c(N)
        !            21:   {N} $B<!85(B Fisher-Bingham $BJ,I[$K$D$$$F$N:GL`?dDj$r(B HGD $BK!(B(holonomic gradient descent) $B$G$d$k$?$a$N(B C $B$N%W%m%0%i%`$r@8@.$9$k(B.
        !            22: description:
        !            23:    $B$3$N4X?t$K$h$j(B, testN.c, testN.h $B$J$kFs$D$N(B C $B$N%W%m%0%i%`$,@8@.$5$l$k(B.
        !            24:    testN.c $B$K%G!<%?(B, $B:GL`?dDjC5:wMQ$N%Q%i%a!<%?=i4|CM$r@_Dj$9$k(B.
        !            25:    $B%3%^%s%I(B
        !            26:    @quotation
        !            27:    @code{gcc testN.c $OpenXM_HOME/lib/libko_fb.a -lgsl -lblas }
        !            28:    @end quotation
        !            29:    $B$G<B9T2DG=7A<0$N%U%!%$%k$r:n@.$9$k(B. @*
        !            30:    $B$J$*(B,
        !            31:    libko_fb.a $B$O(B @file{OpenXM/src/hgm/fisher-bingham/src/} $B$G(B @code{make install} $B$9$k$3$H$K$h$j@8@.$5$l$k(B.
        !            32:    $B$^$?%7%9%F%`$K$O(B gsl $B$,%$%s%9%H!<%k$5$l$F$$$J$$$H$$$1$J$$(B.
        !            33:    @file{OpenXM/src/hgm/fisher-bingham/src/Testdata} $B$K%5%s%W%k$N(B
        !            34:   $B%G!<%?(B, $B:GL`?dDjC5:wMQ$N%Q%i%a!<%?=i4|CM$,$"$k(B. @*
        !            35:   $B%"%k%4%j%:%`$N>\:Y$O(B,
        !            36:   T. Koyama, H. Nakayama, K. Nishiyama, N. Takayama, Holonomic Gradient Descent for the Fisher-Bingham Distribution on the d-dimensional Sphere, Computational Statistics (2013),
        !            37:   @url{http://dx.doi.org/10.1007/s00180-013-0456-z}
        !            38:   $B$r;2>H(B. @*
        !            39:   Authors; T.Koyama, H.Nakayama, K.Nishiyama, N.Takayama.
        !            40: example:
        !            41: [1854] load("nk_fb_gen_c.rr");
        !            42: [2186]  nk_fb_gen_c.gen_c(1);     S^1 $B$NLdBj$r2r$/(B program $B$r@8@.(B.
        !            43: generate test1.h
        !            44: generate test1.c
        !            45: 1
        !            46: [2187] quit;
        !            47: $ emacs test1.c &
        !            48:
        !            49:
        !            50:         Write data here.
        !            51: $B$H%3%a%s%H$K=q$+$l$F$$$k$H$3$m$N8e(B
        !            52: $B$K(B $(OpenXM_HOME)/src/hgm/fisher-bingham/Testdata/s1_wind_data.h $B$rA^F~(B.
        !            53: $BJ]B8=*N;(B.
        !            54:
        !            55: $ gcc test1.c $OpenXM_HOME/lib/libko_fb.a -lgsl -lblas
        !            56: $ ./a.out
        !            57:   --- snip
        !            58: points = [1.11945, 3.33044, -0.469454, 0.904504, -0.770373]
        !            59: values = [3.4421, 1.13891, -0.0217944, 2.28474]
        !            60: grad ; 0.005644 -0.033429 -0.005644 0.045820 0.047695
        !            61: norm(grad) ; 0.074535
        !            62:   --- snip
        !            63:
        !            64: $B$3$3$G(B, points $B$,(B parameter x11,x12,x22,y1,y2 $B$N?dDjCM(B.
        !            65: Value 3.4421 $B$,(B $BL`EYCM$N5U?t$G(B, $B$3$l$,:G>.2=$5$l$F$$$k(B.
        !            66: end:
        !            67: */
        !            68:
        !            69: /*&usage-en
        !            70: begin:  nk_fb_gen_c.gen_c(N)
        !            71:   It generates a C program to make a MLE (maximal likelihood estimate)
        !            72:   by the HGD (holonomic gradient descent)
        !            73:  for {N} dimensional Fisher-Bingham distribution.
        !            74: description:
        !            75:    This function generates two C programs testN.c and testN.h.
        !            76:    After setting data and an initial point to make MLE in testN.c,
        !            77:    build an executable file by the command
        !            78:    @quotation
        !            79:    @code{gcc testN.c $OpenXM_HOME/lib/libko_fb.a -lgsl -lblas }
        !            80:    @end quotation
        !            81:    The libray file libko_fb.a is generated by
        !            82:    @code{make install} in the folder  @file{OpenXM/src/hgm/fisher-bingham/src/}
        !            83:    The GSL (Gnu Scientific Library) should also be installed in the system.
        !            84:    Sample data and initial points are in @file{OpenXM/src/hgm/fisher-bingham/src/Testdata}.
        !            85:    @*
        !            86:   As to the algorithm, refer to
        !            87:   T. Koyama, H. Nakayama, K. Nishiyama, N. Takayama, Holonomic Gradient Descent for the Fisher-Bingham Distribution on the d-dimensional Sphere, Computational Statistics (2013),
        !            88:   @url{http://dx.doi.org/10.1007/s00180-013-0456-z} @*
        !            89:   Authors; T.Koyama, H.Nakayama, K.Nishiyama, N.Takayama.
        !            90: example:
        !            91: [1854] load("nk_fb_gen_c.rr");
        !            92: [2186]  nk_fb_gen_c.gen_c(1);     Generate a program to solve MLE on S^1
        !            93: generate test1.h
        !            94: generate test1.c
        !            95: 1
        !            96: [2187] quit;
        !            97: $ emacs test1.c &
        !            98:
        !            99: Find a line which contains
        !           100:      Write data here
        !           101: and insert $(OpenXM_HOME)/src/hgm/fisher-bingham/Testdata/s1_wind_data.h.
        !           102: after this line.
        !           103: Save and quit emacs.
        !           104:
        !           105: $ gcc test1.c $OpenXM_HOME/lib/libko_fb.a -lgsl -lblas
        !           106: $ ./a.out
        !           107:   --- snip
        !           108: points = [1.11945, 3.33044, -0.469454, 0.904504, -0.770373]
        !           109: values = [3.4421, 1.13891, -0.0217944, 2.28474]
        !           110: grad ; 0.005644 -0.033429 -0.005644 0.045820 0.047695
        !           111: norm(grad) ; 0.074535
        !           112:   --- snip
        !           113:
        !           114: where ``points'' is the estimated value of the parameter x11,x12,x22,y1,y2.
        !           115: Value 3.4421 is the inverse of the likelihood which is minimized.
        !           116: end:
        !           117: */
        !           118:
        !           119:

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