Skip to content

Commit a365ea0

Browse files
committed
rawmoment: small change in spec
1 parent d955c0c commit a365ea0

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/stdlib_experimental_stats.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,15 @@ program demo_moment
105105
use stdlib_experimental_stats, only: mean, moment
106106
implicit none
107107
real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ]
108-
print *, moment(x, 2, center = mean(x))
109-
!returns 2.9167
110-
111-
print *, moment( reshape(x, [ 2, 3 ] ), 2,&
112-
center = mean(reshape(x, [ 2, 3 ])))
113-
!returns 2.9167
114-
115-
print *, moment( reshape(x, [ 2, 3 ] ), 2, 1,&
116-
center = mean(reshape(x, [ 2, 3 ] ), 1))
117-
!returns [0.25, 0.25, 0.25]
118-
119-
print *, moment( reshape(x, [ 2, 3 ] ), 2, 1,&
120-
center = mean(reshape(x, [2, 3]), 1, reshape(x, [ 2, 3 ] ) > 3.),&
121-
mask = (reshape(x, [ 2, 3 ] ) > 3.))
122-
!returns [NaN, 0., 0.25]
108+
real :: y(1:2, 1:3) = reshape([ 1., 2., 3., 4., 5., 6. ], [ 2, 3])
109+
print *, moment(x, 2, center = mean(x)) !returns 2.9167
110+
print *, moment( y, 2,&
111+
center = mean(y)) !returns 2.9167
112+
print *, moment( y, 2, 1,&
113+
center = mean(y, 1)) !returns [0.25, 0.25, 0.25]
114+
print *, moment( y, 2, 1,&
115+
center = mean(y, 1, y > 3.),&
116+
mask = (y > 3.)) !returns [NaN, 0., 0.25]
123117
end program demo_moment
124118
```
125119

0 commit comments

Comments
 (0)