Automatic Differentiation
 
Loading...
Searching...
No Matches
linspaced_int_array.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LINSPACED_INT_ARRAY_HPP
2#define STAN_MATH_PRIM_FUN_LINSPACED_INT_ARRAY_HPP
3
6#include <vector>
7
8namespace stan {
9namespace math {
10
33inline std::vector<int> linspaced_int_array(int K, int low, int high) {
34 static constexpr const char* function = "linspaced_int_array";
35 check_nonnegative(function, "size", K);
36 check_greater_or_equal(function, "high", high, low);
37 if (K == 0) {
38 return {};
39 }
40
41 Eigen::VectorXi v = Eigen::VectorXi::LinSpaced(K, low, high);
42 return {v.data(), v.data() + K};
43}
44
45} // namespace math
46} // namespace stan
47
48#endif
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
std::vector< int > linspaced_int_array(int K, int low, int high)
Return an array of linearly spaced integers.
void check_greater_or_equal(const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
Throw an exception if y is not greater or equal than low.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9