Stan  2.10.0
probability, sampling & optimization
Public Types | Public Member Functions | List of all members
stan::io::reader< T > Class Template Reference

A stream-based reader for integer, scalar, vector, matrix and array data types, with Jacobian calculations. More...

#include <reader.hpp>

Public Types

typedef Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > matrix_t
 
typedef Eigen::Matrix< T, Eigen::Dynamic, 1 > vector_t
 
typedef Eigen::Matrix< T, 1, Eigen::Dynamic > row_vector_t
 
typedef Eigen::Map< matrix_tmap_matrix_t
 
typedef Eigen::Map< vector_tmap_vector_t
 
typedef Eigen::Map< row_vector_tmap_row_vector_t
 

Public Member Functions

 reader (std::vector< T > &data_r, std::vector< int > &data_i)
 Construct a variable reader using the specified vectors as the source of scalar and integer values for data. More...
 
 ~reader ()
 Destroy this variable reader. More...
 
size_t available ()
 Return the number of scalars remaining to be read. More...
 
size_t available_i ()
 Return the number of integers remaining to be read. More...
 
int integer ()
 Return the next integer in the integer sequence. More...
 
int integer_constrain ()
 Return the next integer in the integer sequence. More...
 
int integer_constrain (T &)
 Return the next integer in the integer sequence. More...
 
scalar ()
 Return the next scalar in the sequence. More...
 
scalar_constrain ()
 Return the next scalar. More...
 
scalar_constrain (T &)
 Return the next scalar in the sequence, incrementing the specified reference with the log absolute Jacobian determinant. More...
 
std::vector< T > std_vector (size_t m)
 Return a standard library vector of the specified dimensionality made up of the next scalars. More...
 
vector_t vector (size_t m)
 Return a column vector of specified dimensionality made up of the next scalars. More...
 
vector_t vector_constrain (size_t m)
 Return a column vector of specified dimensionality made up of the next scalars. More...
 
vector_t vector_constrain (size_t m, T &)
 Return a column vector of specified dimensionality made up of the next scalars. More...
 
row_vector_t row_vector (size_t m)
 Return a row vector of specified dimensionality made up of the next scalars. More...
 
row_vector_t row_vector_constrain (size_t m)
 Return a row vector of specified dimensionality made up of the next scalars. More...
 
row_vector_t row_vector_constrain (size_t m, T &)
 Return a row vector of specified dimensionality made up of the next scalars. More...
 
matrix_t matrix (size_t m, size_t n)
 Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order. More...
 
matrix_t matrix_constrain (size_t m, size_t n)
 Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order. More...
 
matrix_t matrix_constrain (size_t m, size_t n, T &)
 Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order. More...
 
int integer_lb (int lb)
 Return the next integer, checking that it is greater than or equal to the specified lower bound. More...
 
int integer_lb_constrain (int lb)
 Return the next integer, checking that it is greater than or equal to the specified lower bound. More...
 
int integer_lb_constrain (int lb, T &)
 Return the next integer, checking that it is greater than or equal to the specified lower bound. More...
 
int integer_ub (int ub)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
int integer_ub_constrain (int ub)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
int integer_ub_constrain (int ub, T &)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
int integer_lub (int lb, int ub)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
int integer_lub_constrain (int lb, int ub)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
int integer_lub_constrain (int lb, int ub, T &)
 Return the next integer, checking that it is less than or equal to the specified upper bound. More...
 
scalar_pos ()
 Return the next scalar, checking that it is positive. More...
 
scalar_pos_constrain ()
 Return the next scalar, transformed to be positive. More...
 
scalar_pos_constrain (T &lp)
 Return the next scalar transformed to be positive, incrementing the specified reference with the log absolute determinant of the Jacobian. More...
 
template<typename TL >
scalar_lb (const TL lb)
 Return the next scalar, checking that it is greater than or equal to the specified lower bound. More...
 
template<typename TL >
scalar_lb_constrain (const TL lb)
 Return the next scalar transformed to have the specified lower bound. More...
 
template<typename TL >
scalar_lb_constrain (const TL lb, T &lp)
 Return the next scalar transformed to have the specified lower bound, incrementing the specified reference with the log of the absolute Jacobian determinant of the transform. More...
 
template<typename TU >
scalar_ub (TU ub)
 Return the next scalar, checking that it is less than or equal to the specified upper bound. More...
 
template<typename TU >
scalar_ub_constrain (const TU ub)
 Return the next scalar transformed to have the specified upper bound. More...
 
template<typename TU >
scalar_ub_constrain (const TU ub, T &lp)
 Return the next scalar transformed to have the specified upper bound, incrementing the specified reference with the log of the absolute Jacobian determinant of the transform. More...
 
template<typename TL , typename TU >
scalar_lub (const TL lb, const TU ub)
 Return the next scalar, checking that it is between the specified lower and upper bound. More...
 
template<typename TL , typename TU >
scalar_lub_constrain (const TL lb, const TU ub)
 Return the next scalar transformed to be between the specified lower and upper bounds. More...
 
template<typename TL , typename TU >
scalar_lub_constrain (TL lb, TU ub, T &lp)
 Return the next scalar transformed to be between the the specified lower and upper bounds. More...
 
