this is for holding javascript data
Antonio Coppola edited C++ Functions.tex
over 9 years ago
Commit id: ec90140846177ec844aa81a4a85b46e1485b56bc
deletions | additions
diff --git a/C++ Functions.tex b/C++ Functions.tex
index 02a9948..4e2fc79 100644
--- a/C++ Functions.tex
+++ b/C++ Functions.tex
...
\subsection{Extra parameters in C++ implementations}
Much like in the R case, the passing of extra parameters with C++ implementations of the objective and gradient is achieved through the use of R environments. The following is an example replicating the Poisson regression using data from Golub et al. \cite{Golub_1999} with C++ function implementations. As before, we set up the objective and gradient as character strings. We include the extra environment argument and obtain data by evaluating it usign the
\code{Rcpp::Environment} class: Rcpp::Environment class. In order to perfom matrix operations, we use the RcppArmadillo library \cite{Eddelbuettel_2014}:
\begin{lstlisting}
likelihood.include <- 'Rcpp::NumericVector lhood(SEXP xs, SEXP env){