Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
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 
6 #include <stdexcept>
7 #include <vector>
8 
9 namespace stan {
10  namespace math {
11 
24  int csr_u_to_z(const std::vector<int>& u, int i) {
25  check_positive("csr_u_to_z", "u.size()", u.size());
26  check_range("csr_u_to_z", "i", u.size(), i + 1, "index out of range");
27  return u[i + 1] - u[i];
28  }
29 
30  }
31 }
32 #endif
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:24
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
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.

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