xptr_eval(x, pars, xpsexp)
The main argument of the function.
A list of additional arguments to the function. This may be an empty list.
An external pointer to a C++ function.
A numeric scalar: the value of the C++ function evaluated at the
input values x
and pars
.
See the Passing user-supplied C++ functions article in the Rcpp Gallery for information.
xptr_create
for creating an external pointer to a
C++ function.
lambert_ptr <- xptr_create("lambert")
res <- itp(lambert_ptr, c(-1, 1))
# Value at lower limit
xptr_eval(-1, list(), lambert_ptr)
#> [1] -1.367879
# Value at upper limit
xptr_eval(1, list(), lambert_ptr)
#> [1] 1.718282
# Value at the estimated root
xptr_eval(res$root, list(), lambert_ptr)
#> [1] 2.047917e-12