Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ compute_s2()

template<typename F , typename Theta , typename AMat , typename Stream , typename... Args, require_eigen_vector_t< Theta > * = nullptr>
auto stan::math::laplace_likelihood::internal::compute_s2 ( F &&  f,
Theta &&  theta,
AMat &&  A,
const int  hessian_block_size,
Stream *  msgs,
Args &&...  args 
)
inline

The derivative of the log likelihood wrt theta evaluated at the mode.

Compute $s_2 = \Delta_{\theta} log \pi_G(y|\phi,\eta) = -\frac{1}{2} trace((K^{-1}+W)^{-1})$

Note
Equation 15 in https://arxiv.org/pdf/2306.14976
If Args contains var types then their adjoints will be calculated as a side effect.
Template Parameters
FA functor with opertor()(Args&&...) returning a scalar
ThetaAn Eigen Matrix
AMatAn Eigen Matrix
StreamType of stream for messages.
ArgsType of variadic arguments for likelihood function.
Parameters
fLog likelihood function.
thetaLatent Gaussian variable.
AMatrix storing initial tangents for higher-order differentiation (line 21 in Algorithm 4, https://arxiv.org/pdf/2306.14976)
hessian_block_sizeIf the Hessian of the log likelihood w.r.t theta is block diagonal, size of each block.
msgsStream for messages.
argsVariational arguments for likelihood function.

Definition at line 212 of file laplace_likelihood.hpp.