![]() |
Stan Math Library
5.1.0
Automatic Differentiation
|
Reference for calculations of marginal and its gradients: Margossian et al (2020), https://arxiv.org/abs/2004.12550 and Margossian (2023), https://arxiv.org/pdf/2306.14976.
Definition in file laplace_marginal_density.hpp.
#include <stan/math/prim/fun/Eigen.hpp>
#include <stan/math/mix/functor/laplace_likelihood.hpp>
#include <stan/math/rev/meta.hpp>
#include <stan/math/rev/core.hpp>
#include <stan/math/rev/fun.hpp>
#include <stan/math/rev/fun/value_of.hpp>
#include <stan/math/rev/functor.hpp>
#include <stan/math/prim/fun/to_ref.hpp>
#include <stan/math/prim/fun/quad_form_diag.hpp>
#include <stan/math/prim/functor/iter_tuple_nested.hpp>
#include <unsupported/Eigen/MatrixFunctions>
#include <cmath>
#include <optional>
Go to the source code of this file.
Classes | |
struct | stan::math::laplace_options_base |
Options for the laplace sampler. More... | |
struct | stan::math::laplace_options< false > |
struct | stan::math::laplace_options< true > |
struct | stan::math::internal::laplace_density_estimates< Covar, ThetaVec, WR, L_t, A_vec, ThetaGrad, LU_t, KRoot > |
Namespaces | |
namespace | stan |
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation from C or the boost::math::lgamma implementation. | |
namespace | stan::math |
Matrices and templated mathematical functions. | |
namespace | stan::math::internal |
A comparator that works for any container type that has the brackets operator. | |
Typedefs | |
using | stan::math::laplace_options_default = laplace_options< false > |
using | stan::math::laplace_options_user_supplied = laplace_options< true > |
Functions | |
template<typename WRootMat > | |
void | stan::math::internal::block_matrix_sqrt (WRootMat &W_root, const Eigen::SparseMatrix< double > &W, const Eigen::Index block_size) |
Returns the principal square root of a block diagonal matrix. | |
template<typename WRootMat > | |
void | stan::math::internal::block_matrix_chol_L (WRootMat &W_root, const Eigen::SparseMatrix< double > &W, const Eigen::Index block_size) |
Performs a Cholesky decomposition on a block diagonal matrix. | |
template<typename AVec , typename APrev , typename ThetaVec , typename LLFun , typename LLArgs , typename Covar , typename Msgs > | |
void | stan::math::internal::line_search (double &objective_new, AVec &a, ThetaVec &theta, APrev &a_prev, LLFun &&ll_fun, LLArgs &&ll_args, Covar &&covariance, const int max_steps_line_search, const double objective_old, double tolerance, Msgs *msgs) |
Performs a simple line search. | |
template<typename Output > | |
void | stan::math::internal::set_zero_adjoint (Output &&output) |
Set all adjoints of the output to zero. | |
template<bool ZeroInput = false, typename Output , typename Input , require_t< is_all_arithmetic_scalar< Output > > * = nullptr, require_t< is_all_var_scalar< Input > > * = nullptr> | |
void | stan::math::internal::collect_adjoints (Output &output, Input &&input) |
Collect the adjoints from the input and add them to the output. | |
template<typename NameStr , typename ParamStr , typename Param > | |
void | stan::math::internal::throw_nan (NameStr &&name_str, ParamStr &¶m_str, Param &¶m) |
Throws an error if the parameter contains NaN or Inf values. | |
template<typename LLFun , typename LLTupleArgs , typename CovarFun , typename CovarArgs , bool InitTheta, require_t< is_all_arithmetic_scalar< CovarArgs > > * = nullptr> | |
auto | stan::math::internal::laplace_marginal_density_est (LLFun &&ll_fun, LLTupleArgs &&ll_args, CovarFun &&covariance_function, CovarArgs &&covar_args, const laplace_options< InitTheta > &options, std::ostream *msgs) |
For a latent Gaussian model with hyperparameters phi and latent variables theta, and observations y, this function computes an approximation of the log marginal density, p(y | phi). | |
template<typename LLFun , typename LLTupleArgs , typename CovarFun , typename CovarArgs , bool InitTheta, require_t< is_all_arithmetic_scalar< CovarArgs, LLTupleArgs > > * = nullptr> | |
double | stan::math::laplace_marginal_density (LLFun &&ll_fun, LLTupleArgs &&ll_args, CovarFun &&covariance_function, CovarArgs &&covar_args, const laplace_options< InitTheta > &options, std::ostream *msgs) |
For a latent Gaussian model with global parameters phi, latent variables theta, and observations y, this function computes an approximation of the log marginal density, p(y | phi). | |
template<typename Output , typename Input , require_t< is_all_arithmetic_scalar< Output > > * = nullptr, require_t< is_all_arithmetic_scalar< Input > > * = nullptr> | |
void | stan::math::internal::collect_adjoints (Output &&output, Input &&input) |
Collects the adjoints from the input and adds them to the output. | |
template<bool ZeroInput = false> | |
void constexpr | stan::math::internal::copy_compute_s2 (const std::tuple<> &output, const std::tuple<> &input) noexcept |
Base case for zero sized tuples. | |
template<bool ZeroInput = false, typename Output , typename Input , require_t< is_all_arithmetic_scalar< Output > > * = nullptr, require_t< is_any_var_scalar< Input > > * = nullptr> | |
void | stan::math::internal::copy_compute_s2 (Output &&output, Input &&input) |
Copies the adjoints from the input to the output, scaling them by 0.5. | |
template<typename T > | |
constexpr decltype(auto) | stan::math::internal::filter_var_scalar_types (T &&t) |
template<typename Input > | |
constexpr auto | stan::math::internal::make_zeroed_arena (Input &&input) |
Creates an arena type from the input with initialized with zeros. | |
template<typename Output , typename Input > | |
void | stan::math::internal::collect_adjoints (Output &&output, const vari *ret, Input &&input) |
Used in reverse pass to collect adjoints to the output. | |
template<typename Output , typename Input > | |
void | stan::math::internal::reverse_pass_collect_adjoints (var ret, Output &&output, Input &&input) |
Collects adjoints from a tuple or std::vector of tuples. | |
template<typename LLFun , typename LLTupleArgs , typename CovarFun , typename CovarArgs , bool InitTheta, require_t< is_any_var_scalar< LLTupleArgs, CovarArgs > > * = nullptr> | |
auto | stan::math::laplace_marginal_density (const LLFun &ll_fun, LLTupleArgs &&ll_args, CovarFun &&covariance_function, CovarArgs &&covar_args, const laplace_options< InitTheta > &options, std::ostream *msgs) |
For a latent Gaussian model with global parameters phi, latent variables theta, and observations y, this function computes an approximation of the log marginal density, p(y | phi). | |