Compute arithmetic and geometric mean using the given prev_a and prev_g.
Warning
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real128), | intent(in) | :: | prev_a |
previous arithmetic mean |
||
| real(kind=real128), | intent(in) | :: | prev_g |
previous geometric mean |
||
| real(kind=real128), | intent(out) | :: | next_a |
next arithmetic mean |
||
| real(kind=real128), | intent(out) | :: | next_g |
next geometric mean |
elemental subroutine compute_step_real128(prev_a, prev_g, next_a, next_g) !! Compute arithmetic and geometric mean using the given `prev_a` and `prev_g`. !! !! @warning !! - This subroutine assumes both inputs are positive. !! - No validation is performed on inputs. !! @endwarning real(real128), intent(in) :: prev_a !! previous arithmetic mean real(real128), intent(in) :: prev_g !! previous geometric mean real(real128), intent(out) :: next_a !! next arithmetic mean real(real128), intent(out) :: next_g !! next geometric mean next_a = (prev_a + prev_g) * 0.5_real128 next_g = sqrt(prev_a * prev_g) end subroutine compute_step_real128