.. index:: pair: class; gpr::laplace::SliceSampler .. _doxid-classgpr_1_1laplace_1_1_slice_sampler: class gpr::laplace::SliceSampler ================================ .. toctree:: :hidden: Overview ~~~~~~~~ Doubling slice sampler over a p-dim continuous parameter, with random-direction Gibbs proposals. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class SliceSampler { public: // typedefs typedef std::function :ref:`LogTarget`; typedef std::function :ref:`AlphaCacheFn`; // construction :target:`SliceSampler`(:ref:`SliceSamplerOptions` opts = {}); // methods bool :ref:`sample`(const Eigen::VectorXd& theta_init, const :ref:`LogTarget`& log_target, const :ref:`AlphaCacheFn`& alpha_fn, :ref:`SliceSamplerState`& out); }; .. _details-classgpr_1_1laplace_1_1_slice_sampler: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Doubling slice sampler over a p-dim continuous parameter, with random-direction Gibbs proposals. Typedefs -------- .. index:: pair: typedef; LogTarget .. _doxid-classgpr_1_1laplace_1_1_slice_sampler_1ada7e40956eb5e5411bd0e9078c27a17f: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function LogTarget Caller-supplied target: returns ``log p(theta | :ref:`y `)`` (or any quantity proportional to it on the natural log scale the slice algorithm is invariant under additive constants). Returning a non-finite value (NaN, -inf) is interpreted as "outside support" and treated as below any slice level. .. index:: pair: typedef; AlphaCacheFn .. _doxid-classgpr_1_1laplace_1_1_slice_sampler_1a840a2244ad51621c827f7d94d3e2100c: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function AlphaCacheFn Caller-supplied alpha cache builder: given theta, returns ``alpha = K(theta)^-1 :ref:`y ```. Called once per accepted sample. If null, alpha_cache is left empty. Methods ------- .. index:: pair: function; sample .. _doxid-classgpr_1_1laplace_1_1_slice_sampler_1af6cd339b5f2fec89f5e1912ddf95ea5d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool sample(const Eigen::VectorXd& theta_init, const :ref:`LogTarget`& log_target, const :ref:`AlphaCacheFn`& alpha_fn, :ref:`SliceSamplerState`& out) Draw ``opts.n_samples + opts.n_burnin`` samples starting from theta_init. Returns true and fills ``out.theta_samples`` / ``out.alpha_cache`` on success; returns false and leaves ``out.valid == false`` if the initial point has non-finite log-target (no valid starting state).