| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

csr_u_to_z.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_CSR_U_TO_Z
2 #define STAN_MATH_PRIM_MAT_FUN_CSR_U_TO_Z
3
4 #include <stan/math/prim/mat/err/check_range.hpp>
5 #include <stan/math/prim/scal/err/check_positive.hpp>
6 #include <stdexcept>
7 #include <vector>
8
9 namespace stan {
10 namespace math {
11
26 inline int csr_u_to_z(const std::vector<int>& u, int i) {
27 check_positive("csr_u_to_z", "u.size()", u.size());
28 check_range("csr_u_to_z", "i", u.size(), i + 1, "index out of range");
29 return u[i + 1] - u[i];
30 }
31
32 }
33 }
34 #endif
check_positive.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::csr_u_to_z
int csr_u_to_z(const std::vector< int > &u, int i)
Return the z vector computed from the specified u vector at the index for the z vector.
Definition: csr_u_to_z.hpp:26
stan::math::check_range
bool check_range(const char *function, const char *name, const int max, const int index, const int nested_level, const char *error_msg)
Return true if specified index is within range.
Definition: check_range.hpp:29
stan::math::check_positive
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
Definition: check_positive.hpp:66
check_range.hpp

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