This is an old version, view current version.

4.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 \[ \text{v} = (1,\, -10.3,\, 20.987), \] then \[ \mathrm{reverse(v)} = (20.987,\, -10.3,\, 1). \]

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