|
3 | 3 | ```{r results='asis', echo=FALSE} |
4 | 4 | if (knitr::is_html_output()) { |
5 | 5 | cat(' * <a href="array-reductions.html">Reductions</a>\n') |
6 | | -cat(' * <a href="array-size-and-dimension-function.html">Array Size and Dimension Function</a>\n') |
7 | | -cat(' * <a href="array-broadcasting.html">Array Broadcasting</a>\n') |
8 | | -cat(' * <a href="array-concatenation.html">Array Concatenation</a>\n') |
| 6 | +cat(' * <a href="array-size-and-dimension-function.html">Array size and dimension function</a>\n') |
| 7 | +cat(' * <a href="array-broadcasting.html">Array broadcasting</a>\n') |
| 8 | +cat(' * <a href="array-concatenation.html">Array concatenation</a>\n') |
9 | 9 | cat(' * <a href="sorting-functions.html">Sorting functions</a>\n') |
| 10 | +cat(' * <a href="reversing-functions.html">Reversing functions</a>\n') |
10 | 11 | } |
11 | 12 | ``` |
12 | 13 |
|
@@ -178,7 +179,7 @@ The squared Euclidean distance between x and y |
178 | 179 | `real` **`squared_distance`**`(row_vector x, row_vector[] y)`<br>\newline |
179 | 180 | The Euclidean distance between x and y |
180 | 181 |
|
181 | | -## Array Size and Dimension Function |
| 182 | +## Array size and dimension function |
182 | 183 |
|
183 | 184 | The size of an array or matrix can be obtained using the `dims()` |
184 | 185 | function. The `dims()` function is defined to take an argument |
@@ -236,7 +237,7 @@ can be any type, but the size is just the size of the top level array, |
236 | 237 | not the total number of elements contained. For example, if `x` is of |
237 | 238 | type `real[4,3]` then `size(x)` is 4. |
238 | 239 |
|
239 | | -## Array Broadcasting {#array-broadcasting} |
| 240 | +## Array broadcasting {#array-broadcasting} |
240 | 241 |
|
241 | 242 | The following operations create arrays by repeating elements to fill |
242 | 243 | an array of a specified size. These operations work for all input |
@@ -312,7 +313,7 @@ After the assignment to `b`, the value for `b[j,k,m,n]` is equal to |
312 | 313 | `a[m,n]` where it is defined, for `j` in `1:3`, `k` in `1:4`, `m` in |
313 | 314 | `1:5`, and `n` in `1:6`. |
314 | 315 |
|
315 | | -## Array Concatenation {#array-concatenation} |
| 316 | +## Array concatenation {#array-concatenation} |
316 | 317 |
|
317 | 318 | <!-- T; append_array; (T x, T y); --> |
318 | 319 | \index{{\tt \bfseries append\_array }!{\tt (T x, T y): T}|hyperpage} |
@@ -409,3 +410,16 @@ Number of components of v less than v[s] |
409 | 410 | `int` **`rank`**`(int[] v, int s)`<br>\newline |
410 | 411 | Number of components of v less than v[s] |
411 | 412 |
|
| 413 | +## Reversing functions {#reversing-functions} |
| 414 | + |
| 415 | +Stan provides functions to create a new array by reversing the order of |
| 416 | +elements in an existing array. For example, if `v` is declared as a real |
| 417 | +array of size 3, with values |
| 418 | +\[ \text{v} = (1,\, -10.3,\, 20.987), \] then |
| 419 | +\[ \mathrm{reverse(v)} = (20.987,\, -10.3,\, 1). \] |
| 420 | + |
| 421 | +<!-- T[]; reverse; (T[] v); --> |
| 422 | +\index{{\tt \bfseries reverse }!{\tt (T[] v): T[]}|hyperpage} |
| 423 | + |
| 424 | +`T[]` **`reverse`**`(T[] v)`<br>\newline |
| 425 | +Return a new array containing the elements of the argument in reverse order. |
0 commit comments