A stream-based writer for integer, scalar, vector, matrix and array data types, which transforms from constrained to a sequence of constrained variables.
More...
|
| | writer (std::vector< T > &data_r, std::vector< int > &data_i) |
| | Construct a writer that writes to the specified scalar and integer vectors. More...
|
| |
| | ~writer () |
| | Destroy this writer. More...
|
| |
| std::vector< T > & | data_r () |
| | Return a reference to the underlying vector of real values that have been written. More...
|
| |
| std::vector< int > & | data_i () |
| | Return a reference to the underlying vector of integer values that have been written. More...
|
| |
| void | integer (int n) |
| | Write the specified integer to the sequence of integer values. More...
|
| |
| void | scalar_unconstrain (T &y) |
| | Write the unconstrained value corresponding to the specified scalar. More...
|
| |
| void | scalar_pos_unconstrain (T &y) |
| | Write the unconstrained value corresponding to the specified positive-constrained scalar. More...
|
| |
| void | scalar_lb_unconstrain (double lb, T &y) |
| | Return the unconstrained version of the specified input, which is constrained to be above the specified lower bound. More...
|
| |
| void | scalar_ub_unconstrain (double ub, T &y) |
| | Write the unconstrained value corresponding to the specified lower-bounded value. More...
|
| |
| void | scalar_lub_unconstrain (double lb, double ub, T &y) |
| | Write the unconstrained value corresponding to the specified value with the specified bounds. More...
|
| |
| void | corr_unconstrain (T &y) |
| | Write the unconstrained value corresponding to the specified correlation-constrained variable. More...
|
| |
| void | prob_unconstrain (T &y) |
| | Write the unconstrained value corresponding to the specified probability value. More...
|
| |
| void | ordered_unconstrain (vector_t &y) |
| | Write the unconstrained vector that corresponds to the specified ascendingly ordered vector. More...
|
| |
| void | positive_ordered_unconstrain (vector_t &y) |
| | Write the unconstrained vector that corresponds to the specified postiive ascendingly ordered vector. More...
|
| |
| void | vector_unconstrain (const vector_t &y) |
| | Write the specified unconstrained vector. More...
|
| |
| void | row_vector_unconstrain (const vector_t &y) |
| | Write the specified unconstrained vector. More...
|
| |
| void | matrix_unconstrain (const matrix_t &y) |
| | Write the specified unconstrained matrix. More...
|
| |
| void | vector_lb_unconstrain (double lb, vector_t &y) |
| |
| void | row_vector_lb_unconstrain (double lb, row_vector_t &y) |
| |
| void | matrix_lb_unconstrain (double lb, matrix_t &y) |
| |
| void | vector_ub_unconstrain (double ub, vector_t &y) |
| |
| void | row_vector_ub_unconstrain (double ub, row_vector_t &y) |
| |
| void | matrix_ub_unconstrain (double ub, matrix_t &y) |
| |
| void | vector_lub_unconstrain (double lb, double ub, vector_t &y) |
| |
| void | row_vector_lub_unconstrain (double lb, double ub, row_vector_t &y) |
| |
| void | matrix_lub_unconstrain (double lb, double ub, matrix_t &y) |
| |
| void | simplex_unconstrain (vector_t &y) |
| | Write the unconstrained vector corresponding to the specified simplex value. More...
|
| |
| void | corr_matrix_unconstrain (matrix_t &y) |
| | Writes the unconstrained correlation matrix corresponding to the specified constrained correlation matrix. More...
|
| |
| void | cov_matrix_unconstrain (matrix_t &y) |
| | Writes the unconstrained covariance matrix corresponding to the specified constrained correlation matrix. More...
|
| |
template<typename T>
class stan::io::writer< T >
A stream-based writer for integer, scalar, vector, matrix and array data types, which transforms from constrained to a sequence of constrained variables.
This class converts constrained values to unconstrained values with mappings that invert those defined in stan::io::reader to convert unconstrained values to constrained values.
- Template Parameters
-
Definition at line 23 of file writer.hpp.
Write the unconstrained vector that corresponds to the specified ascendingly ordered vector.
The unconstraining transform is defined for input vector y to produce an output vector x of the same size, defined by x[0] = log(y[0]) and by x[k] = log(y[k] - y[k-1]) for k > 0. This unconstraining transform inverts the constraining transform specified in ordered_constrain(size_t).
- Parameters
-
| y | Ascendingly ordered vector. |
- Returns
- Unconstrained vector corresponding to the specified vector.
- Exceptions
-
| std::runtime_error | if vector is not in ascending order. |
Definition at line 217 of file writer.hpp.
Write the unconstrained vector that corresponds to the specified postiive ascendingly ordered vector.
The unconstraining transform is defined for input vector y to produce an output vector x of the same size, defined by x[0] = log(y[0]) and by x[k] = log(y[k] - y[k-1]) for k > 0. This unconstraining transform inverts the constraining transform specified in positive_ordered_constrain(size_t).
- Parameters
-
| y | Positive ascendingly ordered vector. |
- Returns
- Unconstrained vector corresponding to the specified vector.
- Exceptions
-
| std::runtime_error | if vector is not in ascending order. |
Definition at line 241 of file writer.hpp.
Return the unconstrained version of the specified input, which is constrained to be above the specified lower bound.
The unconstraining transform is log(y - lb), which inverts the constraining transform defined in reader::scalar_lb_constrain(double),
- Parameters
-
| lb | Lower bound. |
| y | Lower-bounded value. |
- Exceptions
-
| std::runtime_error | if y is lower than the lower bound provided. |
Definition at line 129 of file writer.hpp.
Write the unconstrained vector corresponding to the specified simplex value.
If the specified constrained simplex is of size K, the returned unconstrained vector is of size K-1.
The transform takes y = y[1],...,y[K] and produces the unconstrained vector x = log(y[1]) - log(y[K]), ..., log(y[K-1]) - log(y[K]). This inverts the constraining transform of simplex_constrain(size_t).
- Parameters
-
| y | Simplex constrained value. |
- Returns
- Unconstrained value.
- Exceptions
-
| std::runtime_error | if the vector is not a simplex. |
Definition at line 342 of file writer.hpp.