Skip to content

Commit ddec12c

Browse files
gareth-nxjvdp1
andauthored
Apply suggestions from code review by jvdp1
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
1 parent 73010e2 commit ddec12c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

doc/specs/stdlib_selection.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ The Fortran Standard Library is distributed under the MIT
4747
License. It is worth noting that `select` and `arg_select`
4848
were derived using some code from quickSelect in the Coretran library, by Leon Foks,
4949
https://github.com/leonfoks/coretran. Leon Foks has given permission for the code here
50-
to be released under stdlib's MIT licence.
50+
to be released under stdlib's MIT license.
5151

5252
### Specifications of the `stdlib_selection` procedures
5353

54-
#### `select` - find the kth smallest value in an input array
54+
#### `select` - find the k-th smallest value in an input array
5555

5656
##### Status
5757

@@ -85,20 +85,20 @@ the k-th smallest entry of `array(:)`.
8585

8686
`left` (optional): shall be a scalar with the same type as `k`. It is an `intent(in)`
8787
argument. If specified then we assume the k-th smallest value is definitely contained
88-
in `array(left:size(array))`. If not present it is 1. This is typically useful if multiple calls
88+
in `array(left:size(array))`. If `left` is not present, the default is 1. This is typically useful if multiple calls
8989
to `select` are made, because the partial sorting of `array` implies constraints on where
9090
we need to search.
9191

9292
`right` (optional): shall be a scalar with the same type as `k`. It is an `intent(in)`
9393
argument. If specified then we assume the k-th smallest value is definitely contained
94-
in `array(1:right)`. If not present it is `size(array)`. This is typically useful if multiple calls
94+
in `array(1:right)`. If `right` is not present, the default is `size(array)`. This is typically useful if multiple calls
9595
to `select` are made, because the partial sorting of `array` implies constraints on where
9696
we need to search.
9797

9898
##### Notes
9999

100100
Selection of a single value should have runtime of O(`size(array)`), so it is
101-
asymptotically faster than sorting `array` entirely. The test program at the the
101+
asymptotically faster than sorting `array` entirely. The test program at the
102102
end of this document shows that is the case.
103103

104104
On return the elements of `array` will be partially sorted such that:
@@ -177,13 +177,13 @@ and on return it contains the index of the k-th smallest entry of `array(:)`.
177177

178178
`left` (optional): shall be a scalar with the same type as `k`. It is an `intent(in)`
179179
argument. If specified then we assume the k-th smallest value is definitely contained
180-
in `array(indx(left:size(array)))`. If not present it is 1. This is typically useful if multiple calls
180+
in `array(indx(left:size(array)))`. If `left` is not present, the default is 1. This is typically useful if multiple calls
181181
to `arg_select` are made, because the partial sorting of `indx` implies constraints on where
182182
we need to search.
183183

184184
`right` (optional): shall be a scalar with the same type as `k`. It is an `intent(in)`
185185
argument. If specified then we assume the k-th smallest value is definitely contained
186-
in `array(indx(1:right))`. If not present it is `size(array)`. This is typically useful if multiple calls
186+
in `array(indx(1:right))`. If `right` is not present, the default is `size(array)`. This is typically useful if multiple calls
187187
to `arg_select` are made, because the reordering of `indx` implies constraints on
188188
where we need to search.
189189

@@ -237,7 +237,7 @@ these documents confirms that is the case.
237237
## Comparison with using `sort`
238238

239239
The following program compares the timings of `select` and `arg_select` for
240-
computing the median of an array, vs using `sort` from stdlib. In theory we
240+
computing the median of an array, vs using `sort` from `stdlib`. In theory we
241241
should see a speed improvement with the selection routines which grows like
242242
LOG(size(`array`)).
243243

src/stdlib_selection.fypp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module stdlib_selection
88
! This code was modified from the "Coretran" implementation "quickSelect" by
99
! Leon Foks, https://github.com/leonfoks/coretran/tree/master/src/sorting
1010
!
11-
! Leon gave permission for this to be released under stdlib's MIT licence.
11+
! Leon Foks gave permission to be release this code under stdlib's MIT license.
1212
! (https://github.com/fortran-lang/stdlib/pull/500#commitcomment-57418593)
1313
!
1414

0 commit comments

Comments
 (0)