prob ()
 Return the next scalar, checking that it is a valid value for a probability, between 0 (inclusive) and 1 (inclusive). More...
 
prob_constrain ()
 Return the next scalar transformed to be a probability between 0 and 1. More...
 
prob_constrain (T &lp)
 Return the next scalar transformed to be a probability between 0 and 1, incrementing the specified reference with the log of the absolute Jacobian determinant. More...
 
corr ()
 Return the next scalar, checking that it is a valid value for a correlation, between -1 (inclusive) and 1 (inclusive). More...
 
corr_constrain ()
 Return the next scalar transformed to be a correlation between -1 and 1. More...
 
corr_constrain (T &lp)
 Return the next scalar transformed to be a (partial) correlation between -1 and 1, incrementing the specified reference with the log of the absolute Jacobian determinant. More...
 
vector_t unit_vector (size_t k)
 Return a unit_vector of the specified size made up of the next scalars. More...
 
Eigen::Matrix< T, Eigen::Dynamic, 1 > unit_vector_constrain (size_t k)
 Return the next unit_vector transformed vector of the specified length. More...
 
vector_t unit_vector_constrain (size_t k, T &lp)
 Return the next unit_vector of the specified size (using one fewer unconstrained scalars), incrementing the specified reference with the log absolute Jacobian determinant. More...
 
vector_t simplex (size_t k)
 Return a simplex of the specified size made up of the next scalars. More...
 
Eigen::Matrix< T, Eigen::Dynamic, 1 > simplex_constrain (size_t k)
 Return the next simplex transformed vector of the specified length. More...
 
vector_t simplex_constrain (size_t k, T &lp)
 Return the next simplex of the specified size (using one fewer unconstrained scalars), incrementing the specified reference with the log absolute Jacobian determinant. More...
 
vector_t ordered (size_t k)
 Return the next vector of specified size containing values in ascending order. More...
 
vector_t ordered_constrain (size_t k)
 Return the next ordered vector of the specified length. More...
 
vector_t ordered_constrain (size_t k, T &lp)
 Return the next ordered vector of the specified size, incrementing the specified reference with the log absolute Jacobian of the determinant. More...
 
vector_t positive_ordered (size_t k)
 Return the next vector of specified size containing positive values in ascending order. More...
 
vector_t positive_ordered_constrain (size_t k)
 Return the next positive ordered vector of the specified length. More...
 
vector_t positive_ordered_constrain (size_t k, T &lp)
 Return the next positive_ordered vector of the specified size, incrementing the specified reference with the log absolute Jacobian of the determinant. More...
 
matrix_t cholesky_factor (size_t M, size_t N)
 Return the next Cholesky factor with the specified dimensionality, reading it directly without transforms. More...
 
matrix_t cholesky_factor_constrain (size_t M, size_t N)
 Return the next Cholesky factor with the specified dimensionality, reading from an unconstrained vector of the appropriate size. More...
 
matrix_t cholesky_factor_constrain (size_t M, size_t N, T &lp)
 Return the next Cholesky factor with the specified dimensionality, reading from an unconstrained vector of the appropriate size, and increment the log probability reference with the log Jacobian adjustment for the transform. More...
 
matrix_t cholesky_corr (size_t K)
 Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading it directly without transforms. More...
 
matrix_t cholesky_corr_constrain (size_t K)
 Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading from an unconstrained vector of the appropriate size. More...
 
matrix_t cholesky_corr_constrain (size_t K, T &lp)
 Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading from an unconstrained vector of the appropriate size, and increment the log probability reference with the log Jacobian adjustment for the transform. More...
 
matrix_t cov_matrix (size_t k)
 Return the next covariance matrix with the specified dimensionality. More...
 
matrix_t cov_matrix_constrain (size_t k)
 Return the next covariance matrix of the specified dimensionality. More...
 
matrix_t cov_matrix_constrain (size_t k, T &lp)
 Return the next covariance matrix of the specified dimensionality, incrementing the specified reference with the log absolute Jacobian determinant. More...
 
matrix_t corr_matrix (size_t k)
 Returns the next correlation matrix of the specified dimensionality. More...
 
matrix_t corr_matrix_constrain (size_t k)
 Return the next correlation matrix of the specified dimensionality. More...
 
matrix_t corr_matrix_constrain (size_t k, T &lp)
 Return the next correlation matrix of the specified dimensionality, incrementing the specified reference with the log absolute Jacobian determinant. More...
 
template<typename TL >
vector_t vector_lb (const TL lb, size_t m)
 
template<typename TL >
vector_t vector_lb_constrain (const TL lb, size_t m)
 
template<typename TL >
vector_t vector_lb_constrain (const TL lb, size_t m, T &lp)
 
template<typename TL >
row_vector_t row_vector_lb (const TL lb, size_t m)
 
template<typename TL >
row_vector_t row_vector_lb_constrain (const TL lb, size_t m)
 
template<typename TL >
row_vector_t row_vector_lb_constrain (const TL lb, size_t m, T &lp)
 
template<typename TL >
matrix_t matrix_lb (const TL lb, size_t m, size_t n)
 
template<typename TL >
matrix_t matrix_lb_constrain (const TL lb, size_t m, size_t n)
 
