Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
math
error_handling
matrix
validate_non_negative_index.hpp
Go to the documentation of this file.
1
#ifndef __STAN__MATH__ERROR_HANDLING__MATRIX__VALIDATE_NON_NEGATIVE_INDEX_HPP__
2
#define __STAN__MATH__ERROR_HANDLING__MATRIX__VALIDATE_NON_NEGATIVE_INDEX_HPP__
3
4
#include <sstream>
5
#include <stdexcept>
6
7
namespace
stan {
8
namespace
math {
9
10
inline
11
void
12
validate_non_negative_index
(
const
std::string& var_name,
13
const
std::string& expr,
14
int
val) {
15
if
(val < 0) {
16
std::stringstream msg;
17
msg <<
"Found negative dimension size in variable declaration"
18
<<
"; variable="
<< var_name
19
<<
"; dimension size expression="
<< expr
20
<<
"; expression value="
<< val;
21
throw
std::invalid_argument(msg.str());
22
}
23
}
24
25
}
26
}
27
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.