arithmetic_geometric_mean Interface

public interface arithmetic_geometric_mean

Safe wrapper for the arithmetic-geometric mean (AGM) computation.

This interface performs lightweight AGM computation with input validation, automatic ordering. Unlike the type-bound subroutine instead, this interface does not retain intermediate calculation results, so they cannot be referenced later.

Note

  • If either input was NaN: returns NaN
  • If x and y had opposite signs (x * y .lt. 0): returns NaN
  • If either x or y is zero (x * y .eq. 0): returns 0
  • Otherwise: computes AGM using the iterative kernel

Module Procedures

private elemental function arithmetic_geometric_mean_real32(x, y) result(agm)

Safe wrapper for the arithmetic-geometric mean (AGM) computation.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: x
real(kind=real32), intent(in) :: y

Return Value real(kind=real32)

private elemental function arithmetic_geometric_mean_real64(x, y) result(agm)

Safe wrapper for the arithmetic-geometric mean (AGM) computation.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x
real(kind=real64), intent(in) :: y

Return Value real(kind=real64)

private elemental function arithmetic_geometric_mean_real128(x, y) result(agm)

Safe wrapper for the arithmetic-geometric mean (AGM) computation.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: x
real(kind=real128), intent(in) :: y

Return Value real(kind=real128)