Stan  1.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Member Functions | List of all members
stan::io::var_context Class Referenceabstract

A var_reader reads array variables of integer and floating point type by name and dimension. More...

#include <var_context.hpp>

Inheritance diagram for stan::io::var_context:
stan::io::dump

Public Member Functions

virtual bool contains_r (const std::string &name) const =0
 Return true if the specified variable name is defined.
 
virtual std::vector< double > vals_r (const std::string &name) const =0
 Return the floating point values for the variable of the specified variable name in last-index-major order.
 
virtual std::vector< size_t > dims_r (const std::string &name) const =0
 Return the dimensions for the specified floating point variable.
 
virtual bool contains_i (const std::string &name) const =0
 Return true if the specified variable name has integer values.
 
virtual std::vector< int > vals_i (const std::string &name) const =0
 Return the integer values for the variable of the specified name in last-index-major order or the empty sequence if the variable is not defined.
 
virtual std::vector< size_t > dims_i (const std::string &name) const =0
 Return the dimensions of the specified floating point variable.
 
virtual void names_r (std::vector< std::string > &names) const =0
 Return a list of the names of the floating point variables in the context.
 
virtual void names_i (std::vector< std::string > &names) const =0
 Return a list of the names of the integer variables in the context.
 

Detailed Description

A var_reader reads array variables of integer and floating point type by name and dimension.

An array's dimensionality is described by a sequence of (unsigned) integers. For instance, (7, 2, 3) picks out a 7 by 2 by 3 array. The empty dimensionality sequence () is used for scalars.

Multidimensional arrays are stored in column-major order, meaning the first index changes the most quickly.

If a variable has integer variables, it should return those integer values cast to floating point values when accessed through the floating-point methods.

Definition at line 28 of file var_context.hpp.

Member Function Documentation

virtual bool stan::io::var_context::contains_i ( const std::string &  name) const
pure virtual

Return true if the specified variable name has integer values.

Parameters
nameName of variable.
Returns
true if an integer variable of the specified name is defined.

Implemented in stan::io::dump.

virtual bool stan::io::var_context::contains_r ( const std::string &  name) const
pure virtual

Return true if the specified variable name is defined.

This method should return true even if the values are all integers.

Parameters
nameName of variable.
Returns
true if the variable exists with real values.

Implemented in stan::io::dump.

virtual std::vector<size_t> stan::io::var_context::dims_i ( const std::string &  name) const
pure virtual

Return the dimensions of the specified floating point variable.

If the variable doesn't exist (or if it is a scalar), the return result should be the empty vector.

Parameters
nameName of variable.
Returns
Sequence of dimensions for the variable.

Implemented in stan::io::dump.

virtual std::vector<size_t> stan::io::var_context::dims_r ( const std::string &  name) const
pure virtual

Return the dimensions for the specified floating point variable.

If the variable doesn't exist or if it is a scalar, the return result should be the empty vector.

Parameters
nameName of variable.
Returns
Sequence of dimensions for the variable.

Implemented in stan::io::dump.

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

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

Parameters
namesVector to store the list of names in.

Implemented in stan::io::dump.

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

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

Parameters
namesVector to store the list of names in.

Implemented in stan::io::dump.

virtual std::vector<int> stan::io::var_context::vals_i ( const std::string &  name) const
pure virtual

Return the integer values for the variable of the specified name in last-index-major order or the empty sequence if the variable is not defined.

Parameters
nameName of variable.
Returns
Sequence of integer values.

Implemented in stan::io::dump.

virtual std::vector<double> stan::io::var_context::vals_r ( const std::string &  name) const
pure virtual

Return the floating point values for the variable of the specified variable name in last-index-major order.

This method should cast integers to floating point values if the values of the named variable are all integers.

If there is no variable of the specified name, the empty vector is returned.

Parameters
nameName of variable.
Returns
Sequence of values for the named variable.

Implemented in stan::io::dump.


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

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