Skip to content

Commit 7970636

Browse files
gareth-nxjvdp1
andauthored
Apply some suggestions from code review by jvdp1
Co-authored-by: Jeremie Vandenplas <[email protected]>
1 parent 0c2140a commit 7970636

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/specs/stdlib_selection.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ title: Selection Procedures
1010

1111
Suppose you wish to find the value of the kth-smallest entry in an array, or
1212
the index of that value. While it could be done by sorting the whole array
13-
using `sort` or `sort_index` from `stdlib_sorting` and then finding the k-th
13+
using `[[stdlib_sorting(module):sort(interface)]]` or `[[stdlib_sorting(module):sort_index(interface)]]` from `[[stdlib_sorting(module)]]` and then finding the k-th
1414
entry, that would require O(N x LOG(N)) time. However selection of a single
15-
entry can be done in O(N) time, so is much faster for large arrays. This is
15+
entry can be done in O(N) time, which is much faster for large arrays. This is
1616
useful, for example, to quickly find the median of an array, or some other
1717
percentile.
1818

@@ -28,7 +28,7 @@ such that `all(array(1:k) <= array(k)))` and `all(array(k) <= array((k+1):size(
2828
The user can optionally specify `left` and `right` indices to constrain the search
2929
for the kth-smallest value. This can be useful if you have previously called `select`
3030
to find a smaller or larger rank (that will have led to partial sorting of
31-
`array`, thus implying some constraint on the location).
31+
`array`, thus implying some constraints on the location).
3232

3333
* `arg_select` is used to find the index of the kth-smallest entry of an array.
3434
In this case the input array is not modified, but the user must provide an
@@ -38,7 +38,7 @@ such that `all(array(index(1:k)) <= array(index(k)))` and `all(array(k) <= array
3838
The user can optionally specify `left` and `right` indices to constrain the search
3939
for the kth-smallest value. This can be useful if you have previously called `arg_select`
4040
to find a smaller or larger rank (that will have led to partial sorting of
41-
`index`, thus implying some constraint on the location).
41+
`index`, thus implying some constraints on the location).
4242

4343
#### Licensing
4444

@@ -47,7 +47,7 @@ License. However components of the library may be based on code with
4747
additional licensing restrictions. In particular `select` and `arg_select`
4848
were derived by modifying a matlab implementation of "qselect" by Manolis
4949
Lourakis, https://www.mathworks.com/matlabcentral/fileexchange/68947-qselect
50-
Below is the licence of the matlab qselect
50+
Below is the license of the matlab qselect
5151

5252
Copyright (c) 2018, Manolis Lourakis
5353
All rights reserved.
@@ -238,7 +238,7 @@ than sorting `a` entirely.
238238
integer :: k, left, right
239239
240240
array = [3., 2., 7., 4., 5., 1., 4., -1.]
241-
indx = (/( k, k = 1, size(array) )/)
241+
indx = [( k, k = 1, size(array) )]
242242
243243
k = 2
244244
call arg_select(array, indx, k, kth_smallest)
@@ -259,7 +259,7 @@ than sorting `a` entirely.
259259
end program demo_arg_select
260260
```
261261

262-
## Comparison with using sort
262+
## Comparison with using `sort`
263263

264264
The following program compares the timings of `select` and `arg_select` for
265265
computing the median of an array, vs using `sort` from stdlib. In theory we

0 commit comments

Comments
 (0)