% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adjoint.R
\name{.rxAdjointGradBuild}
\alias{.rxAdjointGradBuild}
\title{Build the symbolic part of an adjoint objective gradient (compile once)}
\usage{
.rxAdjointGradBuild(object, calcSens, pred, events, errModel = NULL)
}
\arguments{
\item{object}{model definition accepted by \code{\link[=rxode2]{rxode2()}} (text,
\code{rxode2} object, or function/ui).}

\item{calcSens}{character vector of parameter names to differentiate with
respect to.}

\item{pred}{character prediction expression \code{f} (function of states and
parameters), e.g. \code{"center/v"}.}

\item{events}{event table / data used to define dosing.}

\item{errModel}{\code{NULL} for least squares, or a list with character entries
\code{add} and/or \code{prop} naming the additive / proportional residual-error
parameters, selecting the FOCEi -2LL objective \code{v = add^2 + (prop*f)^2}.}
}
\value{
an opaque list consumed by \code{\link[=.rxAdjointGradEval]{.rxAdjointGradEval()}}.
}
\description{
Performs all symbolic work (symengine differentiation, \code{rxFromSE}, model
compilation) up front and returns a reusable object for
\code{\link[=.rxAdjointGradEval]{.rxAdjointGradEval()}}, so an optimiser evaluates the gradient at many
parameter values without re-running symbolic code.  Build before any
\code{rxSolve} to avoid a \code{load_all}-only symengine dispatch fragility.
}
\author{
Matthew L. Fidler
}
\keyword{internal}
