diff --git a/src/stdlib_experimental_stat_mean.f90 b/src/stdlib_experimental_stat_mean.f90 index 13dc60601..01bb62c09 100644 --- a/src/stdlib_experimental_stat_mean.f90 +++ b/src/stdlib_experimental_stat_mean.f90 @@ -10,21 +10,39 @@ module function mean_1_sp_sp(x) result(res) real(sp), intent(in) :: x(:) real(sp) :: res - res = sum(x) / real(size(x), sp) + integer :: i + + res = 0.0_sp + do i = 1, size(x) + res = res + x(i) + enddo + res = res / real(size(x), sp) end function mean_1_sp_sp module function mean_1_dp_dp(x) result(res) real(dp), intent(in) :: x(:) real(dp) :: res - res = sum(x) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + x(i) + enddo + res = res / real(size(x), dp) end function mean_1_dp_dp module function mean_1_qp_qp(x) result(res) real(qp), intent(in) :: x(:) real(qp) :: res - res = sum(x) / real(size(x), qp) + integer :: i + + res = 0.0_qp + do i = 1, size(x) + res = res + x(i) + enddo + res = res / real(size(x), qp) end function mean_1_qp_qp @@ -32,28 +50,52 @@ module function mean_1_int8_dp(x) result(res) integer(int8), intent(in) :: x(:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + real(x(i), dp) + enddo + res = res / real(size(x), dp) end function mean_1_int8_dp module function mean_1_int16_dp(x) result(res) integer(int16), intent(in) :: x(:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + real(x(i), dp) + enddo + res = res / real(size(x), dp) end function mean_1_int16_dp module function mean_1_int32_dp(x) result(res) integer(int32), intent(in) :: x(:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + real(x(i), dp) + enddo + res = res / real(size(x), dp) end function mean_1_int32_dp module function mean_1_int64_dp(x) result(res) integer(int64), intent(in) :: x(:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + real(x(i), dp) + enddo + res = res / real(size(x), dp) end function mean_1_int64_dp @@ -62,21 +104,45 @@ module function mean_2_all_sp_sp(x) result(res) real(sp), intent(in) :: x(:,:) real(sp) :: res - res = sum(x) / real(size(x), sp) + integer :: i, i_ + + res = 0.0_sp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + x(i,i_) + enddo + enddo + res = res / real(size(x), sp) end function mean_2_all_sp_sp module function mean_2_all_dp_dp(x) result(res) real(dp), intent(in) :: x(:,:) real(dp) :: res - res = sum(x) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + x(i,i_) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_dp_dp module function mean_2_all_qp_qp(x) result(res) real(qp), intent(in) :: x(:,:) real(qp) :: res - res = sum(x) / real(size(x), qp) + integer :: i, i_ + + res = 0.0_qp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + x(i,i_) + enddo + enddo + res = res / real(size(x), qp) end function mean_2_all_qp_qp @@ -84,28 +150,60 @@ module function mean_2_all_int8_dp(x) result(res) integer(int8), intent(in) :: x(:,:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + real(x(i,i_), dp) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_int8_dp module function mean_2_all_int16_dp(x) result(res) integer(int16), intent(in) :: x(:,:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + real(x(i,i_), dp) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_int16_dp module function mean_2_all_int32_dp(x) result(res) integer(int32), intent(in) :: x(:,:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + real(x(i,i_), dp) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_int32_dp module function mean_2_all_int64_dp(x) result(res) integer(int64), intent(in) :: x(:,:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + real(x(i,i_), dp) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_int64_dp @@ -114,63 +212,87 @@ module function mean_2_sp_sp(x, dim) result(res) integer, intent(in) :: dim real(sp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_sp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_sp_sp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + x(j, i) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_sp_sp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + x(i, j) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), sp) + end function mean_2_sp_sp module function mean_2_dp_dp(x, dim) result(res) real(dp), intent(in) :: x(:,:) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_dp_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + x(j, i) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_dp_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + x(i, j) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_dp_dp module function mean_2_qp_qp(x, dim) result(res) real(qp), intent(in) :: x(:,:) integer, intent(in) :: dim real(qp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_qp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_qp_qp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + x(j, i) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_qp_qp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + x(i, j) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), qp) + end function mean_2_qp_qp module function mean_2_int8_dp(x, dim) result(res) @@ -178,84 +300,116 @@ module function mean_2_int8_dp(x, dim) result(res) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int8_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + real(x(j, i), dp) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int8_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + real(x(i, j), dp) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_int8_dp module function mean_2_int16_dp(x, dim) result(res) integer(int16), intent(in) :: x(:,:) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int16_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + real(x(j, i), dp) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int16_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + real(x(i, j), dp) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_int16_dp module function mean_2_int32_dp(x, dim) result(res) integer(int32), intent(in) :: x(:,:) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int32_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + real(x(j, i), dp) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int32_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + real(x(i, j), dp) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_int32_dp module function mean_2_int64_dp(x, dim) result(res) integer(int64), intent(in) :: x(:,:) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int64_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + real(x(j, i), dp) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_int64_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + real(x(i, j), dp) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_int64_dp @@ -278,83 +432,6 @@ module function mean_4_all_sp_sp(x) result(res) res = sum(x) / real(size(x), sp) end function mean_4_all_sp_sp -module function mean_5_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_5_all_sp_sp -module function mean_6_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_6_all_sp_sp -module function mean_7_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_7_all_sp_sp -module function mean_8_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_8_all_sp_sp -module function mean_9_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_9_all_sp_sp -module function mean_10_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_10_all_sp_sp -module function mean_11_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_11_all_sp_sp -module function mean_12_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_12_all_sp_sp -module function mean_13_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_13_all_sp_sp -module function mean_14_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_14_all_sp_sp -module function mean_15_all_sp_sp(x) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(sp) :: res - - res = sum(x) / real(size(x), sp) - -end function mean_15_all_sp_sp module function mean_3_all_dp_dp(x) result(res) real(dp), intent(in) :: x(:,:,:) real(dp) :: res @@ -369,83 +446,6 @@ module function mean_4_all_dp_dp(x) result(res) res = sum(x) / real(size(x), dp) end function mean_4_all_dp_dp -module function mean_5_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_5_all_dp_dp -module function mean_6_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_6_all_dp_dp -module function mean_7_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_7_all_dp_dp -module function mean_8_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_8_all_dp_dp -module function mean_9_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_9_all_dp_dp -module function mean_10_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_10_all_dp_dp -module function mean_11_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_11_all_dp_dp -module function mean_12_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_12_all_dp_dp -module function mean_13_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_13_all_dp_dp -module function mean_14_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_14_all_dp_dp -module function mean_15_all_dp_dp(x) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(x) / real(size(x), dp) - -end function mean_15_all_dp_dp module function mean_3_all_qp_qp(x) result(res) real(qp), intent(in) :: x(:,:,:) real(qp) :: res @@ -460,83 +460,6 @@ module function mean_4_all_qp_qp(x) result(res) res = sum(x) / real(size(x), qp) end function mean_4_all_qp_qp -module function mean_5_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_5_all_qp_qp -module function mean_6_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_6_all_qp_qp -module function mean_7_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_7_all_qp_qp -module function mean_8_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_8_all_qp_qp -module function mean_9_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_9_all_qp_qp -module function mean_10_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_10_all_qp_qp -module function mean_11_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_11_all_qp_qp -module function mean_12_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_12_all_qp_qp -module function mean_13_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_13_all_qp_qp -module function mean_14_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_14_all_qp_qp -module function mean_15_all_qp_qp(x) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(qp) :: res - - res = sum(x) / real(size(x), qp) - -end function mean_15_all_qp_qp module function mean_3_all_int8_dp(x) result(res) integer(int8), intent(in) :: x(:,:,:) @@ -552,17438 +475,122 @@ module function mean_4_all_int8_dp(x) result(res) res = sum(real(x, dp)) / real(size(x), dp) end function mean_4_all_int8_dp -module function mean_5_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:) +module function mean_3_all_int16_dp(x) result(res) + integer(int16), intent(in) :: x(:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_5_all_int8_dp -module function mean_6_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:) +end function mean_3_all_int16_dp +module function mean_4_all_int16_dp(x) result(res) + integer(int16), intent(in) :: x(:,:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_6_all_int8_dp -module function mean_7_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:) +end function mean_4_all_int16_dp +module function mean_3_all_int32_dp(x) result(res) + integer(int32), intent(in) :: x(:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_7_all_int8_dp -module function mean_8_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:) +end function mean_3_all_int32_dp +module function mean_4_all_int32_dp(x) result(res) + integer(int32), intent(in) :: x(:,:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_8_all_int8_dp -module function mean_9_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:) +end function mean_4_all_int32_dp +module function mean_3_all_int64_dp(x) result(res) + integer(int64), intent(in) :: x(:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_9_all_int8_dp -module function mean_10_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) +end function mean_3_all_int64_dp +module function mean_4_all_int64_dp(x) result(res) + integer(int64), intent(in) :: x(:,:,:,:) real(dp) :: res res = sum(real(x, dp)) / real(size(x), dp) -end function mean_10_all_int8_dp -module function mean_11_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) +end function mean_4_all_int64_dp -end function mean_11_all_int8_dp -module function mean_12_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res +module function mean_3_sp_sp(x, dim) result(res) + real(sp), intent(in) :: x(:,:,:) + integer, intent(in) :: dim + real(sp) :: res( & + merge(size(x,1),size(x,2),mask = 1 < dim ), & + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i,i_ -end function mean_12_all_int8_dp -module function mean_13_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res + select case(dim) + case(1) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_sp_sp(x(:,i,i_)) + end do + end do + case(2) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_sp_sp(x(i,:,i_)) + end do + end do + case(3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_sp_sp(x(i,i_,:)) + end do + end do + case default + call error_stop("ERROR (mean): wrong dimension") + end select - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_13_all_int8_dp -module function mean_14_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_14_all_int8_dp -module function mean_15_all_int8_dp(x) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_15_all_int8_dp -module function mean_3_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_3_all_int16_dp -module function mean_4_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_4_all_int16_dp -module function mean_5_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_5_all_int16_dp -module function mean_6_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_6_all_int16_dp -module function mean_7_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_7_all_int16_dp -module function mean_8_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_8_all_int16_dp -module function mean_9_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_9_all_int16_dp -module function mean_10_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_10_all_int16_dp -module function mean_11_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_11_all_int16_dp -module function mean_12_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_12_all_int16_dp -module function mean_13_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_13_all_int16_dp -module function mean_14_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_14_all_int16_dp -module function mean_15_all_int16_dp(x) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_15_all_int16_dp -module function mean_3_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_3_all_int32_dp -module function mean_4_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_4_all_int32_dp -module function mean_5_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_5_all_int32_dp -module function mean_6_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_6_all_int32_dp -module function mean_7_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_7_all_int32_dp -module function mean_8_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_8_all_int32_dp -module function mean_9_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_9_all_int32_dp -module function mean_10_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_10_all_int32_dp -module function mean_11_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_11_all_int32_dp -module function mean_12_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_12_all_int32_dp -module function mean_13_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_13_all_int32_dp -module function mean_14_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_14_all_int32_dp -module function mean_15_all_int32_dp(x) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_15_all_int32_dp -module function mean_3_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_3_all_int64_dp -module function mean_4_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_4_all_int64_dp -module function mean_5_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_5_all_int64_dp -module function mean_6_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_6_all_int64_dp -module function mean_7_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_7_all_int64_dp -module function mean_8_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_8_all_int64_dp -module function mean_9_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_9_all_int64_dp -module function mean_10_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_10_all_int64_dp -module function mean_11_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_11_all_int64_dp -module function mean_12_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_12_all_int64_dp -module function mean_13_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_13_all_int64_dp -module function mean_14_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_14_all_int64_dp -module function mean_15_all_int64_dp(x) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - real(dp) :: res - - res = sum(real(x, dp)) / real(size(x), dp) - -end function mean_15_all_int64_dp - -module function mean_3_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_sp_sp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_sp_sp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_sp_sp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_sp_sp -module function mean_4_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_sp_sp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_sp_sp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_sp_sp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_sp_sp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_sp_sp -module function mean_5_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_sp_sp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_sp_sp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_sp_sp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_sp_sp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_sp_sp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_sp_sp -module function mean_6_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_sp_sp -module function mean_7_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_sp_sp -module function mean_8_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_sp_sp -module function mean_9_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_sp_sp -module function mean_10_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i_& - &_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_sp_sp -module function mean_11_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,& - &:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_sp_sp -module function mean_12_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_sp_sp -module function mean_13_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_sp_sp -module function mean_14_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__________& - &__,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_sp_sp -module function mean_15_sp_sp(x, dim) result(res) - real(sp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(sp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_sp_sp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_15_sp_sp -module function mean_3_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_dp_dp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_dp_dp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_dp_dp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_dp_dp -module function mean_4_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_dp_dp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_dp_dp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_dp_dp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_dp_dp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_dp_dp -module function mean_5_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_dp_dp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_dp_dp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_dp_dp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_dp_dp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_dp_dp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_dp_dp -module function mean_6_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_dp_dp -module function mean_7_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_dp_dp -module function mean_8_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_dp_dp -module function mean_9_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_dp_dp -module function mean_10_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i_& - &_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_dp_dp -module function mean_11_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,& - &:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_dp_dp -module function mean_12_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_dp_dp -module function mean_13_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_dp_dp -module function mean_14_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__________& - &__,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_dp_dp -module function mean_15_dp_dp(x, dim) result(res) - real(dp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_dp_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_15_dp_dp -module function mean_3_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_qp_qp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_qp_qp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_qp_qp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_qp_qp -module function mean_4_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_qp_qp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_qp_qp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_qp_qp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_qp_qp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_qp_qp -module function mean_5_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_qp_qp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_qp_qp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_qp_qp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_qp_qp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_qp_qp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_qp_qp -module function mean_6_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_qp_qp -module function mean_7_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_qp_qp -module function mean_8_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_qp_qp -module function mean_9_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_qp_qp -module function mean_10_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,& - &i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i_& - &_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_qp_qp -module function mean_11_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i_____& - &_,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,& - &:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,& - &i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_qp_qp -module function mean_12_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_qp_qp -module function mean_13_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_qp_qp -module function mean_14_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i________& - &____)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__________& - &__,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_qp_qp -module function mean_15_qp_qp(x, dim) result(res) - real(qp), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(qp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_qp_qp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_15_qp_qp - -module function mean_3_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int8_dp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int8_dp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int8_dp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_int8_dp -module function mean_4_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int8_dp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int8_dp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int8_dp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int8_dp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_int8_dp -module function mean_5_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int8_dp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int8_dp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int8_dp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int8_dp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int8_dp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_int8_dp -module function mean_6_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_int8_dp -module function mean_7_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_int8_dp -module function mean_8_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_int8_dp -module function mean_9_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_int8_dp -module function mean_10_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i______& - &_,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,& - &:,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,& - &i________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_int8_dp -module function mean_11_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i___& - &___,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i_____& - &_,:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i_____& - &_,i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_int8_dp -module function mean_12_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_int8_dp -module function mean_13_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_int8_dp -module function mean_14_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i______& - &______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i________& - &____,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_int8_dp -module function mean_15_int8_dp(x, dim) result(res) - integer(int8), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i___& - &_________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int8_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_15_int8_dp -module function mean_3_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int16_dp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int16_dp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int16_dp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_int16_dp -module function mean_4_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int16_dp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int16_dp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int16_dp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int16_dp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_int16_dp -module function mean_5_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int16_dp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int16_dp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int16_dp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int16_dp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int16_dp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_int16_dp -module function mean_6_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_int16_dp -module function mean_7_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_int16_dp -module function mean_8_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_int16_dp -module function mean_9_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_int16_dp -module function mean_10_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,:,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,i________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_int16_dp -module function mean_11_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_int16_dp -module function mean_12_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_int16_dp -module function mean_13_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_int16_dp -module function mean_14_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_int16_dp -module function mean_15_int16_dp(x, dim) result(res) - integer(int16), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int16_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_15_int16_dp -module function mean_3_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ) ) - - integer :: i,i_ - - select case(dim) - case(1) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int32_dp(x(:,i,i_)) - end do - end do - case(2) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int32_dp(x(i,:,i_)) - end do - end do - case(3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_) = mean_1_int32_dp(x(i,i_,:)) - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_3_int32_dp -module function mean_4_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ) ) - - integer :: i,i_,i__ - - select case(dim) - case(1) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int32_dp(x(:,i,i_,i__)) - end do - end do - end do - case(2) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int32_dp(x(i,:,i_,i__)) - end do - end do - end do - case(3) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int32_dp(x(i,i_,:,i__)) - end do - end do - end do - case(4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int32_dp(x(i,i_,i__,:)) - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_4_int32_dp -module function mean_5_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) - - integer :: i,i_,i__,i___ - - select case(dim) - case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int32_dp(x(:,i,i_,i__,i___)) - end do - end do - end do - end do - case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int32_dp(x(i,:,i_,i__,i___)) - end do - end do - end do - end do - case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int32_dp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int32_dp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int32_dp(x(i,i_,i__,i___,:)) - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_5_int32_dp -module function mean_6_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) - - integer :: i,i_,i__,i___,i____ - - select case(dim) - case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____)) - end do - end do - end do - end do - end do - case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____)) - end do - end do - end do - end do - end do - case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:)) - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_6_int32_dp -module function mean_7_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_7_int32_dp -module function mean_8_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______ - - select case(dim) - case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_8_int32_dp -module function mean_9_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ - - select case(dim) - case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_9_int32_dp -module function mean_10_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ - - select case(dim) - case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,:,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,i________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_10_int32_dp -module function mean_11_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ - - select case(dim) - case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_11_int32_dp -module function mean_12_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ - - select case(dim) - case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_12_int32_dp -module function mean_13_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ - - select case(dim) - case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_13_int32_dp -module function mean_14_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ - - select case(dim) - case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select - -end function mean_14_int32_dp -module function mean_15_int32_dp(x, dim) result(res) - integer(int32), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ - - select case(dim) - case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do +end function mean_3_sp_sp +module function mean_4_sp_sp(x, dim) result(res) + real(sp), intent(in) :: x(:,:,:,:) + integer, intent(in) :: dim + real(sp) :: res( & + merge(size(x,1),size(x,2),mask = 1 < dim ), & + merge(size(x,2),size(x,3),mask = 2 < dim ), & + merge(size(x,3),size(x,4),mask = 3 < dim ) ) + + integer :: i,i_,i__ + + select case(dim) + case(1) + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_sp_sp(x(:,i,i_,i__)) end do end do end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + case(2) + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_sp_sp(x(i,:,i_,i__)) end do end do end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + case(3) + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_sp_sp(x(i,i_,:,i__)) end do end do end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int32_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + case(4) + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_sp_sp(x(i,i_,i__,:)) end do end do end do @@ -17991,9 +598,9 @@ module function mean_15_int32_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_15_int32_dp -module function mean_3_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:) +end function mean_4_sp_sp +module function mean_3_dp_dp(x, dim) result(res) + real(dp), intent(in) :: x(:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & @@ -18005,28 +612,28 @@ module function mean_3_int64_dp(x, dim) result(res) case(1) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_) = mean_1_int64_dp(x(:,i,i_)) + res(i,i_) = mean_1_dp_dp(x(:,i,i_)) end do end do case(2) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_) = mean_1_int64_dp(x(i,:,i_)) + res(i,i_) = mean_1_dp_dp(x(i,:,i_)) end do end do case(3) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_) = mean_1_int64_dp(x(i,i_,:)) + res(i,i_) = mean_1_dp_dp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_3_int64_dp -module function mean_4_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:) +end function mean_3_dp_dp +module function mean_4_dp_dp(x, dim) result(res) + real(dp), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & @@ -18040,7 +647,7 @@ module function mean_4_int64_dp(x, dim) result(res) do i__ = 1, size(res, 3) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int64_dp(x(:,i,i_,i__)) + res(i,i_,i__) = mean_1_dp_dp(x(:,i,i_,i__)) end do end do end do @@ -18048,7 +655,7 @@ module function mean_4_int64_dp(x, dim) result(res) do i__ = 1, size(res, 3) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int64_dp(x(i,:,i_,i__)) + res(i,i_,i__) = mean_1_dp_dp(x(i,:,i_,i__)) end do end do end do @@ -18056,7 +663,7 @@ module function mean_4_int64_dp(x, dim) result(res) do i__ = 1, size(res, 3) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int64_dp(x(i,i_,:,i__)) + res(i,i_,i__) = mean_1_dp_dp(x(i,i_,:,i__)) end do end do end do @@ -18064,7 +671,7 @@ module function mean_4_int64_dp(x, dim) result(res) do i__ = 1, size(res, 3) do i_ = 1, size(res, 2) do i = 1, size(res, 1) - res(i,i_,i__) = mean_1_int64_dp(x(i,i_,i__,:)) + res(i,i_,i__) = mean_1_dp_dp(x(i,i_,i__,:)) end do end do end do @@ -18072,156 +679,80 @@ module function mean_4_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_4_int64_dp -module function mean_5_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:) +end function mean_4_dp_dp +module function mean_3_qp_qp(x, dim) result(res) + real(qp), intent(in) :: x(:,:,:) integer, intent(in) :: dim - real(dp) :: res( & + real(qp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ) ) + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - integer :: i,i_,i__,i___ + integer :: i,i_ select case(dim) case(1) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int64_dp(x(:,i,i_,i__,i___)) - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_qp_qp(x(:,i,i_)) end do end do case(2) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int64_dp(x(i,:,i_,i__,i___)) - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_qp_qp(x(i,:,i_)) end do end do case(3) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int64_dp(x(i,i_,:,i__,i___)) - end do - end do - end do - end do - case(4) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int64_dp(x(i,i_,i__,:,i___)) - end do - end do - end do - end do - case(5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___) = mean_1_int64_dp(x(i,i_,i__,i___,:)) - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_qp_qp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_5_int64_dp -module function mean_6_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:) +end function mean_3_qp_qp +module function mean_4_qp_qp(x, dim) result(res) + real(qp), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim - real(dp) :: res( & + real(qp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ) ) + merge(size(x,3),size(x,4),mask = 3 < dim ) ) - integer :: i,i_,i__,i___,i____ + integer :: i,i_,i__ select case(dim) case(1) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____)) - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_qp_qp(x(:,i,i_,i__)) end do end do end do case(2) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____)) - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_qp_qp(x(i,:,i_,i__)) end do end do end do case(3) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____)) - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_qp_qp(x(i,i_,:,i__)) end do end do end do case(4) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____)) - end do - end do - end do - end do - end do - case(5) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____)) - end do - end do - end do - end do - end do - case(6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:)) - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_qp_qp(x(i,i_,i__,:)) end do end do end do @@ -18229,447 +760,81 @@ module function mean_6_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_6_int64_dp -module function mean_7_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:) - integer, intent(in) :: dim - real(dp) :: res( & - merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ) ) - - integer :: i,i_,i__,i___,i____,i_____ - - select case(dim) - case(1) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(2) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(3) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(4) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(5) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____)) - end do - end do - end do - end do - end do - end do - case(6) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____)) - end do - end do - end do - end do - end do - end do - case(7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:)) - end do - end do - end do - end do - end do - end do - case default - call error_stop("ERROR (mean): wrong dimension") - end select +end function mean_4_qp_qp -end function mean_7_int64_dp -module function mean_8_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:) +module function mean_3_int8_dp(x, dim) result(res) + integer(int8), intent(in) :: x(:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ) ) + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______ + integer :: i,i_ select case(dim) case(1) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int8_dp(x(:,i,i_)) end do end do case(2) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int8_dp(x(i,:,i_)) end do end do case(3) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(4) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(5) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(6) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______)) - end do - end do - end do - end do - end do - end do - end do - case(7) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______)) - end do - end do - end do - end do - end do - end do - end do - case(8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:)) - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int8_dp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_8_int64_dp -module function mean_9_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:) +end function mean_3_int8_dp +module function mean_4_int8_dp(x, dim) result(res) + integer(int8), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ) ) + merge(size(x,3),size(x,4),mask = 3 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______ + integer :: i,i_,i__ select case(dim) case(1) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int8_dp(x(:,i,i_,i__)) end do end do end do case(2) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int8_dp(x(i,:,i_,i__)) end do end do end do case(3) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int8_dp(x(i,i_,:,i__)) end do end do end do case(4) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______)) - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:)) - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int8_dp(x(i,i_,i__,:)) end do end do end do @@ -18677,507 +842,80 @@ module function mean_9_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_9_int64_dp -module function mean_10_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:) +end function mean_4_int8_dp +module function mean_3_int16_dp(x, dim) result(res) + integer(int16), intent(in) :: x(:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ) ) + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________ + integer :: i,i_ select case(dim) case(1) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(2) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(3) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_____& - &__,i________)) - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int16_dp(x(:,i,i_)) end do end do - case(9) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,:,i________)) - end do - end do - end do - end do - end do - end do - end do + case(2) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int16_dp(x(i,:,i_)) end do end do - case(10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______& - &,i________,:)) - end do - end do - end do - end do - end do - end do - end do + case(3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int16_dp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_10_int64_dp -module function mean_11_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:) +end function mean_3_int16_dp +module function mean_4_int16_dp(x, dim) result(res) + integer(int16), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ) ) + merge(size(x,3),size(x,4),mask = 3 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________ + integer :: i,i_,i__ select case(dim) case(1) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int16_dp(x(:,i,i_,i__)) end do end do end do case(2) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int16_dp(x(i,:,i_,i__)) end do end do end do case(3) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int16_dp(x(i,i_,:,i__)) end do end do end do case(4) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i__& - &____,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,:,i_______,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,:,i________,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,:,i_________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i____& - &__,i_______,i________,i_________,:)) - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int16_dp(x(i,i_,i__,:)) end do end do end do @@ -19185,699 +923,80 @@ module function mean_11_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_11_int64_dp -module function mean_12_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:) +end function mean_4_int16_dp +module function mean_3_int32_dp(x, dim) result(res) + integer(int32), intent(in) :: x(:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ) ) + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________ + integer :: i,i_ select case(dim) case(1) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int32_dp(x(:,i,i_)) end do end do case(2) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int32_dp(x(i,:,i_)) end do end do case(3) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int32_dp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_12_int64_dp -module function mean_13_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:) +end function mean_3_int32_dp +module function mean_4_int32_dp(x, dim) result(res) + integer(int32), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ) ) + merge(size(x,3),size(x,4),mask = 3 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________ + integer :: i,i_,i__ select case(dim) case(1) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int32_dp(x(:,i,i_,i__)) end do end do end do case(2) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int32_dp(x(i,:,i_,i__)) end do end do end do case(3) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int32_dp(x(i,i_,:,i__)) end do end do end do case(4) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int32_dp(x(i,i_,i__,:)) end do end do end do @@ -19885,953 +1004,80 @@ module function mean_13_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_13_int64_dp -module function mean_14_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:) +end function mean_4_int32_dp +module function mean_3_int64_dp(x, dim) result(res) + integer(int64), intent(in) :: x(:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & - merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ) ) + merge(size(x,2),size(x,3),mask = 2 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________ + integer :: i,i_ select case(dim) case(1) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int64_dp(x(:,i,i_)) end do end do case(2) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int64_dp(x(i,:,i_)) end do end do case(3) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(4) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i_____& - &_______)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________) =& - & mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i_______& - &_____,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_) = mean_1_int64_dp(x(i,i_,:)) end do end do case default call error_stop("ERROR (mean): wrong dimension") end select -end function mean_14_int64_dp -module function mean_15_int64_dp(x, dim) result(res) - integer(int64), intent(in) :: x(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:) +end function mean_3_int64_dp +module function mean_4_int64_dp(x, dim) result(res) + integer(int64), intent(in) :: x(:,:,:,:) integer, intent(in) :: dim real(dp) :: res( & merge(size(x,1),size(x,2),mask = 1 < dim ), & merge(size(x,2),size(x,3),mask = 2 < dim ), & - merge(size(x,3),size(x,4),mask = 3 < dim ), & - merge(size(x,4),size(x,5),mask = 4 < dim ), & - merge(size(x,5),size(x,6),mask = 5 < dim ), & - merge(size(x,6),size(x,7),mask = 6 < dim ), & - merge(size(x,7),size(x,8),mask = 7 < dim ), & - merge(size(x,8),size(x,9),mask = 8 < dim ), & - merge(size(x,9),size(x,10),mask = 9 < dim ), & - merge(size(x,10),size(x,11),mask = 10 < dim ), & - merge(size(x,11),size(x,12),mask = 11 < dim ), & - merge(size(x,12),size(x,13),mask = 12 < dim ), & - merge(size(x,13),size(x,14),mask = 13 < dim ), & - merge(size(x,14),size(x,15),mask = 14 < dim ) ) + merge(size(x,3),size(x,4),mask = 3 < dim ) ) - integer :: i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i___________& - &__ + integer :: i,i_,i__ select case(dim) case(1) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(:,i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int64_dp(x(:,i,i_,i__)) end do end do end do case(2) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,:,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int64_dp(x(i,:,i_,i__)) end do end do end do case(3) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,:,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int64_dp(x(i,i_,:,i__)) end do end do end do case(4) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,:,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(5) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,:,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(6) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,:,i_____,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(7) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,:,i______,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(8) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,:,i_______,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(9) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,:,i________,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(10) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,:,i_________,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(11) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,:,i__________,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(12) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,:,i___________,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(13) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,:,i__& - &__________,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(14) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,:,i_____________)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - case(15) - do i_____________ = 1, size(res, 14) - do i____________ = 1, size(res, 13) - do i___________ = 1, size(res, 12) - do i__________ = 1, size(res, 11) - do i_________ = 1, size(res, 10) - do i________ = 1, size(res, 9) - do i_______ = 1, size(res, 8) - do i______ = 1, size(res, 7) - do i_____ = 1, size(res, 6) - do i____ = 1, size(res, 5) - do i___ = 1, size(res, 4) - do i__ = 1, size(res, 3) - do i_ = 1, size(res, 2) - do i = 1, size(res, 1) - res(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____________,i_____________& - &) = mean_1_int64_dp(x(i,i_,i__,i___,i____,i_____,i______,i_______,i________,i_________,i__________,i___________,i____& - &________,i_____________,:)) - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do - end do + do i__ = 1, size(res, 3) + do i_ = 1, size(res, 2) + do i = 1, size(res, 1) + res(i,i_,i__) = mean_1_int64_dp(x(i,i_,i__,:)) end do end do end do @@ -20839,6 +1085,6 @@ module function mean_15_int64_dp(x, dim) result(res) call error_stop("ERROR (mean): wrong dimension") end select -end function mean_15_int64_dp +end function mean_4_int64_dp end submodule diff --git a/src/stdlib_experimental_stat_mean.fypp.f90 b/src/stdlib_experimental_stat_mean.fypp.f90 index 5c82fece5..03448422e 100644 --- a/src/stdlib_experimental_stat_mean.fypp.f90 +++ b/src/stdlib_experimental_stat_mean.fypp.f90 @@ -17,7 +17,13 @@ module function mean_1_${k1}$_${k1}$(x) result(res) ${t1}$, intent(in) :: x(:) ${t1}$ :: res - res = sum(x) / real(size(x), ${k1}$) + integer :: i + + res = 0.0_${k1}$ + do i = 1, size(x) + res = res + x(i) + enddo + res = res / real(size(x), ${k1}$) end function mean_1_${k1}$_${k1}$ #:endfor @@ -27,7 +33,13 @@ module function mean_1_${k1}$_dp(x) result(res) ${t1}$, intent(in) :: x(:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i + + res = 0.0_dp + do i = 1, size(x) + res = res + real(x(i), dp) + enddo + res = res / real(size(x), dp) end function mean_1_${k1}$_dp #:endfor @@ -38,7 +50,15 @@ module function mean_2_all_${k1}$_${k1}$(x) result(res) ${t1}$, intent(in) :: x(:,:) ${t1}$ :: res - res = sum(x) / real(size(x), ${k1}$) + integer :: i, i_ + + res = 0.0_${k1}$ + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + x(i,i_) + enddo + enddo + res = res / real(size(x), ${k1}$) end function mean_2_all_${k1}$_${k1}$ #:endfor @@ -48,7 +68,15 @@ module function mean_2_all_${k1}$_dp(x) result(res) ${t1}$, intent(in) :: x(:,:) real(dp) :: res - res = sum(real(x, dp)) / real(size(x), dp) + integer :: i, i_ + + res = 0.0_dp + do i_ = 1, size(x, 2) + do i = 1, size(x, 1) + res = res + real(x(i,i_), dp) + enddo + enddo + res = res / real(size(x), dp) end function mean_2_all_${k1}$_dp #:endfor @@ -59,21 +87,29 @@ module function mean_2_${k1}$_${k1}$(x, dim) result(res) integer, intent(in) :: dim ${t1}$ :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_${k1}$ select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_${k1}$_${k1}$(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + x(j, i) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_${k1}$_${k1}$(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + x(i, j) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), ${k1}$) + end function mean_2_${k1}$_${k1}$ #:endfor @@ -83,21 +119,29 @@ module function mean_2_${k1}$_dp(x, dim) result(res) integer, intent(in) :: dim real(dp) :: res(size(x)/size(x, dim)) - integer :: i + integer :: i, j + + res = 0.0_dp select case(dim) case(1) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_${k1}$_dp(x(:,i)) + do i = 1, size(x, 2) + do j = 1, size(x, 1) + res(i) = res(i) + real(x(j, i), dp) + end do end do case(2) - do i=1, size(x)/size(x, dim) - res(i) = mean_1_${k1}$_dp(x(i,:)) + do j = 1, size(x, 2) + do i = 1, size(x, 1) + res(i) = res(i) + real(x(i, j), dp) + end do end do case default call error_stop("ERROR (mean): wrong dimension") end select + res = res / real(size(x, dim), dp) + end function mean_2_${k1}$_dp #:endfor @@ -119,7 +163,7 @@ end function mean_2_${k1}$_dp #:enddef -#:set ranks = range(3,16) +#:set ranks = range(3,5) #:for i1, k1, t1 in iktr #:for rank in ranks