Check if the arithmetic-geometric mean iteration has not yet converged.
Note
Convergence criterion
Returns .true. if the absolute difference between the arithmetic mean a
and geometric mean g exceeds the machine epsilon relative to the smaller value,
as determined by spacing(min(a, g)).
Mathematically: |a - g| > spacing(min(a, g))
Appendix
This function is designed for internal use within the AGM iteration where
both values are guaranteed to be positive and converging.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in) | :: | a |
arithmetic mean |
||
| real(kind=real32), | intent(in) | :: | g |
geometric mean |
elemental function is_not_converged_real32(a, g) result(stat) !! Check if the arithmetic-geometric mean iteration has not yet converged. !! !! @note !! **Convergence criterion** !! Returns `.true.` if the absolute difference between the arithmetic mean `a` !! and geometric mean `g` exceeds the machine epsilon relative to the smaller value, !! as determined by `spacing(min(a, g))`. !! !! Mathematically: `|a - g| > spacing(min(a, g))` !! !! **Appendix** !! This function is designed for internal use within the AGM iteration where !! both values are guaranteed to be positive and converging. !! @endnote real(real32), intent(in) :: a !! arithmetic mean real(real32), intent(in) :: g !! geometric mean logical :: stat stat = abs(a - g) .gt. spacing( min(a, g) ) end function is_not_converged_real32