template<typename TL >
matrix_t matrix_lb_constrain (const TL lb, size_t m, size_t n, T &lp)
 
template<typename TU >
vector_t vector_ub (const TU ub, size_t m)
 
template<typename TU >
vector_t vector_ub_constrain (const TU ub, size_t m)
 
template<typename TU >
vector_t vector_ub_constrain (const TU ub, size_t m, T &lp)
 
template<typename TU >
row_vector_t row_vector_ub (const TU ub, size_t m)
 
template<typename TU >
row_vector_t row_vector_ub_constrain (const TU ub, size_t m)
 
template<typename TU >
row_vector_t row_vector_ub_constrain (const TU ub, size_t m, T &lp)
 
template<typename TU >
matrix_t matrix_ub (const TU ub, size_t m, size_t n)
 
template<typename TU >
matrix_t matrix_ub_constrain (const TU ub, size_t m, size_t n)
 
template<typename TU >
matrix_t matrix_ub_constrain (const TU ub, size_t m, size_t n, T &lp)
 
template<typename TL , typename TU >
vector_t vector_lub (const TL lb, const TU ub, size_t m)
 
template<typename TL , typename TU >
vector_t vector_lub_constrain (const TL lb, const TU ub, size_t m)
 
template<typename TL , typename TU >
vector_t vector_lub_constrain (const TL lb, const TU ub, size_t m, T &lp)
 
template<typename TL , typename TU >
row_vector_t row_vector_lub (const TL lb, const TU ub, size_t m)
 
template<typename TL , typename TU >
row_vector_t row_vector_lub_constrain (const TL lb, const TU ub, size_t m)
 
template<typename TL , typename TU >
row_vector_t row_vector_lub_constrain (const TL lb, const TU ub, size_t m, T &lp)
 
template<typename TL , typename TU >
matrix_t matrix_lub (const TL lb, const TU ub, size_t m, size_t n)
 
template<typename TL , typename TU >
matrix_t matrix_lub_constrain (const TL lb, const TU ub, size_t m, size_t n)
 
template<typename TL , typename TU >
matrix_t matrix_lub_constrain (const TL lb, const TU ub, size_t m, size_t n, T &lp)
 

Detailed Description

template<typename T>
class stan::io::reader< T >

A stream-based reader for integer, scalar, vector, matrix and array data types, with Jacobian calculations.

The template parameter T represents the type of scalars and the values in vectors and matrices. The only requirement on the template type T is that a double can be copied into it, as in

T t = 0.0;

This includes double itself and the reverse-mode algorithmic differentiation class stan::math::var.

For transformed values, the scalar type parameter T must support the transforming operations, such as exp(x) for positive-bounded variables. It must also support equality and inequality tests with double values.

Template Parameters
TBasic scalar type.

Definition at line 58 of file reader.hpp.

Member Typedef Documentation

template<typename T >
typedef Eigen::Map<matrix_t> stan::io::reader< T >::map_matrix_t

Definition at line 88 of file reader.hpp.

template<typename T >
typedef Eigen::Map<row_vector_t> stan::io::reader< T >::map_row_vector_t

Definition at line 90 of file reader.hpp.

template<typename T >
typedef Eigen::Map<vector_t> stan::io::reader< T >::map_vector_t

Definition at line 89 of file reader.hpp.

template<typename T >
typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> stan::io::reader< T >::matrix_t

Definition at line 84 of file reader.hpp.

template<typename T >
typedef Eigen::Matrix<T, 1, Eigen::Dynamic> stan::io::reader< T >::row_vector_t

Definition at line 86 of file reader.hpp.

template<typename T >
typedef Eigen::Matrix<T, Eigen::Dynamic, 1> stan::io::reader< T >::vector_t

Definition at line 85 of file reader.hpp.

Constructor & Destructor Documentation

template<typename T >
stan::io::reader< T >::reader ( std::vector< T > &  data_r,
std::vector< int > &  data_i 
)
inline

Construct a variable reader using the specified vectors as the source of scalar and integer values for data.

This class holds a reference to the specified data vectors.

Attempting to read beyond the end of the data or integer value sequences raises a runtime exception.

Parameters
data_rSequence of scalar values.
data_iSequence of integer values.

Definition at line 104 of file reader.hpp.

template<typename T >
stan::io::reader< T >::~reader ( )
inline

Destroy this variable reader.

Definition at line 115 of file reader.hpp.

Member Function Documentation

template<typename T >
size_t stan::io::reader< T >::available ( )
inline

Return the number of scalars remaining to be read.

Returns
Number of scalars left to read.

Definition at line 122 of file reader.hpp.

template<typename T >
size_t stan::io::reader< T >::available_i ( )
inline

Return the number of integers remaining to be read.

Returns
Number of integers left to read.

Definition at line 131 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_corr ( size_t  K)
inline

Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading it directly without transforms.

Parameters
KRows and columns of Cholesky factor
Returns
Next Cholesky factor for a correlation matrix.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor for a correlation matrix.

Definition at line 1041 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_corr_constrain ( size_t  K)
inline

Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading from an unconstrained vector of the appropriate size.

