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
The scaling can be changed with the logical argument `corrected`. If `corrected` is `.false.`, then the sum is scaled with `n`, otherwise with `n-1`.
24
+
25
+
26
+
### Syntax
27
+
28
+
`result = cov(array, dim [, mask [, corrected]])`
29
+
30
+
### Arguments
31
+
32
+
`array`: Shall be a rank-1 or a rank-2 array of type `integer`, `real`, or `complex`.
33
+
34
+
`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`.
35
+
36
+
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
37
+
38
+
`corrected` (optional): Shall be a scalar of type `logical`. If `corrected` is `.true.` (default value), the sum is scaled with `n-1`. If `corrected` is `.false.`, then the sum is scaled with `n`.
39
+
40
+
### Return value
41
+
42
+
If `array` is of rank 1 and of type `real` or `complex`, the result is of type `real` corresponding to the type of `array`.
43
+
If `array` is of rank 2 and of type `real` or `complex`, the result is of the same type as `array`.
44
+
If `array` is of type `integer`, the result is of type `real(dp)`.
45
+
46
+
If `array` is of rank 1, a scalar with the covariance (that is the variance) of all elements in `array` is returned.
47
+
If `array` is of rank 2, a rank-2 array is returned.
48
+
49
+
If `mask` is specified, the result is the covariance of all elements of `array` corresponding to `true` elements of `mask`. If every element of `mask` is `false`, the result is IEEE `NaN`.
print *, cov(y, 1) !returns a square matrix of size 3 with all elements equal to 0.5
62
+
end program demo_cov
63
+
```
64
+
7
65
## `mean` - mean of array elements
8
66
9
67
### Description
@@ -20,16 +78,16 @@ Returns the mean of all the elements of `array`, or of the elements of `array` a
20
78
21
79
`array`: Shall be an array of type `integer`, `real`, or `complex`.
22
80
23
-
`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`.
81
+
`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`.
24
82
25
-
`mask` (optional): Shall be of type `logical` and either by a scalar or an array of the same shape as `array`.
83
+
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
26
84
27
85
### Return value
28
86
29
87
If `array` is of type `real` or `complex`, the result is of the same type as `array`.
30
88
If `array` is of type `integer`, the result is of type `real(dp)`.
31
89
32
-
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.
90
+
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.
33
91
34
92
If `mask` is specified, the result is the mean of all elements of `array` corresponding to `true` elements of `mask`. If every element of `mask` is `false`, the result is IEEE `NaN`.
35
93
@@ -63,7 +121,7 @@ The _k_-th order central moment is defined as :
The _k_-th order moment about `center` is defined as :
69
127
@@ -83,18 +141,18 @@ The _k_-th order moment about `center` is defined as :
83
141
84
142
`order`: Shall be an scalar of type `integer`.
85
143
86
-
`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`.
144
+
`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`.
87
145
88
146
`center` (optional): Shall be a scalar of the same type of `result` if `dim` is not provided. If `dim` is provided, `center` shall be a scalar or an array (with a shape similar to that of `array` with dimension `dim` dropped) of the same type of `result`.
89
147
90
-
`mask` (optional): Shall be of type `logical` and either by a scalar or an array of the same shape as `array`.
148
+
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
91
149
92
150
### Return value
93
151
94
152
If `array` is of type `real` or `complex`, the result is of the same type as `array`.
95
153
If `array` is of type `integer`, the result is of type `real(dp)`.
96
154
97
-
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.
155
+
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.
98
156
99
157
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`.
100
158
@@ -127,7 +185,7 @@ Per default, the variance is defined as the best unbiased estimator and is compu
The use of the term `n-1` for scaling is called Bessel 's correction. The scaling can be changed with the logical argument `corrected`. If `corrected` is `.false.`, then the sum is scaled with `n`, otherwise with `n-1`.
133
191
@@ -142,9 +200,9 @@ The use of the term `n-1` for scaling is called Bessel 's correction. The scalin
142
200
143
201
`array`: Shall be an array of type `integer`, `real`, or `complex`.
144
202
145
-
`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`.
203
+
`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`.
146
204
147
-
`mask` (optional): Shall be of type `logical` and either by a scalar or an array of the same shape as `array`.
205
+
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
148
206
149
207
`corrected` (optional): Shall be a scalar of type `logical`. If `corrected` is `.true.` (default value), the sum is scaled with `n-1`. If `corrected` is `.false.`, then the sum is scaled with `n`.
150
208
@@ -153,7 +211,7 @@ The use of the term `n-1` for scaling is called Bessel 's correction. The scalin
153
211
If `array` is of type `real` or `complex`, the result is of type `real` corresponding to the type of `array`.
154
212
If `array` is of type `integer`, the result is of type `real(dp)`.
155
213
156
-
If `dim` is absent, a scalar with the variance 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.
214
+
If `dim` is absent, a scalar with the variance 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.
157
215
158
216
If `mask` is specified, the result is the variance 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