Stan Math Library
2.8.0
reverse mode automatic differentiation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Groups
stan
math
prim
scal
err
out_of_range.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
2
#define STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
3
4
#include <
stan/math/prim/scal/meta/error_index.hpp
>
5
#include <typeinfo>
6
#include <string>
7
#include <sstream>
8
#include <stdexcept>
9
10
namespace
stan {
11
namespace
math {
12
30
inline
void
out_of_range
(
const
char
*
function
,
31
const
int
max
,
32
const
int
index,
33
const
char
* msg1 =
""
,
34
const
char
* msg2 =
""
) {
35
std::ostringstream message;
36
37
message <<
function
<<
": accessing element out of range. "
38
<<
"index "
<< index <<
" out of range; "
39
<<
"expecting index to be between "
40
<<
stan::error_index::value
<<
" and "
41
<<
stan::error_index::value
- 1 + max
42
<< msg1
43
<< msg2;
44
45
throw
std::out_of_range
(message.str());
46
}
47
48
}
49
}
50
#endif
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
stan::math::max
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
Definition:
max.hpp:21
error_index.hpp
[
Stan Home Page
]
© 2011–2015, Stan Development Team.