You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/specs/stdlib_stats.md
+89Lines changed: 89 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,10 @@ The Pearson correlation between two rows (or columns), say `x` and `y`, of `arra
26
26
27
27
`result = [[stdlib_stats(module):corr(interface)]](array, dim [, mask])`
28
28
29
+
### Class
30
+
31
+
Generic subroutine
32
+
29
33
### Arguments
30
34
31
35
`array`: Shall be a rank-1 or a rank-2 array of type `integer`, `real`, or `complex`.
@@ -83,6 +87,10 @@ The scaling can be changed with the logical argument `corrected`. If `corrected`
83
87
84
88
`result = [[stdlib_stats(module):cov(interface)]](array, dim [, mask [, corrected]])`
85
89
90
+
### Class
91
+
92
+
Generic subroutine
93
+
86
94
### Arguments
87
95
88
96
`array`: Shall be a rank-1 or a rank-2 array of type `integer`, `real`, or `complex`.
@@ -134,6 +142,10 @@ Returns the mean of all the elements of `array`, or of the elements of `array` a
134
142
135
143
`result = [[stdlib_stats(module):mean(interface)]](array, dim [, mask])`
136
144
145
+
### Class
146
+
147
+
Generic subroutine
148
+
137
149
### Arguments
138
150
139
151
`array`: Shall be an array of type `integer`, `real`, or `complex`.
@@ -166,6 +178,75 @@ program demo_mean
166
178
end program demo_mean
167
179
```
168
180
181
+
## `median` - median of array elements
182
+
183
+
### Status
184
+
185
+
Experimental
186
+
187
+
### Description
188
+
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`.
190
+
191
+
After that the elements are sorted in an increasing order, e.g. `array_sorted =
192
+
sort(array)`, the median of the elements of `array` are defined as, if
`result = [[stdlib_stats(module):median(interface)]](array, dim [, mask])`
213
+
214
+
### Class
215
+
216
+
Generic subroutine
217
+
218
+
### Arguments
219
+
220
+
`array`: Shall be an array of type `integer` or `real`.
221
+
222
+
`dim`: Shall be a scalar of type `integer` with a value in the range from 1 to `n`, where `n` is the rank of `array`.
223
+
224
+
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
225
+
226
+
### Return value
227
+
228
+
If `array` is of type `real`, the result is of the same type as `array`.
229
+
If `array` is of type `integer`, the result is of type `real(dp)`.
230
+
231
+
If `dim` is absent, a scalar with the median of all elements in `array` is returned. Otherwise, an array of rank `n-1`, where `n` equals the rank of `array`, and a shape similar to that of `array` with dimension `dim` dropped is returned.
232
+
233
+
If `mask` is specified, the result is the median of all elements of `array` corresponding to `true` elements of `mask`. If every element of `mask` is `false`, the result is IEEE `NaN`.
0 commit comments