Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ linspaced_int_array()

std::vector< int > stan::math::linspaced_int_array ( int  K,
int  low,
int  high 
)
inline

Return an array of linearly spaced integers.

This produces an array from low to high (inclusive). If high - low is greater or equal to K - 1, then the integers are evenly spaced. If it is not possible to get from low to high with a multiple of an integer, high is lowered until this is possible.

If K - 1 is greater than high - low, then integers are repeated. For instance, low, low, low + 1, low + 1, .... high is lowered until K - 1 is a multiple of high - low

For K = 1, the array will contain the high value. For K = 0 it returns an empty array.

Parameters
Ksize of the array
lowsmallest value
highlargest value
Returns
An array of size K with elements linearly spaced between low and high.
Exceptions
std::domain_errorif K is negative or high is less than low.

Definition at line 33 of file linspaced_int_array.hpp.