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
check_nonzero_size.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_NONZERO_SIZE_HPP
2
#define STAN_MATH_PRIM_SCAL_ERR_CHECK_NONZERO_SIZE_HPP
3
4
#include <
stan/math/prim/scal/err/invalid_argument.hpp
>
5
6
#include <string>
7
8
namespace
stan {
9
10
namespace
math {
11
30
template
<
typename
T_y>
31
inline
bool
check_nonzero_size
(
const
char
*
function
,
32
const
char
* name,
33
const
T_y& y) {
34
if
(y.size() > 0)
35
return
true
;
36
37
invalid_argument
(
function
, name, 0,
38
"has size "
,
39
", but must have a non-zero size"
);
40
return
false
;
41
}
42
43
}
44
}
45
#endif
invalid_argument.hpp
stan::math::check_nonzero_size
bool check_nonzero_size(const char *function, const char *name, const T_y &y)
Return true if the specified matrix/vector is of non-zero size.
Definition:
check_nonzero_size.hpp:31
stan::math::invalid_argument
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
Definition:
invalid_argument.hpp:31
[
Stan Home Page
]
© 2011–2015, Stan Development Team.