evaltape {scorematchingad} | R Documentation |
Evaluate a CppAD Tape Many Times
Description
Evaluates a tape exactly or approximately for an array of provided variable values and dynamic parameter values.
The function evaltape_wsum()
computes the column-wise weighted sum of the result.
Usage
evaltape(tape, xmat, pmat, xcentres = NA * xmat, approxorder = 10)
evaltape_wsum(
tape,
xmat,
pmat,
w = NULL,
xcentres = NA * xmat,
approxorder = 10
)
Arguments
tape |
An |
xmat |
A matrix of (multivariate) independent variables where each represents a single independent variable vector. Or a single independent variable vector that is used for all rows of |
pmat |
A matrix of dynamic parameters where each row specifies a new set of values for the dynamic parameters of |
xcentres |
A matrix of approximation for Taylor approximation centres for |
approxorder |
Order of Taylor approximation |
w |
Weights to apply to each row of |
Details
Approximation is via Taylor approximation of the independent variable around the approximation centre provided in xcentres
.
Value
A matrix, each row corresponding to the evaluation of the same row in xmat
, pmat
and xcentres
.
See Also
Other tape evaluators:
quadratictape_parts()
,
smvalues()
,
testquadratic()
Examples
u <- rep(1/3, 3)
tapes <- buildsmdtape("sim", "sqrt", "sph", "ppi",
ytape = u,
usertheta = ppi_paramvec(p = 3),
bdryw = "minsq", acut = 0.01,
verbose = FALSE
)
evaltape(tapes$lltape, u, rppi_egmodel(1)$theta)
evaltape(tapes$smdtape, rppi_egmodel(1)$theta, u)
evaltape(tapes$lltape, rbind(c(0, 0, 1), c(0,0,1)),
rppi_egmodel(1)$theta,
xcentres = rbind(c(0.0005, 0.0005, 0.999), NA))