![]() |
Stan
1.0
probability, sampling & optimization
|
A var_reader reads array variables of integer and floating point type by name and dimension.
More...
#include <var_context.hpp>
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. | |
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.
|
pure virtual |
Return true if the specified variable name has integer values.
| name | Name of variable. |
true if an integer variable of the specified name is defined. Implemented in stan::io::dump.
|
pure virtual |
Return true if the specified variable name is defined.
This method should return true even if the values are all integers.
| name | Name of variable. |
true if the variable exists with real values. Implemented in stan::io::dump.
|
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.
| name | Name of variable. |
Implemented in stan::io::dump.
|
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.
| name | Name of variable. |
Implemented in stan::io::dump.
|
pure virtual |
Return a list of the names of the integer variables in the context.
| names | Vector to store the list of names in. |
Implemented in stan::io::dump.
|
pure virtual |
Return a list of the names of the floating point variables in the context.
| names | Vector to store the list of names in. |
Implemented in stan::io::dump.
|
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.
| name | Name of variable. |
Implemented in stan::io::dump.
|
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.
| name | Name of variable. |
Implemented in stan::io::dump.