Skip to content

Commit e31dedb

Browse files
committed
Add documentation for reverse()
1 parent 23ec2e4 commit e31dedb

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

src/functions-reference/array_operations.Rmd

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ cat(' * <a href="array-size-and-dimension-function.html">Array Size and Dimensio
77
cat(' * <a href="array-broadcasting.html">Array Broadcasting</a>\n')
88
cat(' * <a href="array-concatenation.html">Array Concatenation</a>\n')
99
cat(' * <a href="sorting-functions.html">Sorting functions</a>\n')
10+
cat(' * <a href="reversing-functions.html">Reversing Functions</a>\n')
1011
}
1112
```
1213

@@ -334,7 +335,7 @@ Any mismatches will cause an error to be thrown.
334335
x3 = append_array(x1, x2);
335336
```
336337

337-
## Sorting functions {#sorting-functions}
338+
## Sorting Functions {#sorting-functions}
338339

339340
Sorting can be used to sort values or the indices of those values in
340341
either ascending or descending order. For example, if `v` is declared
@@ -409,3 +410,21 @@ Number of components of v less than v[s]
409410
`int` **`rank`**`(int[] v, int s)`<br>\newline
410411
Number of components of v less than v[s]
411412

413+
## Reversing Functions {#reversing-functions}
414+
415+
Reversing allows to create a copy of array in which elements are in reverse
416+
order. For example, if `v` is declared as a real array of size 3, with values
417+
\[ \text{v} = (1,\, -10.3,\, 20.987), \] then
418+
\[ \mathrm{reverse(v)} = (20.987,\, -10.3,\, 1). \]
419+
420+
<!-- real[]; reverse; (real[] v); -->
421+
\index{{\tt \bfseries reverse }!{\tt (real[] v): real[]}|hyperpage}
422+
423+
`real[]` **`reverse`**`(real[] v)`<br>\newline
424+
Create a copy of the array with the elements in reverse order.
425+
426+
<!-- int[]; reverse; (int[] v); -->
427+
\index{{\tt \bfseries reverse }!{\tt (int[] v): int[]}|hyperpage}
428+
429+
`int[]` **`reverse`**`(int[] v)`<br>\newline
430+
Create a copy of the array with the elements in reverse order.

src/functions-reference/matrix_operations.Rmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cat(' * <a href="softmax.html">Special Matrix Functions</a>\n')
1616
cat(' * <a href="covariance.html">Covariance Functions</a>\n')
1717
cat(' * <a href="linear-algebra-functions-and-solvers.html">Linear Algebra Functions and Solvers</a>\n')
1818
cat(' * <a href="sort-functions.html">Sort Functions</a>\n')
19+
cat(' * <a href="reverse-functions.html">Reverse Functions</a>\n')
1920
}
2021
```
2122

@@ -1544,8 +1545,8 @@ The singular values of A in descending order
15441545

15451546
## Sort Functions
15461547

1547-
see section [sorting functions](#sorting-functions) for examples of how the functions
1548-
work.
1548+
See the [sorting functions section](#sorting-functions) for examples of how
1549+
the functions work.
15491550

15501551
<!-- vector; sort_asc; (vector v); -->
15511552
\index{{\tt \bfseries sort\_asc }!{\tt (vector v): vector}|hyperpage}
@@ -1611,3 +1612,16 @@ Number of components of v less than v[s]
16111612
`int` **`rank`**`(row_vector v, int s)`<br>\newline
16121613
Number of components of v less than v[s]
16131614

1615+
## Reverse Functions {#reverse-functions}
1616+
1617+
<!-- vector; reverse; (vector v); -->
1618+
\index{{\tt \bfseries reverse }!{\tt (vector v): vector}|hyperpage}
1619+
1620+
`vector` **`reverse`**`(vector v)`<br>\newline
1621+
Create a copy of the vector with the elements in reverse order.
1622+
1623+
<!-- row_vector; reverse; (row_vector v); -->
1624+
\index{{\tt \bfseries reverse }!{\tt (row_vector v): row_vector}|hyperpage}
1625+
1626+
`row_vector` **`reverse`**`(row_vector v)`<br>\newline
1627+
Create a copy of the row vector with the elements in reverse order.

0 commit comments

Comments
 (0)