Automatic Differentiation
 
Loading...
Searching...
No Matches
unitspaced_array.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_UNITSPACED_ARRAY_HPP
2#define STAN_MATH_PRIM_FUN_UNITSPACED_ARRAY_HPP
3
7#include <vector>
8
9namespace stan {
10namespace math {
11
23inline std::vector<int> unitspaced_array(int low, int high) {
24 static constexpr const char* function = "unitspaced_array";
25 check_greater_or_equal(function, "high", high, low);
26
27 int K = std::abs(high - low + 1);
28 std::vector<int> result(K);
29 Eigen::Map<Eigen::VectorXi>(result.data(), K)
30 = Eigen::VectorXi::LinSpaced(K, low, high);
31 return result;
32}
33
34} // namespace math
35} // namespace stan
36
37#endif
std::vector< int > unitspaced_array(int low, int high)
Return an array of integers in an ordered sequence.
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