xptr_eval {itp} | R Documentation |
Call a C++ function using an external pointer
Description
This function is used in plot.itp
to plot a function and
the root estimated by itp
.
Usage
xptr_eval(x, pars, xpsexp)
Arguments
x |
The main argument of the function. |
pars |
A list of additional arguments to the function. This may be an empty list. |
xpsexp |
An external pointer to a C++ function. |
Details
See the Passing user-supplied C++ functions article in the Rcpp Gallery for information.
Value
A numeric scalar: the value of the C++ function evaluated at the
input values x
and pars
.
See Also
xptr_create
for creating an external pointer to a
C++ function.
Examples
lambert_ptr <- xptr_create("lambert")
res <- itp(lambert_ptr, c(-1, 1))
# Value at lower limit
xptr_eval(-1, list(), lambert_ptr)
# Value at upper limit
xptr_eval(1, list(), lambert_ptr)
# Value at the estimated root
xptr_eval(res$root, list(), lambert_ptr)
[Package itp version 1.2.1 Index]