Stan  1.0
probability, sampling & optimization
Public Member Functions | List of all members
stan::mcmc::sample Class Reference

Representation of a MCMC sample. More...

#include <sampler.hpp>

Public Member Functions

 sample (const std::vector< double > &params_r, const std::vector< int > &params_i, double log_prob)
 Construct a sample from the specified parameters and log probability. More...
 
virtual ~sample ()
 Destroy this sample. More...
 
int size_r () const
 Return the number of real (scalar) parameters. More...
 
double params_r (int k) const
 Return the value of the parameter at the specified index. More...
 
void params_r (std::vector< double > &x) const
 Set the specified parameter vector's value to the parameters in this sample. More...
 
const std::vector< double > & params_r () const
 Return the underlying continuous parameter vector. More...
 
int size_i () const
 Return the number of discrete integer (discrete) parameters. More...
 
int params_i (int k) const
 Return the integer (discrete) parameter at the specified index. More...
 
void params_i (std::vector< int > &n) const
 Set the specified parameter vector's value to the parameters in this sample. More...
 
const std::vector< int > & params_i () const
 Return the vector of integer parameters for this sample. More...
 
double log_prob () const
 Return the log probability (possibly unnormalized) for this sample. More...
 

Detailed Description

Representation of a MCMC sample.

A sample consists of real parameters, integer parameters, and a log probability.

Definition at line 16 of file sampler.hpp.

Constructor & Destructor Documentation

◆ sample()

stan::mcmc::sample::sample ( const std::vector< double > &  params_r,
const std::vector< int > &  params_i,
double  log_prob 
)
inline

Construct a sample from the specified parameters and log probability.

This constructor copies the parameter vectors so that subsequent changes to the parameters do not affect the sample.

Parameters
params_rScalar (real) parameters.
params_iDiscrete (integer) parameters.
log_probLog probability of parameters and data in the model.

Definition at line 37 of file sampler.hpp.

◆ ~sample()

virtual stan::mcmc::sample::~sample ( )
inlinevirtual

Destroy this sample.

This base class implements is destructor as a no-op.

Definition at line 50 of file sampler.hpp.

Member Function Documentation

◆ log_prob()

double stan::mcmc::sample::log_prob ( ) const
inline

Return the log probability (possibly unnormalized) for this sample.

Returns
Log probability.

Definition at line 135 of file sampler.hpp.

◆ params_i() [1/3]

const std::vector<int>& stan::mcmc::sample::params_i ( ) const
inline

Return the vector of integer parameters for this sample.

Definition at line 125 of file sampler.hpp.

◆ params_i() [2/3]

int stan::mcmc::sample::params_i ( int  k) const
inline

Return the integer (discrete) parameter at the specified index.

Parameters
kIndex of parameter.
Returns
Parameter at the specified index.

Definition at line 108 of file sampler.hpp.

◆ params_i() [3/3]

void stan::mcmc::sample::params_i ( std::vector< int > &  n) const
inline

Set the specified parameter vector's value to the parameters in this sample.

Parameters
[out]nVector into which to write parameters.

Definition at line 118 of file sampler.hpp.

◆ params_r() [1/3]

const std::vector<double>& stan::mcmc::sample::params_r ( ) const
inline

Return the underlying continuous parameter vector.

Returns
Continuous parameter vector for this sample.

Definition at line 89 of file sampler.hpp.

◆ params_r() [2/3]

double stan::mcmc::sample::params_r ( int  k) const
inline

Return the value of the parameter at the specified index.

Parameters
kIndex of parameter.
Returns
Parameter at index.

Definition at line 69 of file sampler.hpp.

◆ params_r() [3/3]

void stan::mcmc::sample::params_r ( std::vector< double > &  x) const
inline

Set the specified parameter vector's value to the parameters in this sample.

Parameters
[out]xVector into which to write the parameters.

Definition at line 79 of file sampler.hpp.

◆ size_i()

int stan::mcmc::sample::size_i ( ) const
inline

Return the number of discrete integer (discrete) parameters.

Returns
Number of integer parameters.

Definition at line 98 of file sampler.hpp.

◆ size_r()

int stan::mcmc::sample::size_r ( ) const
inline

Return the number of real (scalar) parameters.

Returns
Number of real parameters.

Definition at line 58 of file sampler.hpp.


The documentation for this class was generated from the following file:

     [ Stan Home Page ] © 2011–2012, Stan Development Team.