Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.87 KB

r_interface.md

File metadata and controls

46 lines (34 loc) · 1.87 KB

R Interface


Install Rcpp package

  • Install package-dependencies: Rcpp, RcppEigen, BH.
  1. Then use devtools package to install volesti Rcpp package. From terminal go to folder /root/R-proj and run in terminal:
Rscript -e 'Rcpp::compileAttributes()'  
R CMD INSTALL --no-multiarch --with-keep.source .  
  1. You can use Rstudio as well to open volesti.Rproj and then click build source Package and then Install and Restart in Build at the menu bar.

Generate CRAN version

To generate the CRAN version of the R package follow the instructions below:

  1. From the command line navigate to folder /cran_gen. Then Run:
source('genCRANpkg.R')  
  1. Open genCRANpkg.R script with Rstudio and run it.

Run volesti from R

  • The main function is volume(). It can be used to approximate the volume of a convex polytope given as a set of linear inequalities or a set of vertices (d-dimensional points) or as a Minkowski sum of segments (zonotope). There are two algorithms that can be used. The first is SequenceOfBalls and the second is CoolingGaussian (see References).
  • The function sample_points() can be used to sample points from a convex polytope with uniform or spherical gaussian target distribution.
  • The function round_polytope() can be used to round a convex polytope.
  • The function rand_rotate() can be used to apply a random rotation to a convex polytope.

For more details you can read the documentation in folder /inst/doc.

Create pdf documentation from Rd files

  • Install volesti library.
  • In R mode (or in Rstudio) Run
pack = "volesti"  
path = find.package(pack)  
system(paste(shQuote(file.path(R.home("bin"), "R")),  
    "CMD", "Rd2pdf", shQuote(path)))
  • The pdf will be created and saved in R-proj folder.
  • We give such a documentation in /R-proj/doc folder.