fangzhou-xie / ast2ast

Translates an R function into an external pointer to a C++ function. The typical use case intended by 'ast2ast' are functions describing ode-systems.

Home Page:https://fangzhou-xie.github.io/ast2ast/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License: GPL2

R package ast2ast

News

Overview

Translates an R function into a C++ function. An external pointer to the C++ function or an R function is returned to the user. To install the Github version of the package use devtools::install_github("Konrad1991/ast2ast", build_vignettes = TRUE). The package is also on CRAN and can be installed via install.packages("ast2ast").

The motivation to write the package was that it is often cumbersome using R functions in applications which have to call the R function very often (> 100 calls) (e.g. ODE solving, Optimization). One possiblity is to write the function in a faster programming language e.g. C. However, learning languages such as C is difficult and time consuming. Therefore ast2ast is a decent alternative as the function can be written in R.

As an example solving a simple ODE-System. The translated code is considerable faster then R code and almost as fast as C++. Code for the example can be found in the vignettes.

Benchmark

Documentation:

See the documentation of the function translate to see how to use ast2ast: Function translate. If you want to get more details check: Detailed Documentation . In case you want to use ast2ast in other packages, or you are intersted how ast2ast works internally, see Information for package authors.

Contribution

Contribution would be warmly appreciated (See Code of Conduct).

About

Translates an R function into an external pointer to a C++ function. The typical use case intended by 'ast2ast' are functions describing ode-systems.

https://fangzhou-xie.github.io/ast2ast/

License:GNU General Public License v2.0


Languages

Language:C++ 70.8%Language:R 29.2%