[BACK]Return to note.txt CVS log [TXT][DIR] Up to [local] / OpenXM / src / R / r-packages

Annotation of OpenXM/src/R/r-packages/note.txt, Revision 1.11

1.11    ! takayama    1: $OpenXM: OpenXM/src/R/r-packages/note.txt,v 1.10 2019/11/16 11:03:43 takayama Exp $
1.1       takayama    2:
                      3: See also OpenXM/src/hgm/note.txt
                      4:
1.10      takayama    5: * R package build, reference pages.
                      6: https://cran.r-project.org/bin/macosx/tools/
                      7: * Example
                      8:   Edit files in src/hgm
                      9:   cd R/r-packages
                     10:   make rsync
                     11:   R CMD INSTALL hgm
                     12:   Start R and library(hgm)
                     13:   hgm.ncso3()
                     14:
1.1       takayama   15: * C source codes.
                     16:  C sources and headers should be developed and edited in the directory
                     17:  OpenXM/src/hgm in order to provide a standalone mode without R
                     18:  in the OpenXM project.
                     19:  They are copied by rsync to hgm/src from OpenXM/src/hgm/
                     20:  See the Makefile.
                     21:
                     22: * How to develope and tests.
                     23: (1) Develope the system in OpenXM/src/hgm as a standalone system.
                     24:     See OpenXM/src/hgm/so3 as an example.
                     25: (2) Add rsync-[projectname] to OpenXM/src/R/r-packages/Makefile
                     26:     See the example of the project so3.
                     27: (3) Example in the case of hgm.
                     28:     R CMD check hgm
                     29:         It generates pdf documents and shared libraries.
                     30:         hgm.Rcheck/hgm-Ex.Rout contains the result of the execution of examples
                     31:         embedded in the documents in man.
                     32:         hgm.Rcheck/hgm-manual.pdf is the PDF manual.
                     33:
                     34:     See also http://fe.math.kobe-u.ac.jp/Movies/oxvh,
                     35:        2012-09-05-r-package[.mov]
                     36:        2013-02-06-Ropenxm[.mov]
                     37:
                     38:     R CMD INSTALL hgm
                     39:         R
                     40:         library(hgm)
1.9       takayama   41:         You can check hgm.ncso3 by hand.
1.1       takayama   42:     R CMD REMOVE hgm
                     43:         It is used to remove the test library.
                     44:
                     45:     R --help
1.2       takayama   46: (4) Binary build on Windows.
                     47:     R CMD INSTALL --build hgm
                     48:     ( Check R CMD INSTALL --help for details. )
                     49:    or
                     50:     R CMD build --binary hgm  (perhaps, obsolete style)
1.1       takayama   51:
1.9       takayama   52: (5) make copy-web-hgm
                     53:    hgm_x.yz.tar.gz
                     54:    [cran submit package] search ==> http://cran.r-project.org/submit.html
                     55:
1.1       takayama   56: * Notes.
                     57:     library.dynam()   shows a list of shared libraries loaded.
                     58:     dyn.load("hgm.so") can be used to load shared library by hand.
                     59:     getwd() gets the current working directory.
                     60:
1.3       takayama   61:
                     62: * Undocumented functions which are removed temporary fro NAMESPACE. 2015.03.24
                     63: export(hgm.so3nc)
                     64: export(hgm.normalizingConstantOfFisherDistributionOnSO3)
                     65: export(hgm.normalizingConstantOfOrthant)
                     66: export(hgm.normalizingConstantOfBinghamDistribution)
                     67: export(hgm.z.mleDemo)
                     68: export(hgm.ssFB)
                     69:
1.1       takayama   70:
1.4       takayama   71: * Check the memory leak by valgrind and by AddressSanitizer. 2015.04.01
                     72: ** Valgrind
                     73: apt-get install valgrind
                     74:
                     75: cat >>~/.valgrindrc
                     76: --leak-check=full
                     77: --track-origins=yes
                     78: ctrl-D
                     79:
1.7       takayama   80: make clean
1.4       takayama   81: R CMD check hgm --use-valgrind
                     82: more hgm.Rcheck/hgm-Ex.Rout
                     83: Example of an error (Note that there is no error message in *.log)
                     84: ==14813== Conditional jump or move depends on uninitialised value(s)
                     85: ==14813==    at 0xCA20170: mh_t (jack-n.c:1361)
                     86:   for (i=0; i<=M_m; i++) {
                     87:     -- snip
                     88:     serror = myabs((partial_sum[i]-partial_sum[i-1])/partial_sum[i-1]);
                     89:   }
                     90:   partial_sum[-1] is accessed!
                     91:
                     92: As to details, search "valgrind" in R-exts.pdf
                     93:
                     94: * R CMD check hgm --use-gct
1.5       takayama   95:
                     96: * Note on building R package: @s/2015/04/05-hgm-r-package-memo.txt
                     97:
1.6       takayama   98: ;;
                     99: 2016.02.15  testdata.
                    100: c<-hgm.p2wishart(m=4,n1=50,n2=100,beta=c(1,2,4,8),q0=0.5,q=30,autoplot=1);
                    101:   output is wrong.
                    102: c<-hgm.p2wishart(m=4,n1=50,n2=100,beta=c(1,2,4,8),q0=0.5,q=30,err=c(1e-30,1e-10),mode=c(1,1,0))
                    103:   output is correct.
                    104: c<-hgm.p2wishart(m=4,n1=50,n2=100,beta=c(1,2,4,8),q0=0.5,q=30,err=c(1e-30,1e-10),autoplot=1)
                    105:   crashed, but by commented out todo in mh.c, it works. See @s/2016/02
                    106:
1.8       takayama  107: ;;
                    108: http://kbroman.org/pkg_primer/pages/cran.html
                    109:
                    110: R CMD check hgm --as-cran
                    111:
                    112:
1.11    ! takayama  113: ;;
        !           114: 2020.02.06  Installing r-devel
        !           115:  apt-get install subversion ccache
        !           116:  apt-get install xorg-dev
        !           117:  apt-get install libcurl4-openssl-dev
        !           118:  pushd ~/this19/R  (for example)
        !           119:  svn co https://svn.r-project.org/R/trunk r-devel/R
        !           120:  cd r-devel/R   and follow the INSTALL
        !           121:  ./configure --without-recommended-packages  --prefix ~/this19/R
        !           122:  make
        !           123:  export PATH=~/this19/R/r-devel/R/bin:$PATH
        !           124:
        !           125:
        !           126: Valgrid can be used by
        !           127:    valgrind ./a.out
        !           128: A sample:  main() { int n;  if (n>0) n=0; }
        !           129:

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