Skip to content

Commit 4f43ce5

Browse files
committed
add comment regarding ord_sort
1 parent 8f4a57f commit 4f43ce5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

doc/specs/stdlib_stats.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ and if `n` is an odd number, the median is:
202202
median(array) = mean( array_sorted( floor( (n + 1) / 2.):floor( (n + 1) / 2.) + 1 ) )
203203
```
204204

205-
The array is sorted using the subroutine `sort` provided by the `stdlib_sorting`
205+
The array is sorted using the subroutine `ord_sort` provided by the `stdlib_sorting`
206206
module.
207207

208208
### Syntax

src/stdlib_stats_median.fypp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ submodule (stdlib_stats) stdlib_stats_median
88
use, intrinsic:: ieee_arithmetic, only: ieee_value, ieee_quiet_nan
99
use stdlib_error, only: error_stop
1010
use stdlib_optval, only: optval
11+
! Use "ord_sort" rather than "sort" because the former can be much faster for arrays
12+
! that are already partly sorted. While it is slightly slower for random arrays,
13+
! ord_sort seems a better overall choice.
1114
use stdlib_sorting, only:sort => ord_sort
1215
implicit none
1316

0 commit comments

Comments
 (0)