|
1 | 1 | module stdlib_experimental_stat
|
2 | 2 |
|
3 | 3 |
|
4 |
| -use stdlib_experimental_kinds, only: sp, dp, qp |
| 4 | + |
| 5 | + |
| 6 | +use stdlib_experimental_kinds, only: sp, dp, qp, & |
| 7 | + int8, int16, int32, int64 |
5 | 8 | implicit none
|
6 | 9 | private
|
7 | 10 | ! Public API
|
8 | 11 | public :: mean
|
9 | 12 |
|
10 | 13 |
|
11 | 14 | interface mean
|
12 |
| - module function mean_1_sp_sp(mat) result(res) |
13 |
| - real(sp), intent(in) :: mat(:) |
14 |
| - real(sp) ::res |
| 15 | + module function mean_1_sp_sp(x) result(res) |
| 16 | + real(sp), intent(in) :: x(:) |
| 17 | + real(sp) :: res |
15 | 18 | end function mean_1_sp_sp
|
16 |
| - module function mean_1_dp_dp(mat) result(res) |
17 |
| - real(dp), intent(in) :: mat(:) |
18 |
| - real(dp) ::res |
| 19 | + module function mean_1_dp_dp(x) result(res) |
| 20 | + real(dp), intent(in) :: x(:) |
| 21 | + real(dp) :: res |
19 | 22 | end function mean_1_dp_dp
|
20 |
| - module function mean_1_qp_qp(mat) result(res) |
21 |
| - real(qp), intent(in) :: mat(:) |
22 |
| - real(qp) ::res |
| 23 | + module function mean_1_qp_qp(x) result(res) |
| 24 | + real(qp), intent(in) :: x(:) |
| 25 | + real(qp) :: res |
23 | 26 | end function mean_1_qp_qp
|
24 | 27 |
|
25 |
| - module function mean_2_all_sp_sp(mat) result(res) |
26 |
| - real(sp), intent(in) :: mat(:,:) |
27 |
| - real(sp) ::res |
| 28 | + module function mean_1_int8_dp(x) result(res) |
| 29 | + integer(int8), intent(in) :: x(:) |
| 30 | + real(dp) :: res |
| 31 | + end function mean_1_int8_dp |
| 32 | + module function mean_1_int16_dp(x) result(res) |
| 33 | + integer(int16), intent(in) :: x(:) |
| 34 | + real(dp) :: res |
| 35 | + end function mean_1_int16_dp |
| 36 | + module function mean_1_int32_dp(x) result(res) |
| 37 | + integer(int32), intent(in) :: x(:) |
| 38 | + real(dp) :: res |
| 39 | + end function mean_1_int32_dp |
| 40 | + module function mean_1_int64_dp(x) result(res) |
| 41 | + integer(int64), intent(in) :: x(:) |
| 42 | + real(dp) :: res |
| 43 | + end function mean_1_int64_dp |
| 44 | + |
| 45 | + module function mean_2_all_sp_sp(x) result(res) |
| 46 | + real(sp), intent(in) :: x(:,:) |
| 47 | + real(sp) :: res |
28 | 48 | end function mean_2_all_sp_sp
|
29 |
| - module function mean_2_all_dp_dp(mat) result(res) |
30 |
| - real(dp), intent(in) :: mat(:,:) |
31 |
| - real(dp) ::res |
| 49 | + module function mean_2_all_dp_dp(x) result(res) |
| 50 | + real(dp), intent(in) :: x(:,:) |
| 51 | + real(dp) :: res |
32 | 52 | end function mean_2_all_dp_dp
|
33 |
| - module function mean_2_all_qp_qp(mat) result(res) |
34 |
| - real(qp), intent(in) :: mat(:,:) |
35 |
| - real(qp) ::res |
| 53 | + module function mean_2_all_qp_qp(x) result(res) |
| 54 | + real(qp), intent(in) :: x(:,:) |
| 55 | + real(qp) :: res |
36 | 56 | end function mean_2_all_qp_qp
|
37 | 57 |
|
| 58 | + module function mean_2_all_int8_dp(x) result(res) |
| 59 | + integer(int8), intent(in) :: x(:,:) |
| 60 | + real(dp) :: res |
| 61 | + end function mean_2_all_int8_dp |
| 62 | + module function mean_2_all_int16_dp(x) result(res) |
| 63 | + integer(int16), intent(in) :: x(:,:) |
| 64 | + real(dp) :: res |
| 65 | + end function mean_2_all_int16_dp |
| 66 | + module function mean_2_all_int32_dp(x) result(res) |
| 67 | + integer(int32), intent(in) :: x(:,:) |
| 68 | + real(dp) :: res |
| 69 | + end function mean_2_all_int32_dp |
| 70 | + module function mean_2_all_int64_dp(x) result(res) |
| 71 | + integer(int64), intent(in) :: x(:,:) |
| 72 | + real(dp) :: res |
| 73 | + end function mean_2_all_int64_dp |
38 | 74 |
|
39 |
| - module function mean_2_sp_sp(mat, dim) result(res) |
40 |
| - real(sp), intent(in) :: mat(:,:) |
| 75 | + module function mean_2_sp_sp(x, dim) result(res) |
| 76 | + real(sp), intent(in) :: x(:,:) |
41 | 77 | integer, intent(in) :: dim
|
42 |
| - real(sp) :: res(size(mat)/size(mat, dim)) |
| 78 | + real(sp) :: res(size(x)/size(x, dim)) |
43 | 79 | end function mean_2_sp_sp
|
44 |
| - module function mean_2_dp_dp(mat, dim) result(res) |
45 |
| - real(dp), intent(in) :: mat(:,:) |
| 80 | + module function mean_2_dp_dp(x, dim) result(res) |
| 81 | + real(dp), intent(in) :: x(:,:) |
46 | 82 | integer, intent(in) :: dim
|
47 |
| - real(dp) :: res(size(mat)/size(mat, dim)) |
| 83 | + real(dp) :: res(size(x)/size(x, dim)) |
48 | 84 | end function mean_2_dp_dp
|
49 |
| - module function mean_2_qp_qp(mat, dim) result(res) |
50 |
| - real(qp), intent(in) :: mat(:,:) |
| 85 | + module function mean_2_qp_qp(x, dim) result(res) |
| 86 | + real(qp), intent(in) :: x(:,:) |
51 | 87 | integer, intent(in) :: dim
|
52 |
| - real(qp) :: res(size(mat)/size(mat, dim)) |
| 88 | + real(qp) :: res(size(x)/size(x, dim)) |
53 | 89 | end function mean_2_qp_qp
|
| 90 | + |
| 91 | + module function mean_2_int8_dp(x, dim) result(res) |
| 92 | + integer(int8), intent(in) :: x(:,:) |
| 93 | + integer, intent(in) :: dim |
| 94 | + real(dp) :: res(size(x)/size(x, dim)) |
| 95 | + end function mean_2_int8_dp |
| 96 | + module function mean_2_int16_dp(x, dim) result(res) |
| 97 | + integer(int16), intent(in) :: x(:,:) |
| 98 | + integer, intent(in) :: dim |
| 99 | + real(dp) :: res(size(x)/size(x, dim)) |
| 100 | + end function mean_2_int16_dp |
| 101 | + module function mean_2_int32_dp(x, dim) result(res) |
| 102 | + integer(int32), intent(in) :: x(:,:) |
| 103 | + integer, intent(in) :: dim |
| 104 | + real(dp) :: res(size(x)/size(x, dim)) |
| 105 | + end function mean_2_int32_dp |
| 106 | + module function mean_2_int64_dp(x, dim) result(res) |
| 107 | + integer(int64), intent(in) :: x(:,:) |
| 108 | + integer, intent(in) :: dim |
| 109 | + real(dp) :: res(size(x)/size(x, dim)) |
| 110 | + end function mean_2_int64_dp |
| 111 | + |
54 | 112 | end interface
|
55 | 113 |
|
56 | 114 | end module
|
0 commit comments