Parameters
KRows and columns of Cholesky factor.
Returns
Next Cholesky factor for a correlation matrix.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor for a correlation matrix.

Definition at line 1059 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_corr_constrain ( size_t  K,
T &  lp 
)
inline

Return the next Cholesky factor for a correlation matrix with the specified dimensionality, reading from an unconstrained vector of the appropriate size, and increment the log probability reference with the log Jacobian adjustment for the transform.

Parameters
KRows and columns of Cholesky factor
lpLog probability reference to increment.
Returns
Next Cholesky factor for a correlation matrix.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor for a correlation matrix.

Definition at line 1077 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_factor ( size_t  M,
size_t  N 
)
inline

Return the next Cholesky factor with the specified dimensionality, reading it directly without transforms.

Parameters
MRows of Cholesky factor
NColumns of Cholesky factor
Returns
Next Cholesky factor.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor.

Definition at line 988 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_factor_constrain ( size_t  M,
size_t  N 
)
inline

Return the next Cholesky factor with the specified dimensionality, reading from an unconstrained vector of the appropriate size.

Parameters
MRows of Cholesky factor
NColumns of Cholesky factor
Returns
Next Cholesky factor.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor.

Definition at line 1006 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cholesky_factor_constrain ( size_t  M,
size_t  N,
T &  lp 
)
inline

Return the next Cholesky factor with the specified dimensionality, reading from an unconstrained vector of the appropriate size, and increment the log probability reference with the log Jacobian adjustment for the transform.

Parameters
MRows of Cholesky factor
NColumns of Cholesky factor
[in,out]lplog probability
Returns
Next Cholesky factor.
Exceptions
std::domain_errorif the matrix is not a valid Cholesky factor.

Definition at line 1024 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::corr ( )
inline

Return the next scalar, checking that it is a valid value for a correlation, between -1 (inclusive) and 1 (inclusive).

See stan::math::check_bounded(T).

Returns
Next correlation value.
Exceptions
std::runtime_errorif the value is not valid for a correlation

Definition at line 757 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::corr_constrain ( )
inline

Return the next scalar transformed to be a correlation between -1 and 1.

See stan::math::corr_constrain(T).

Returns
The next scalar transformed to a correlation.

Definition at line 772 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::corr_constrain ( T &  lp)
inline

Return the next scalar transformed to be a (partial) correlation between -1 and 1, incrementing the specified reference with the log of the absolute Jacobian determinant.

See stan::math::corr_constrain(T,T&).

Parameters
lpThe reference to the variable holding the log probability to increment.
Returns
The next scalar transformed to a correlation.

Definition at line 787 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::corr_matrix ( size_t  k)
inline

Returns the next correlation matrix of the specified dimensionality.

See stan::math::check_corr_matrix(Matrix).

Parameters
kDimensionality of correlation matrix.
Returns
Next correlation matrix of the specified dimensionality.
Exceptions
std::runtime_errorif the matrix is not a correlation matrix

Definition at line 1141 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::corr_matrix_constrain ( size_t  k)
inline

Return the next correlation matrix of the specified dimensionality.

See stan::math::corr_matrix_constrain(Matrix).

Parameters
kDimensionality of correlation matrix.
Returns
Next correlation matrix of the specified dimensionality.

Definition at line 1156 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::corr_matrix_constrain ( size_t  k,
T &  lp 
)
inline

Return the next correlation matrix of the specified dimensionality, incrementing the specified reference with the log absolute Jacobian determinant.

See stan::math::corr_matrix_constrain(Matrix,T&).

Parameters
kDimensionality of the (square) correlation matrix.
lpLog probability reference to increment.
Returns
The next correlation matrix of the specified dimensionality.

Definition at line 1171 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cov_matrix ( size_t  k)
inline

Return the next covariance matrix with the specified dimensionality.

See stan::math::check_cov_matrix(Matrix).

Parameters
kDimensionality of covariance matrix.
Returns
Next covariance matrix of the specified dimensionality.
Exceptions
std::runtime_errorif the matrix is not a valid covariance matrix

Definition at line 1095 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cov_matrix_constrain ( size_t  k)
inline

Return the next covariance matrix of the specified dimensionality.

See stan::math::cov_matrix_constrain(Matrix).

Parameters
kDimensionality of covariance matrix.
Returns
Next covariance matrix of the specified dimensionality.

Definition at line 1110 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::cov_matrix_constrain ( size_t  k,
T &  lp 
)
inline

Return the next covariance matrix of the specified dimensionality, incrementing the specified reference with the log absolute Jacobian determinant.

See stan::math::cov_matrix_constrain(Matrix,T&).

Parameters
kDimensionality of the (square) covariance matrix.
lpLog probability reference to increment.
Returns
The next covariance matrix of the specified dimensionality.

Definition at line 1126 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer ( )
inline

Return the next integer in the integer sequence.

Returns
Next integer value.

Definition at line 140 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_constrain ( )
inline

Return the next integer in the integer sequence.

This form is a convenience method to make compiling easier; its behavior is the same as int()

Returns
Next integer value.

Definition at line 154 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_constrain ( T &  )
inline

Return the next integer in the integer sequence.

This form is a convenience method to make compiling easier; its behavior is the same as integer()

Returns
Next integer value.

