6.9 Container construction functions

array[] real linspaced_array(int n, data real lower, data real upper)
Create a real array of length n of equidistantly-spaced elements between lower and upper
Available since 2.24

array[] real linspaced_int_array(int n, int lower, int upper)
Create a regularly spaced, increasing integer array of length n between lower and upper, inclusively. If (upper - lower) / (n - 1) is less than one, repeat each output (n - 1) / (upper - lower) times. If neither (upper - lower) / (n - 1) or (n - 1) / (upper - lower) are integers, upper is reduced until one of these is true.
Available since 2.26

vector linspaced_vector(int n, data real lower, data real upper)
Create an n-dimensional vector of equidistantly-spaced elements between lower and upper
Available since 2.24

row_vector linspaced_row_vector(int n, data real lower, data real upper)
Create an n-dimensional row-vector of equidistantly-spaced elements between lower and upper
Available since 2.24

array[] int one_hot_int_array(int n, int k)
Create a one-hot encoded int array of length n with array[k] = 1
Available since 2.26

array[] real one_hot_array(int n, int k)
Create a one-hot encoded real array of length n with array[k] = 1
Available since 2.24

vector one_hot_vector(int n, int k)
Create an n-dimensional one-hot encoded vector with vector[k] = 1
Available since 2.24

row_vector one_hot_row_vector(int n, int k)
Create an n-dimensional one-hot encoded row-vector with row_vector[k] = 1
Available since 2.24

array[] int ones_int_array(int n)
Create an int array of length n of all ones
Available since 2.26

array[] real ones_array(int n)
Create a real array of length n of all ones
Available since 2.26

vector ones_vector(int n)
Create an n-dimensional vector of all ones
Available since 2.26

row_vector ones_row_vector(int n)
Create an n-dimensional row-vector of all ones
Available since 2.26

array[] int zeros_int_array(int n)
Create an int array of length n of all zeros
Available since 2.26

array[] real zeros_array(int n)
Create a real array of length n of all zeros
Available since 2.24

vector zeros_vector(int n)
Create an n-dimensional vector of all zeros
Available since 2.24

row_vector zeros_row_vector(int n)
Create an n-dimensional row-vector of all zeros
Available since 2.24

vector uniform_simplex(int n)
Create an n-dimensional simplex with elements vector[i] = 1 / n for all \(i \in 1, \dots, n\)
Available since 2.24