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: src/stdlib_experimental_stats.md
+80-6
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,29 @@
1
1
# Descriptive statistics
2
2
3
-
## Implemented
4
3
5
-
*`mean`
6
-
*`var`
4
+
## Implemented
5
+
<!-- vim-markdown-toc GFM -->
6
+
7
+
*[`mean` - mean of array elements](#mean---mean-of-array-elements)
8
+
* [Description](#description)
9
+
* [Syntax](#syntax)
10
+
* [Arguments](#arguments)
11
+
* [Return value](#return-value)
12
+
* [Example](#example)
13
+
*[`moment` - central moment of array elements](#moment---central-moment-of-array-elements)
14
+
* [Description](#description-1)
15
+
* [Syntax](#syntax-1)
16
+
* [Arguments](#arguments-1)
17
+
* [Return value](#return-value-1)
18
+
* [Example](#example-1)
19
+
*[`var` - variance of array elements](#var---variance-of-array-elements)
20
+
* [Description](#description-2)
21
+
* [Syntax](#syntax-2)
22
+
* [Arguments](#arguments-2)
23
+
* [Return value](#return-value-2)
24
+
* [Example](#example-2)
25
+
26
+
<!-- vim-markdown-toc -->
7
27
8
28
## `mean` - mean of array elements
9
29
@@ -28,7 +48,7 @@ Returns the mean of all the elements of `array`, or of the elements of `array` a
28
48
### Return value
29
49
30
50
If `array` is of type `real` or `complex`, the result is of the same type as `array`.
31
-
If `array` is of type `integer`, the result is of type `double precision`.
51
+
If `array` is of type `integer`, the result is of type `real(dp)`.
32
52
33
53
If `dim` is absent, a scalar with the mean 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.
34
54
@@ -49,6 +69,60 @@ program demo_mean
49
69
end program demo_mean
50
70
```
51
71
72
+
## `moment` - central moment of array elements
73
+
74
+
### Description
75
+
76
+
Returns the _k_-th order central moment 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`.
`array`: Shall be an array of type `integer`, `real`, or `complex`.
95
+
96
+
`order`: Shall be an scalar of type `integer`.
97
+
98
+
`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`.
99
+
100
+
`mask` (optional): Shall be of type `logical` and either by a scalar or an array of the same shape as `array`.
101
+
102
+
### Return value
103
+
104
+
If `array` is of type `real` or `complex`, the result is of the same type as `array`.
105
+
If `array` is of type `integer`, the result is of type `real(dp)`.
106
+
107
+
If `dim` is absent, a scalar with the _k_-th central moment 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.
108
+
109
+
If `mask` is specified, the result is the _k_-th central moment 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