Skip to content

Commit 4d328dc

Browse files
committed
median: add warning about naive implementation
1 parent afc92a2 commit 4d328dc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/specs/stdlib_stats.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ Experimental
186186

187187
### Description
188188

189-
Returns the median of all the elements of `array`, or of the elements of `array` along dimension `dim` if provided, and if the corresponding element in `mask` is `true`.
189+
Returns the median of all the elements of `array`, or of the elements of `array`
190+
along dimension `dim` if provided, and if the corresponding element in `mask` is
191+
`true`.
190192

191193
The median of the elements of `array` is defined as the "middle"
192194
element, after that the elements are sorted in an increasing order, e.g. `array_sorted =
@@ -202,7 +204,8 @@ and if `n` is an odd number, the median is:
202204
median(array) = mean( array_sorted( floor( (n + 1) / 2.):floor( (n + 1) / 2.) + 1 ) )
203205
```
204206

205-
The array is sorted using the subroutine `[[stdlib_sorting(module):ord_sort(interface)]]`
207+
The current implementation is a quite naive implementation that relies on sorting
208+
the whole array, using the subroutine `[[stdlib_sorting(module):ord_sort(interface)]]`
206209
provided by the `[[stdlib_sorting(module)]]` module.
207210

208211
### Syntax

0 commit comments

Comments
 (0)