All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
check_column_index.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
#define STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
#include <stan/math/prim/scal/err/out_of_range.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/scal/meta/error_index.hpp>
#include <sstream>
#include <string>
namespace stan {
namespace math {
template <typename T_y, int R, int C>
inline bool check_column_index(const char* function,
const char* name,
const Eigen::Matrix<T_y, R, C>& y,
const size_t i) {
if (i >= stan::error_index::value
&& i < static_cast<size_t>(y.cols()) + stan::error_index::value)
return true;
std::stringstream msg;
msg << " for columns of " << name;
std::string msg_str(msg.str());
out_of_range(function,
y.cols(),
i,
msg_str.c_str());
return false;
}
}
}
#endif
out_of_range.hpp
stan::error_index::value
Definition: error_index.hpp:7
stan::math::out_of_range
void out_of_range(const char *function, const int max, const int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.
Definition: out_of_range.hpp:30
Eigen.hpp
stan::math::check_column_index
bool check_column_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, const size_t i)
Return true if the specified index is a valid column of the matrix.
Definition: check_column_index.hpp:37
error_index.hpp

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