Definition at line 165 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lb ( int  lb)
inline

Return the next integer, checking that it is greater than or equal to the specified lower bound.

Parameters
lbLower bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not greater than or equal to the lower bound.

Definition at line 365 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lb_constrain ( int  lb)
inline

Return the next integer, checking that it is greater than or equal to the specified lower bound.

Parameters
lbLower bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not greater than or equal to the lower bound.

Definition at line 381 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lb_constrain ( int  lb,
T &   
)
inline

Return the next integer, checking that it is greater than or equal to the specified lower bound.

Parameters
lbLower bound. lp Log probability (ignored because no Jacobian)
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not greater than or equal to the lower bound.

Definition at line 394 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lub ( int  lb,
int  ub 
)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Even if the upper bounds and lower bounds are not consistent, the next integer value will be consumed.

Parameters
lbLower bound.
ubUpper bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 453 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lub_constrain ( int  lb,
int  ub 
)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Parameters
lbLower bound.
ubUpper bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 477 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_lub_constrain ( int  lb,
int  ub,
T &   
)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Parameters
lbLower bound.
ubUpper bound. lp Log probability (ignored because no Jacobian)
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 491 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_ub ( int  ub)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Parameters
ubUpper bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 408 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_ub_constrain ( int  ub)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Parameters
ubUpper bound.
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 424 of file reader.hpp.

template<typename T >
int stan::io::reader< T >::integer_ub_constrain ( int  ub,
T &   
)
inline

Return the next integer, checking that it is less than or equal to the specified upper bound.

Parameters
ubUpper bound. lp Log probability (ignored because no Jacobian)
Returns
Next integer read.
Exceptions
std::runtime_errorIf the next integer read is not less than or equal to the upper bound.

Definition at line 437 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::matrix ( size_t  m,
size_t  n 
)
inline

Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order.

Row-major reading means that if a matrix of m=2 rows and n=3 columns is reada and the next scalar values are 1,2,3,4,5,6, the result is

a = 1 4
    2 5
    3 6
Parameters
mNumber of rows.
nNumber of columns.
Returns
Eigen::Matrix made up of the next scalars.

Definition at line 315 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::matrix_constrain ( size_t  m,
size_t  n 
)
inline

Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order.

The constraint is a no-op. See matrix(size_t, size_t) for more information.

Parameters
mNumber of rows.
nNumber of columns.
Returns
Matrix made up of the next scalars.

Definition at line 331 of file reader.hpp.

template<typename T >
matrix_t stan::io::reader< T >::matrix_constrain ( size_t  m,
size_t  n,
T &   
)
inline

Return a matrix of the specified dimensionality made up of the next scalars arranged in column-major order.

The constraint is a no-op, hence the log probability is not incremented. See matrix(size_t, size_t) for more information.

Parameters
mNumber of rows.
nNumber of columns. lp Log probability to increment.
Returns
Matrix made up of the next scalars.

Definition at line 349 of file reader.hpp.

template<typename T >
template<typename TL >
matrix_t stan::io::reader< T >::matrix_lb ( const TL  lb,
size_t  m,
size_t  n 
)
inline

Definition at line 1226 of file reader.hpp.

template<typename T >
template<typename TL >
matrix_t stan::io::reader< T >::matrix_lb_constrain ( const TL  lb,
size_t  m,
size_t  n 
)
inline

Definition at line 1235 of file reader.hpp.

template<typename T >
template<typename TL >
matrix_t stan::io::reader< T >::matrix_lb_constrain ( const TL  lb,
size_t  m,
size_t  n,
T &  lp 
)
inline

Definition at line 1245 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
matrix_t stan::io::reader< T >::matrix_lub ( const TL  lb,
const TU  ub,
size_t  m,
size_t  n 
)
inline

Definition at line 1382 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
matrix_t stan::io::reader< T >::matrix_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m,
size_t  n 
)
inline

Definition at line 1392 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
matrix_t stan::io::reader< T >::matrix_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m,
size_t  n,
T &  lp 
)
inline

Definition at line 1402 of file reader.hpp.

template<typename T >
template<typename TU >
matrix_t stan::io::reader< T >::matrix_ub ( const TU  ub,
size_t  m,
size_t  n 
)
inline

Definition at line 1303 of file reader.hpp.

template<typename T >
template<typename TU >
matrix_t stan::io::reader< T >::matrix_ub_constrain ( const TU  ub,
size_t  m,
size_t  n 
)
inline

Definition at line 1312 of file reader.hpp.

template<typename T >
template<typename TU >
matrix_t stan::io::reader< T >::matrix_ub_constrain ( const TU  ub,
size_t  m,
size_t  n,
T &  lp 
)
inline

Definition at line 1322 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::ordered ( size_t  k)
inline

Return the next vector of specified size containing values in ascending order.

See stan::math::check_ordered(T) for behavior on failure.

Parameters
kSize of returned vector.
Returns
Vector of positive values in ascending order.

Definition at line 897 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::ordered_constrain ( size_t  k)
inline

Return the next ordered vector of the specified length.

See stan::math::ordered_constrain(Matrix).

Parameters
kLength of returned vector.
Returns
Next ordered vector of the specified length.

