Stan  2.10.0
probability, sampling & optimization
Functions
stan::services::init Namespace Reference

Functions

template<class Model >
bool initialize_state_values (Eigen::VectorXd &cont_params, Model &model, interface_callbacks::writer::base_writer &writer)
 
template<class Model >
bool initialize_state_zero (Eigen::VectorXd &cont_params, Model &model, interface_callbacks::writer::base_writer &writer)
 Sets initial state to zero. More...
 
template<class Model , class RNG >
bool initialize_state_random (const double R, Eigen::VectorXd &cont_params, Model &model, RNG &base_rng, interface_callbacks::writer::base_writer &writer)
 Initializes state to random uniform values within range. More...
 
template<class ContextFactory , class Model , class RNG >
bool initialize_state_source_and_random (const std::string &source, double R, Eigen::VectorXd &cont_params, Model &model, RNG &base_rng, interface_callbacks::writer::base_writer &writer, ContextFactory &context_factory)
 Creates the initial state. More...
 
template<class ContextFactory , class Model , class RNG >
bool initialize_state_source (const std::string source, Eigen::VectorXd &cont_params, Model &model, RNG &base_rng, interface_callbacks::writer::base_writer &writer, ContextFactory &context_factory, bool enable_random_init=false, double R=2)
 Creates the initial state using the source parameter. More...
 
bool get_double_from_string (const std::string &s, double &val)
 Converts string to double. More...
 
template<class ContextFactory , class Model , class RNG >
bool initialize_state (const std::string &init, Eigen::VectorXd &cont_params, Model &model, RNG &base_rng, interface_callbacks::writer::base_writer &writer, ContextFactory &context_factory, bool enable_random_init=false, double init_r=2)
 Creates the initial state. More...
 

Function Documentation

bool stan::services::init::get_double_from_string ( const std::string &  s,
double &  val 
)

Converts string to double.

Returns true if it is able to convert the number, false otherwise.

Parameters
[in]sstring input
[out]valthe double value of the string if it is parsable as a double; else NaN

Definition at line 386 of file initialize_state.hpp.

template<class ContextFactory , class Model , class RNG >
bool stan::services::init::initialize_state ( const std::string &  init,
Eigen::VectorXd &  cont_params,
Model &  model,
RNG &  base_rng,
interface_callbacks::writer::base_writer writer,
ContextFactory &  context_factory,
bool  enable_random_init = false,
double  init_r = 2 
)

Creates the initial state.

Parameters
[in]initinit can either be "0", a number as a string, or a filename.
[out]cont_paramsthe initialized state. This should be the right size and set to 0.
[in,out]modelthe model. Side effects on model? I'm not quite sure
[in,out]base_rngthe random number generator. State may change.
[in,out]writerwriter callback for messages
[in,out]context_factoryan instantiated factory that implements the concept of a context_factory. This has one method that takes a string.
[in]enable_random_inittrue or false.
[in]init_ra double for the range of generating random inits. it's used for randomly generating partial inits

Definition at line 417 of file initialize_state.hpp.

template<class Model , class RNG >
bool stan::services::init::initialize_state_random ( const double  R,
Eigen::VectorXd &  cont_params,
Model &  model,
RNG &  base_rng,
interface_callbacks::writer::base_writer writer 
)

Initializes state to random uniform values within range.

Parameters
[in]Rvalid range of the initialization; must be greater than or equal to 0.
[out]cont_paramsthe initialized state. This should be the right size and set to 0.
[in,out]modelthe model. Side effects on model? I'm not quite sure
[in,out]base_rngthe random number generator. State may change.
[in,out]writerwriter callback for messages

Definition at line 194 of file initialize_state.hpp.

template<class ContextFactory , class Model , class RNG >
bool stan::services::init::initialize_state_source ( const std::string  source,
Eigen::VectorXd &  cont_params,
Model &  model,
RNG &  base_rng,
interface_callbacks::writer::base_writer writer,
ContextFactory &  context_factory,
bool  enable_random_init = false,
double  R = 2 
)

Creates the initial state using the source parameter.

Parameters
[in]sourcea string that the context_factory can interpret and provide a valid var_context
[out]cont_paramsthe initialized state. This should be the right size and set to 0.
[in,out]modelthe model. Side effects on model? I'm not quite sure
[in,out]base_rngthe random number generator. State may change.
[in,out]writerwriter callback for messages
[in,out]context_factoryan instantiated factory that implements the concept of a context_factory. This has one method that takes a string.
[in]enable_random_inittrue or false
[in]Ra double for the range of generating random inits. it's used for randomly generating partial inits

Definition at line 346 of file initialize_state.hpp.

template<class ContextFactory , class Model , class RNG >
bool stan::services::init::initialize_state_source_and_random ( const std::string &  source,
double  R,
Eigen::VectorXd &  cont_params,
Model &  model,
RNG &  base_rng,
interface_callbacks::writer::base_writer writer,
ContextFactory &  context_factory 
)

Creates the initial state.

Parameters
[in]sourcea string that the context_factory can interpret and provide a valid var_context
[in]Ra double to specify the range of random inits
[out]cont_paramsthe initialized state. This should be the right size and set to 0.
[in,out]modelthe model. Side effects on model? I'm not quite sure
[in,out]base_rngthe random number generator. State may change.
[in,out]writerwriter callback for messages
[in,out]context_factoryan instantiated factory that implements the concept of a context_factory. This has one method that takes a string.

Definition at line 257 of file initialize_state.hpp.

template<class Model >
bool stan::services::init::initialize_state_values ( Eigen::VectorXd &  cont_params,
Model &  model,
interface_callbacks::writer::base_writer writer 
)

Definition at line 119 of file initialize_state.hpp.

template<class Model >
bool stan::services::init::initialize_state_zero ( Eigen::VectorXd &  cont_params,
Model &  model,
interface_callbacks::writer::base_writer writer 
)

Sets initial state to zero.

Parameters
[out]cont_paramsthe initialized state. This should be the right size and set to 0.
[in,out]modelthe model. Side effects on model? I'm not quite sure
[in,out]writerwriter callback for messages

Definition at line 172 of file initialize_state.hpp.


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