5.6 Reversing functions

Stan provides functions to create a new array by reversing the order of elements in an existing array. For example, if v is declared as a real array of size 3, with values \[\begin{equation*} \text{v} = (1,\, -10.3,\, 20.987), \end{equation*}\] then \[\begin{equation*} \mathrm{reverse(v)} = (20.987,\, -10.3,\, 1). \end{equation*}\]

array[] T reverse(array[] T v)
Return a new array containing the elements of the argument in reverse order.
Available since 2.23