
Chain-rule a natural-scale omega gradient into FOCEI's cholOmegaInv scale
Source:R/priorDensity.R
rxPriorOmegaToCholOmegaInvGrad.RdrxPriorLogDensity()'s gradOmega is always on the raw omega scale –
the prior itself is defined there, for every method (see this file's
header comment). A caller whose optimizer varies
chol(Omega^-1) internally instead (FOCEI's op_focei.cholOmegaInv,
nlmixr2est/src/inner.cpp) still needs that gradient chain-ruled into its
own parameterization; a method that estimates Omega directly (SAEM) uses
gradOmega as-is and does not need this. This is a thin shim over the
pure C++ rxPriorOmegaToCholOmegaInvGrad() (inst/include/rxode2prior.h),
exposed the same way for a downstream package's own C++ objective.
Arguments
- omega
a single omega block (p x p numeric matrix, positive definite)
- gradOmega
the corresponding block of
rxPriorLogDensity()'sgradOmega, i.e.gradOmega[block, block](p x p); need not be symmetric on entry (rxPriorLogDensity()'s owngradOmegaalways is, but this treats it entrywise and symmetrizes internally either way, since only a symmetric perturbation ofomegais ever reachable by varyingU)
Value
p x p matrix, the gradient with respect to the upper-triangular
free elements of U = chol(solve(omega)) (omega^-1 = t(U) %*% U);
its strict lower triangle is exactly 0 since those entries address no
free parameter of U. NULL if omega is not positive definite.