diff --git a/src/stdlib_experimental_stat.md b/src/stdlib_experimental_stat.md index bc703503c..b09f9a0ec 100644 --- a/src/stdlib_experimental_stat.md +++ b/src/stdlib_experimental_stat.md @@ -6,38 +6,38 @@ ## MEAN - mean of array elements -### Description +### Description: -Returns the mean of all the elements of *ARRAY*, or of the elements of *ARRAY* along dimension *DIM*. +Returns the mean of all the elements of *array*, or of the elements of *array* along dimension *dim*. -### Syntax +### Syntax: -RESULT = mean(*ARRAY*) +RESULT = mean(*array*) -RESULT = mean(*ARRAY*, *DIM*) +RESULT = mean(*array*, *dim*) -### Arguments +### Arguments: -*ARRAY*: Must be an array of type INTEGER, or REAL. +*array*: Shall be an array of type INTEGER, or REAL. -*DIM* (optional): Must be a scalar of type INTEGER with a value in the range from 1 to n, where n equals the rank of *ARRAY*. +*dim* (optional): Shall be a scalar of type INTEGER with a value in the range from 1 to n, where n is the rank of *array*. -### Return value +### Return value: -If *ARRAY* is of type REAL, the result is of the same type as ARRAY. -If *ARRAY* is of type INTEGER, the result is of type as *double precision*. +If *array* is of type REAL, the result is of the same type as array. +If *array* is of type INTEGER, the result is of type as *double precision*. -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. +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. -### Example +### Example: ```fortran program test use stdlib_experimental_stat, only: mean implicit none - real :: x(1:6) = (/ 1., 2., 3., 4., 5., 6. /) + real :: x(1:6) = [ 1., 2., 3., 4., 5., 6. ] print *, mean(x) !returns 21. - print *, mean( reshape(x, (/ 2, 3 /) )) !returns 21. - print *, mean( reshape(x, (/ 2, 3 /) ), 1) !returns (/ 3., 7., 11. /) + print *, mean( reshape(x, [ 2, 3 ] )) !returns 21. + print *, mean( reshape(x, [ 2, 3 ] ), 1) !returns [ 3., 7., 11. ] end program ```