Definition at line 912 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::ordered_constrain ( size_t  k,
T &  lp 
)
inline

Return the next ordered vector of the specified size, incrementing the specified reference with the log absolute Jacobian of the determinant.

See stan::math::ordered_constrain(Matrix,T&).

Parameters
kSize of vector.
lpLog probability reference to increment.
Returns
Next ordered vector of the specified size.

Definition at line 927 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::positive_ordered ( size_t  k)
inline

Return the next vector of specified size containing positive values in ascending order.

See stan::math::check_positive_ordered(T) for behavior on failure.

Parameters
kSize of returned vector.
Returns
Vector of positive values in ascending order.

Definition at line 941 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::positive_ordered_constrain ( size_t  k)
inline

Return the next positive ordered vector of the specified length.

See stan::math::positive_ordered_constrain(Matrix).

Parameters
kLength of returned vector.
Returns
Next positive_ordered vector of the specified length.

Definition at line 957 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::positive_ordered_constrain ( size_t  k,
T &  lp 
)
inline

Return the next positive_ordered vector of the specified size, incrementing the specified reference with the log absolute Jacobian of the determinant.

See stan::math::positive_ordered_constrain(Matrix,T&).

Parameters
kSize of vector.
lpLog probability reference to increment.
Returns
Next positive_ordered vector of the specified size.

Definition at line 972 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::prob ( )
inline

Return the next scalar, checking that it is a valid value for a probability, between 0 (inclusive) and 1 (inclusive).

See stan::math::check_bounded(T).

Returns
Next probability value.

Definition at line 710 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::prob_constrain ( )
inline

Return the next scalar transformed to be a probability between 0 and 1.

See stan::math::prob_constrain(T).

Returns
The next scalar transformed to a probability.

Definition at line 725 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::prob_constrain ( T &  lp)
inline

Return the next scalar transformed to be a probability between 0 and 1, incrementing the specified reference with the log of the absolute Jacobian determinant.

See stan::math::prob_constrain(T).

Parameters
lpReference to log probability variable to increment.
Returns
The next scalar transformed to a probability.

Definition at line 739 of file reader.hpp.

template<typename T >
row_vector_t stan::io::reader< T >::row_vector ( size_t  m)
inline

Return a row vector of specified dimensionality made up of the next scalars.

Parameters
mNumber of rows in the vector to read.
Returns
Column vector made up of the next scalars.

Definition at line 267 of file reader.hpp.

template<typename T >
row_vector_t stan::io::reader< T >::row_vector_constrain ( size_t  m)
inline

Return a row vector of specified dimensionality made up of the next scalars.

The constraint is a no-op.

Parameters
mNumber of rows in the vector to read.
Returns
Column vector made up of the next scalars.

Definition at line 279 of file reader.hpp.

template<typename T >
row_vector_t stan::io::reader< T >::row_vector_constrain ( size_t  m,
T &   
)
inline

Return a row vector of specified dimensionality made up of the next scalars.

The constraint is a no-op, so the log probability is not incremented.

Parameters
mNumber of rows in the vector to read. lp Log probability to increment.
Returns
Column vector made up of the next scalars.

Definition at line 293 of file reader.hpp.

template<typename T >
template<typename TL >
row_vector_t stan::io::reader< T >::row_vector_lb ( const TL  lb,
size_t  m 
)
inline

Definition at line 1201 of file reader.hpp.

template<typename T >
template<typename TL >
row_vector_t stan::io::reader< T >::row_vector_lb_constrain ( const TL  lb,
size_t  m 
)
inline

Definition at line 1209 of file reader.hpp.

template<typename T >
template<typename TL >
row_vector_t stan::io::reader< T >::row_vector_lb_constrain ( const TL  lb,
size_t  m,
T &  lp 
)
inline

Definition at line 1218 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
row_vector_t stan::io::reader< T >::row_vector_lub ( const TL  lb,
const TU  ub,
size_t  m 
)
inline

Definition at line 1357 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
row_vector_t stan::io::reader< T >::row_vector_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m 
)
inline

Definition at line 1365 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
row_vector_t stan::io::reader< T >::row_vector_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m,
T &  lp 
)
inline

Definition at line 1374 of file reader.hpp.

template<typename T >
template<typename TU >
row_vector_t stan::io::reader< T >::row_vector_ub ( const TU  ub,
size_t  m 
)
inline

Definition at line 1278 of file reader.hpp.

template<typename T >
template<typename TU >
row_vector_t stan::io::reader< T >::row_vector_ub_constrain ( const TU  ub,
size_t  m 
)
inline

Definition at line 1286 of file reader.hpp.

template<typename T >
template<typename TU >
row_vector_t stan::io::reader< T >::row_vector_ub_constrain ( const TU  ub,
size_t  m,
T &  lp 
)
inline

Definition at line 1295 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar ( )
inline

Return the next scalar in the sequence.

Returns
Next scalar value.

Definition at line 176 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar_constrain ( )
inline

Return the next scalar.

For arbitrary scalars, constraint is a no-op.

Returns
Next scalar.

Definition at line 188 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar_constrain ( T &  )
inline

Return the next scalar in the sequence, incrementing the specified reference with the log absolute Jacobian determinant.

