Skip to content

Commit 22cbdf7

Browse files
committed
refactor: forlab_stats&mean
1 parent 0db5658 commit 22cbdf7

7 files changed

+71
-38
lines changed

.gitattributes

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Override syntax highlighting
2+
*.fypp linguist-language=fortran
3+
4+
# Denote all files that are truly binary and should not be modified.
5+
*.mod binary
6+
*.smod binary
7+
*.o binary
8+
*.a binary
9+
*.so binary
10+
*.tar binary
11+
*.gz binary
12+
*.tgz binary
13+
14+
# Prevent dev-ops files from making it into the release archives
15+
.gitattributes export-ignore
16+
.gitignore export-ignore
17+
codecov.yml export-ignore
18+
.github export-ignore
19+
20+
# Perform substitutions when `git export`ing these files
21+
.VERSION export-subst

src/forlab.fypp

+2
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ module forlab
566566
end interface median
567567

568568
interface mean
569+
!! mean computes the mean value of an array.
570+
!! ([Specification](../module/forlab_stats_mean.html))
569571
#:for k1, t1 in REAL_KINDS_TYPES
570572
${t1}$ module function mean_1_${k1}$(x)
571573
${t1}$, dimension(:), intent(in) :: x

src/forlab_stats.f90

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
submodule(forlab) forlab_stats
2+
implicit none
3+
4+
contains
5+
6+
end submodule

src/forlab_mean.fypp renamed to src/forlab_stats_mean.fypp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#:include 'common.fypp'
2-
submodule(forlab) forlab_mean
2+
submodule(forlab:forlab_stats) forlab_stats_mean
33
!!## mean
44
!! mean computes the mean value of an array.
5-
!!
5+
!!([Interface](../interface/mean.html))
66
!!### Syntax
77
!! y = mean(x)
88
!! x = mean(A)

src/fpm/forlab.f90

+2
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ end function matpow_qp
14171417
end interface median
14181418

14191419
interface mean
1420+
!! mean computes the mean value of an array.
1421+
!! ([Specification](../module/forlab_stats_mean.html))
14201422
real(sp) module function mean_1_sp(x)
14211423
real(sp), dimension(:), intent(in) :: x
14221424
end function

src/fpm/forlab_stats.f90

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
submodule(forlab) forlab_stats
2+
implicit none
3+
4+
contains
5+
6+
end submodule

src/fpm/forlab_mean.f90 renamed to src/fpm/forlab_stats_mean.f90

+32-36
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
submodule(forlab) forlab_mean
2-
! mean
3-
!-----------------------------------------------------------------------
4-
! mean computes the mean value of an array.
5-
!
6-
! Syntax
7-
!-----------------------------------------------------------------------
8-
! y = mean(x)
9-
! x = mean(A)
10-
! x = mean(A, 1)
11-
! x = mean(A, 2)
12-
!
13-
! Description
14-
!-----------------------------------------------------------------------
15-
! y = mean(x) returns the mean value of the vector x.
16-
!
17-
! x = mean(A) returns a dim2 vector with the mean values of each column
18-
! of matrix A.
19-
!
20-
! x = mean(A, 1) (see x = mean(A)).
21-
!
22-
! x = mean(A, 2) returns a dim1 vector with the mean values of each row
23-
! of matrix A.
24-
!
25-
! Examples
26-
!-----------------------------------------------------------------------
27-
! x = [ 1., 2., 3. ]
28-
! y = mean(x)
29-
! 2.
30-
!
31-
! A = reshape([ 1., 2., 3., 4., 5., 6., 7., 8., 9. ], [ 3, 3 ], &
32-
! order = [ 2, 1 ])
33-
! x = mean(A)
34-
! 4. 5. 6.
35-
! x = mean(A, 2)
36-
! 2. 5. 8.
1+
submodule(forlab:forlab_stats) forlab_stats_mean
2+
!!## mean
3+
!! mean computes the mean value of an array.
4+
!!
5+
!!### Syntax
6+
!! y = mean(x)
7+
!! x = mean(A)
8+
!! x = mean(A, 1)
9+
!! x = mean(A, 2)
10+
!!
11+
!!### Description
12+
!! `y = mean(x)` returns the mean value of the vector `x`.
13+
!!
14+
!! `x = mean(A)` returns a `dim2` vector with the mean values of each column
15+
!! of matrix A.
16+
!!
17+
!! `x = mean(A, 1)` (see `x = mean(A)`).
18+
!!
19+
!! `x = mean(A, 2)` returns a `dim1` vector with the mean values of each row
20+
!! of matrix `A`.
21+
!!
22+
!!### Examples
23+
!! x = [ 1., 2., 3. ]
24+
!! y = mean(x)
25+
!! 2.
26+
!!
27+
!! A = reshape([ 1., 2., 3., 4., 5., 6., 7., 8., 9. ], [ 3, 3 ], &
28+
!! order = [ 2, 1 ])
29+
!! x = mean(A)
30+
!! 4. 5. 6.
31+
!! x = mean(A, 2)
32+
!! 2. 5. 8.
3733
use forlab_kinds
3834
implicit none
3935

0 commit comments

Comments
 (0)