Stan  2.10.0
probability, sampling & optimization
Public Member Functions | List of all members
stan::io::array_var_context Class Reference

An array_var_context object represents a named arrays with dimensions constructed from an array, a vector of names, and a vector of all dimensions for each element. More...

#include <array_var_context.hpp>

Inheritance diagram for stan::io::array_var_context:
stan::io::var_context

Public Member Functions

 array_var_context (const std::vector< std::string > &names_r, const std::vector< double > &values_r, const std::vector< std::vector< size_t > > &dim_r)
 Construct an array_var_context from only real value arrays. More...
 
 array_var_context (const std::vector< std::string > &names_i, const std::vector< int > &values_i, const std::vector< std::vector< size_t > > &dim_i)
 Construct an array_var_context from only integer value arrays. More...
 
 array_var_context (const std::vector< std::string > &names_r, const std::vector< double > &values_r, const std::vector< std::vector< size_t > > &dim_r, const std::vector< std::string > &names_i, const std::vector< int > &values_i, const std::vector< std::vector< size_t > > &dim_i)
 Construct an array_var_context from arrays of both double and integer separately. More...
 
bool contains_r (const std::string &name) const
 Return true if this dump contains the specified variable name is defined. More...
 
bool contains_i (const std::string &name) const
 Return true if this dump contains an integer valued array with the specified name. More...
 
std::vector< double > vals_r (const std::string &name) const
 Return the double values for the variable with the specified name or null. More...
 
std::vector< size_t > dims_r (const std::string &name) const
 Return the dimensions for the double variable with the specified name. More...
 
std::vector< int > vals_i (const std::string &name) const
 Return the integer values for the variable with the specified name. More...
 
std::vector< size_t > dims_i (const std::string &name) const
 Return the dimensions for the integer variable with the specified name. More...
 
virtual void names_r (std::vector< std::string > &names) const
 Return a list of the names of the floating point variables in the dump. More...
 
virtual void names_i (std::vector< std::string > &names) const
 Return a list of the names of the integer variables in the dump. More...
 
bool remove (const std::string &name)
 Remove variable from the object. More...
 
- Public Member Functions inherited from stan::io::var_context
virtual ~var_context ()
 
void add_vec (std::stringstream &msg, const std::vector< size_t > &dims) const
 
void validate_dims (const std::string &stage, const std::string &name, const std::string &base_type, const std::vector< size_t > &dims_declared) const
 

Additional Inherited Members

- Static Public Member Functions inherited from stan::io::var_context
static std::vector< size_t > to_vec ()
 
static std::vector< size_t > to_vec (size_t n1)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3, size_t n4)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3, size_t n4, size_t n5)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, size_t n6)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, size_t n6, size_t n7)
 
static std::vector< size_t > to_vec (size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, size_t n6, size_t n7, size_t n8)
 

Detailed Description

An array_var_context object represents a named arrays with dimensions constructed from an array, a vector of names, and a vector of all dimensions for each element.

Definition at line 31 of file array_var_context.hpp.

Constructor & Destructor Documentation

stan::io::array_var_context::array_var_context ( const std::vector< std::string > &  names_r,
const std::vector< double > &  values_r,
const std::vector< std::vector< size_t > > &  dim_r 
)
inline

Construct an array_var_context from only real value arrays.

Parameters
names_rnames for each element
values_ra vector of double values for all elements
dim_ra vector of dimensions

Definition at line 116 of file array_var_context.hpp.

stan::io::array_var_context::array_var_context ( const std::vector< std::string > &  names_i,
const std::vector< int > &  values_i,
const std::vector< std::vector< size_t > > &  dim_i 
)
inline

Construct an array_var_context from only integer value arrays.

Parameters
names_inames for each element
values_ia vector of integer values for all elements
dim_ia vector of dimensions

Definition at line 129 of file array_var_context.hpp.

stan::io::array_var_context::array_var_context ( const std::vector< std::string > &  names_r,
const std::vector< double > &  values_r,
const std::vector< std::vector< size_t > > &  dim_r,
const std::vector< std::string > &  names_i,
const std::vector< int > &  values_i,
const std::vector< std::vector< size_t > > &  dim_i 
)
inline

Construct an array_var_context from arrays of both double and integer separately.

Definition at line 140 of file array_var_context.hpp.

Member Function Documentation

bool stan::io::array_var_context::contains_i ( const std::string &  name) const
inlinevirtual

Return true if this dump contains an integer valued array with the specified name.

Parameters
nameVariable name to test.
Returns
true if the variable name has an integer array value.

Implements stan::io::var_context.

Definition at line 170 of file array_var_context.hpp.

bool stan::io::array_var_context::contains_r ( const std::string &  name) const
inlinevirtual

Return true if this dump contains the specified variable name is defined.

This method returns true even if the values are all integers.

Parameters
nameVariable name to test.
Returns
true if the variable exists.

Implements stan::io::var_context.

Definition at line 158 of file array_var_context.hpp.

std::vector<size_t> stan::io::array_var_context::dims_i ( const std::string &  name) const
inlinevirtual

Return the dimensions for the integer variable with the specified name.

Parameters
nameName of variable.
Returns
Dimensions of variable.

Implements stan::io::var_context.

Definition at line 232 of file array_var_context.hpp.

std::vector<size_t> stan::io::array_var_context::dims_r ( const std::string &  name) const
inlinevirtual

Return the dimensions for the double variable with the specified name.

Parameters
nameName of variable.
Returns
Dimensions of variable.

Implements stan::io::var_context.

Definition at line 202 of file array_var_context.hpp.

virtual void stan::io::array_var_context::names_i ( std::vector< std::string > &  names) const
inlinevirtual

Return a list of the names of the integer variables in the dump.

Parameters
namesVector to store the list of names in.

Implements stan::io::var_context.

Definition at line 261 of file array_var_context.hpp.

virtual void stan::io::array_var_context::names_r ( std::vector< std::string > &  names) const
inlinevirtual

Return a list of the names of the floating point variables in the dump.

Parameters
namesVector to store the list of names in.

Implements stan::io::var_context.

Definition at line 245 of file array_var_context.hpp.

bool stan::io::array_var_context::remove ( const std::string &  name)
inline

Remove variable from the object.

Parameters
nameName of the variable to remove.
Returns
If variable is removed returns true, else returns false.

Definition at line 278 of file array_var_context.hpp.

std::vector<int> stan::io::array_var_context::vals_i ( const std::string &  name) const
inlinevirtual

Return the integer values for the variable with the specified name.

Parameters
nameName of variable.
Returns
Values.

Implements stan::io::var_context.

Definition at line 218 of file array_var_context.hpp.

std::vector<double> stan::io::array_var_context::vals_r ( const std::string &  name) const
inlinevirtual

Return the double values for the variable with the specified name or null.

Parameters
nameName of variable.
Returns
Values of variable.

Implements stan::io::var_context.

Definition at line 181 of file array_var_context.hpp.


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

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