With no transformation, the Jacobian increment is a no-op.

See scalar_constrain().

log_prob Reference to log probability variable to increment.

Returns
Next scalar.

Definition at line 203 of file reader.hpp.

template<typename T >
template<typename TL >
T stan::io::reader< T >::scalar_lb ( const TL  lb)
inline

Return the next scalar, checking that it is greater than or equal to the specified lower bound.

See stan::math::check_greater_or_equal(T,double).

Parameters
lbLower bound.
Returns
Next scalar value.
Template Parameters
TLType of lower bound.
Exceptions
std::runtime_errorif the scalar is less than the specified lower bound

Definition at line 551 of file reader.hpp.

template<typename T >
template<typename TL >
T stan::io::reader< T >::scalar_lb_constrain ( const TL  lb)
inline

Return the next scalar transformed to have the specified lower bound.

See stan::math::lb_constrain(T,double).

Template Parameters
TLType of lower bound.
Parameters
lbLower bound on values.
Returns
Next scalar transformed to have the specified lower bound.

Definition at line 570 of file reader.hpp.

template<typename T >
template<typename TL >
T stan::io::reader< T >::scalar_lb_constrain ( const TL  lb,
T &  lp 
)
inline

Return the next scalar transformed to have the specified lower bound, incrementing the specified reference with the log of the absolute Jacobian determinant of the transform.

See stan::math::lb_constrain(T,double,T&).

Template Parameters
TLType of lower bound.
Parameters
lbLower bound on result.
lpReference to log probability variable to increment.

Definition at line 586 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
T stan::io::reader< T >::scalar_lub ( const TL  lb,
const TU  ub 
)
inline

Return the next scalar, checking that it is between the specified lower and upper bound.

See stan::math::check_bounded(T, double, double).

Template Parameters
TLType of lower bound.
TUType of upper bound.
Parameters
lbLower bound.
ubUpper bound.
Returns
Next scalar value.
Exceptions
std::runtime_errorif the scalar is not between the specified lower and upper bounds.

Definition at line 659 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
T stan::io::reader< T >::scalar_lub_constrain ( const TL  lb,
const TU  ub 
)
inline

Return the next scalar transformed to be between the specified lower and upper bounds.

See stan::math::lub_constrain(T, double, double).

Template Parameters
TLType of lower bound.
TUType of upper bound.
Parameters
lbLower bound.
ubUpper bound.
Returns
Next scalar transformed to fall between the specified bounds.

Definition at line 680 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
T stan::io::reader< T >::scalar_lub_constrain ( TL  lb,
TU  ub,
T &  lp 
)
inline

Return the next scalar transformed to be between the the specified lower and upper bounds.

See stan::math::lub_constrain(T, double, double, T&).

Parameters
lbLower bound.
ubUpper bound.
lpReference to log probability variable to increment.
Template Parameters
TType of scalar.
TLType of lower bound.
TUType of upper bound.

Definition at line 698 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar_pos ( )
inline

Return the next scalar, checking that it is positive.

See stan::math::check_positive(T).

Returns
Next positive scalar.
Exceptions
std::runtime_errorif x is not positive

Definition at line 506 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar_pos_constrain ( )
inline

Return the next scalar, transformed to be positive.

See stan::math::positive_constrain(T).

Returns
The next scalar transformed to be positive.

Definition at line 520 of file reader.hpp.

template<typename T >
T stan::io::reader< T >::scalar_pos_constrain ( T &  lp)
inline

Return the next scalar transformed to be positive, incrementing the specified reference with the log absolute determinant of the Jacobian.

See stan::math::positive_constrain(T,T&).

Parameters
lpReference to log probability variable to increment.
Returns
The next scalar transformed to be positive.

Definition at line 534 of file reader.hpp.

template<typename T >
template<typename TU >
T stan::io::reader< T >::scalar_ub ( TU  ub)
inline

Return the next scalar, checking that it is less than or equal to the specified upper bound.

See stan::math::check_less_or_equal(T,double).

Template Parameters
TUType of upper bound.
Parameters
ubUpper bound.
Returns
Next scalar value.
Exceptions
std::runtime_errorif the scalar is greater than the specified upper bound

Definition at line 605 of file reader.hpp.

template<typename T >
template<typename TU >
T stan::io::reader< T >::scalar_ub_constrain ( const TU  ub)
inline

Return the next scalar transformed to have the specified upper bound.

See stan::math::ub_constrain(T,double).

Template Parameters
TUType of upper bound.
Parameters
ubUpper bound on values.
Returns
Next scalar transformed to have the specified upper bound.

Definition at line 624 of file reader.hpp.

template<typename T >
template<typename TU >
T stan::io::reader< T >::scalar_ub_constrain ( const TU  ub,
T &  lp 
)
inline

Return the next scalar transformed to have the specified upper bound, incrementing the specified reference with the log of the absolute Jacobian determinant of the transform.

See stan::math::ub_constrain(T,double,T&).

Template Parameters
TUType of upper bound.
Parameters
ubUpper bound on result.
lpReference to log probability variable to increment.

Definition at line 640 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::simplex ( size_t  k)
inline

Return a simplex of the specified size made up of the next scalars.

See stan::math::check_simplex.

