[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.13

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

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