@@ -816,33 +816,37 @@ subroutine calc_comp_corrs_binormal( xpyp, xm, ym, mu_x_1, mu_x_2, & ! In
816
816
real ( kind = core_rknd ), dimension (gr% nz), intent (out ) :: &
817
817
corr_x_y_1, & ! Correlation of x and y (1st PDF component) [-]
818
818
corr_x_y_2 ! Correlation of x and y (2nd PDF component) [-]
819
+
820
+ integer :: i
819
821
822
+ do i= 1 , gr% nz
820
823
821
- where ( sigma_x_1_sqd * sigma_y_1_sqd > zero &
822
- .or. sigma_x_2_sqd * sigma_y_2_sqd > zero )
824
+ if ( sigma_x_1_sqd(i) * sigma_y_1_sqd(i) > zero &
825
+ .or. sigma_x_2_sqd(i) * sigma_y_2_sqd(i) > zero ) then
823
826
824
- ! Calculate corr_x_y_1 (which also equals corr_x_y_2).
825
- corr_x_y_1 &
826
- = ( xpyp &
827
- - mixt_frac * ( mu_x_1 - xm ) * ( mu_y_1 - ym ) &
828
- - ( one - mixt_frac ) * ( mu_x_2 - xm ) * ( mu_y_2 - ym ) ) &
829
- / ( mixt_frac * sqrt ( sigma_x_1_sqd * sigma_y_1_sqd ) &
830
- + ( one - mixt_frac ) * sqrt ( sigma_x_2_sqd * sigma_y_2_sqd ) )
827
+ ! Calculate corr_x_y_1 (which also equals corr_x_y_2).
828
+ corr_x_y_1(i) &
829
+ = ( xpyp(i) &
830
+ - mixt_frac(i) * ( mu_x_1(i) - xm(i) ) * ( mu_y_1(i) - ym(i) ) &
831
+ - ( one - mixt_frac(i) ) * ( mu_x_2(i) - xm(i) ) * ( mu_y_2(i) - ym(i) ) ) &
832
+ / ( mixt_frac(i) * sqrt ( sigma_x_1_sqd(i) * sigma_y_1_sqd(i) ) &
833
+ + ( one - mixt_frac(i) ) * sqrt ( sigma_x_2_sqd(i) * sigma_y_2_sqd(i) ) )
831
834
832
- ! The correlation must fall within the bounds of
833
- ! -1 <= corr_x_y_1 (= corr_x_y_2) <= 1.
834
- where ( corr_x_y_1 > one )
835
- corr_x_y_1 = one
836
- elsewhere ( corr_x_y_1 < - one )
837
- corr_x_y_1 = - one
838
- endwhere
835
+ ! The correlation must fall within the bounds of
836
+ ! -1 <= corr_x_y_1 (= corr_x_y_2) <= 1.
837
+ if ( corr_x_y_1(i) > one ) then
838
+ corr_x_y_1(i) = one
839
+ elseif ( corr_x_y_1(i) < - one ) then
840
+ corr_x_y_1(i) = - one
841
+ endif
839
842
840
- elsewhere ! sigma_x_1^2 * sigma_y_1^2 = 0 and sigma_x_2^2 * sigma_y_2^2 = 0.
843
+ else ! sigma_x_1^2 * sigma_y_1^2 = 0 and sigma_x_2^2 * sigma_y_2^2 = 0.
841
844
842
- ! The correlation is undefined (output as 0).
843
- corr_x_y_1 = zero
845
+ ! The correlation is undefined (output as 0).
846
+ corr_x_y_1(i) = zero
847
+ end if
844
848
845
- endwhere
849
+ end do
846
850
847
851
! Set corr_x_y_2 equal to corr_x_y_1.
848
852
corr_x_y_2 = corr_x_y_1
0 commit comments