Parameters
kSize of returned simplex.
Returns
Simplex read from the specified size number of scalars.
Exceptions
std::runtime_errorif the k values is not a simplex.

Definition at line 849 of file reader.hpp.

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::io::reader< T >::simplex_constrain ( size_t  k)
inline

Return the next simplex transformed vector of the specified length.

This operation consumes one less than the specified length number of scalars.

See stan::math::simplex_constrain(Eigen::Matrix).

Parameters
kNumber of dimensions in resulting simplex.
Returns
Simplex derived from next k-1 scalars.

Definition at line 867 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::simplex_constrain ( size_t  k,
T &  lp 
)
inline

Return the next simplex of the specified size (using one fewer unconstrained scalars), incrementing the specified reference with the log absolute Jacobian determinant.

See stan::math::simplex_constrain(Eigen::Matrix,T&).

Parameters
kSize of simplex.
lpLog probability to increment with log absolute Jacobian determinant.
Returns
The next simplex of the specified size.

Definition at line 883 of file reader.hpp.

template<typename T >
std::vector<T> stan::io::reader< T >::std_vector ( size_t  m)
inline

Return a standard library vector of the specified dimensionality made up of the next scalars.

Parameters
mSize of vector.
Returns
Vector made up of the next scalars.

Definition at line 215 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::unit_vector ( size_t  k)
inline

Return a unit_vector of the specified size made up of the next scalars.

See stan::math::check_unit_vector.

Parameters
kSize of returned unit_vector.
Returns
unit_vector read from the specified size number of scalars.
Exceptions
std::runtime_errorif the k values is not a unit_vector.

Definition at line 801 of file reader.hpp.

template<typename T >
Eigen::Matrix<T, Eigen::Dynamic, 1> stan::io::reader< T >::unit_vector_constrain ( size_t  k)
inline

Return the next unit_vector transformed vector of the specified length.

This operation consumes one less than the specified length number of scalars.

See stan::math::unit_vector_constrain(Eigen::Matrix).

Parameters
kNumber of dimensions in resulting unit_vector.
Returns
unit_vector derived from next k scalars.

Definition at line 819 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::unit_vector_constrain ( size_t  k,
T &  lp 
)
inline

Return the next unit_vector of the specified size (using one fewer unconstrained scalars), incrementing the specified reference with the log absolute Jacobian determinant.

See stan::math::unit_vector_constrain(Eigen::Matrix,T&).

Parameters
kSize of unit_vector.
lpLog probability to increment with log absolute Jacobian determinant.
Returns
The next unit_vector of the specified size.

Definition at line 835 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::vector ( size_t  m)
inline

Return a column vector of specified dimensionality made up of the next scalars.

Parameters
mNumber of rows in the vector to read.
Returns
Column vector made up of the next scalars.

Definition at line 230 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::vector_constrain ( size_t  m)
inline

Return a column vector of specified dimensionality made up of the next scalars.

The constraint is a no-op.

Parameters
mNumber of rows in the vector to read.
Returns
Column vector made up of the next scalars.

Definition at line 241 of file reader.hpp.

template<typename T >
vector_t stan::io::reader< T >::vector_constrain ( size_t  m,
T &   
)
inline

Return a column vector of specified dimensionality made up of the next scalars.

The constraint and hence Jacobian are no-ops.

Parameters
mNumber of rows in the vector to read. lp Log probability to increment.
Returns
Column vector made up of the next scalars.

Definition at line 253 of file reader.hpp.

template<typename T >
template<typename TL >
vector_t stan::io::reader< T >::vector_lb ( const TL  lb,
size_t  m 
)
inline

Definition at line 1177 of file reader.hpp.

template<typename T >
template<typename TL >
vector_t stan::io::reader< T >::vector_lb_constrain ( const TL  lb,
size_t  m 
)
inline

Definition at line 1185 of file reader.hpp.

template<typename T >
template<typename TL >
vector_t stan::io::reader< T >::vector_lb_constrain ( const TL  lb,
size_t  m,
T &  lp 
)
inline

Definition at line 1193 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
vector_t stan::io::reader< T >::vector_lub ( const TL  lb,
const TU  ub,
size_t  m 
)
inline

Definition at line 1331 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
vector_t stan::io::reader< T >::vector_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m 
)
inline

Definition at line 1340 of file reader.hpp.

template<typename T >
template<typename TL , typename TU >
vector_t stan::io::reader< T >::vector_lub_constrain ( const TL  lb,
const TU  ub,
size_t  m,
T &  lp 
)
inline

Definition at line 1349 of file reader.hpp.

template<typename T >
template<typename TU >
vector_t stan::io::reader< T >::vector_ub ( const TU  ub,
size_t  m 
)
inline

Definition at line 1254 of file reader.hpp.

template<typename T >
template<typename TU >
vector_t stan::io::reader< T >::vector_ub_constrain ( const TU  ub,
size_t  m 
)
inline

Definition at line 1262 of file reader.hpp.

template<typename T >
template<typename TU >
vector_t stan::io::reader< T >::vector_ub_constrain ( const TU  ub,
size_t  m,
T &  lp 
)
inline

Definition at line 1270 of file reader.hpp.


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

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