mod_check_values Module

This module contains various methods to check for small, NaN or negative values, equal values or inf values. Interfaces are provided for functionality with real and complex variables.



Contents


Interfaces

public interface set_small_values_to_zero

interface to check for small values

  • private elemental subroutine small_values_real(var, tol)

    Small value checks for a real variable/array/matrix. Values that are smaller than the specified tolerance tol are set to zero. If tol is not present, DP_LIMIT is used as tolerance.

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(inout) :: var

    the real variable/array/matrix to check, modified on output

    real(kind=dp), intent(in), optional :: tol

    optional tolerance to check against

  • private elemental subroutine small_values_complex(var, tol)

    Small value checks for a complex variable/array/matrix, with the real and imaginary parts checked separately. Values that are smaller than the specified tolerance tol are set to zero. If tol is not present, DP_LIMIT is used as tolerance.

    Arguments

    TypeIntentOptionalAttributesName
    complex(kind=dp), intent(inout) :: var

    the complex variable/array/matrix to check, modified on output

    real(kind=dp), intent(in), optional :: tol

    optional tolerance to check against

public interface is_NaN

interface to check for NaN values

  • private elemental function contains_NaN_real(var)

    Checks a given real value/array/matrix for NaN.

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: var

    the real variable/array/matrix to check

    Return Value logical

  • private elemental function contains_NaN_complex(var)

    Checks a given complex value/array/matrix for NaN.

    Arguments

    TypeIntentOptionalAttributesName
    complex(kind=dp), intent(in) :: var

    the complex variable/array/matrix to check

    Return Value logical

public interface is_infinite

interface to check for inf values

  • private elemental function contains_inf_real(var)

    checks a given real value/array/matrix for infinity.

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: var

    the real variable/array/matrix to check

    Return Value logical

  • private elemental function contains_inf_complex(var)

    checks a given complex value/array/matrix for infinity.

    Arguments

    TypeIntentOptionalAttributesName
    complex(kind=dp), intent(in) :: var

    the complex variable/array/matrix to check

    Return Value logical

public interface is_equal

interface to check equality between values/arrays

  • private elemental function real_is_equal(value, base, tol)

    Equality check between real values

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: value

    the real value(s) to check

    real(kind=dp), intent(in) :: base

    the value(s) to compare against

    real(kind=dp), intent(in), optional :: tol

    optional tolerance

    Return Value logical

  • private elemental function complex_is_equal(value, base, tol)

    Equality check between complex values

    Arguments

    TypeIntentOptionalAttributesName
    complex(kind=dp), intent(in) :: value

    the real value(s) to check

    complex(kind=dp), intent(in) :: base

    the value(s) to compare against

    real(kind=dp), intent(in), optional :: tol

    optional tolerance

    Return Value logical

public interface is_zero

interface to check if values/arrays are zero

  • private elemental function real_is_zero(value, tol)

    Checks if real values are zero

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: value

    the real value(s) to check

    real(kind=dp), intent(in), optional :: tol

    optional tolerance

    Return Value logical

  • private elemental function complex_is_zero(value, tol)

    Checks if complex values are zero

    Arguments

    TypeIntentOptionalAttributesName
    complex(kind=dp), intent(in) :: value

    the complex value(s) to check

    real(kind=dp), intent(in), optional :: tol

    optional tolerance

    Return Value logical

public interface is_negative

interface to check for negative values

  • private elemental function real_is_negative(value)

    Check if values are or contain negative numbers

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: value

    the real value(s) to check

    Return Value logical

public interface is_constant

interface to check if an array is constant

  • private function real_array_is_constant(array, tol)

    Check if an array has constant values

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=dp), intent(in) :: array(:)

    the real array to check

    real(kind=dp), intent(in), optional :: tol

    optional tolerance

    Return Value logical


Functions

private elemental function contains_NaN_real(var)

Checks a given real value/array/matrix for NaN.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: var

the real variable/array/matrix to check

Return Value logical

private elemental function contains_NaN_complex(var)

Checks a given complex value/array/matrix for NaN.

Arguments

TypeIntentOptionalAttributesName
complex(kind=dp), intent(in) :: var

the complex variable/array/matrix to check

Return Value logical

private elemental function contains_inf_real(var)

checks a given real value/array/matrix for infinity.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: var

the real variable/array/matrix to check

Return Value logical

private elemental function contains_inf_complex(var)

checks a given complex value/array/matrix for infinity.

Arguments

TypeIntentOptionalAttributesName
complex(kind=dp), intent(in) :: var

the complex variable/array/matrix to check

Return Value logical

private elemental function real_is_equal(value, base, tol)

Equality check between real values

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: value

the real value(s) to check

real(kind=dp), intent(in) :: base

the value(s) to compare against

real(kind=dp), intent(in), optional :: tol

optional tolerance

Return Value logical

private elemental function complex_is_equal(value, base, tol)

Equality check between complex values

Arguments

TypeIntentOptionalAttributesName
complex(kind=dp), intent(in) :: value

the real value(s) to check

complex(kind=dp), intent(in) :: base

the value(s) to compare against

real(kind=dp), intent(in), optional :: tol

optional tolerance

Return Value logical

private elemental function real_is_zero(value, tol)

Checks if real values are zero

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: value

the real value(s) to check

real(kind=dp), intent(in), optional :: tol

optional tolerance

Return Value logical

private elemental function complex_is_zero(value, tol)

Checks if complex values are zero

Arguments

TypeIntentOptionalAttributesName
complex(kind=dp), intent(in) :: value

the complex value(s) to check

real(kind=dp), intent(in), optional :: tol

optional tolerance

Return Value logical

private elemental function real_is_negative(value)

Check if values are or contain negative numbers

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: value

the real value(s) to check

Return Value logical

private function real_array_is_constant(array, tol)

Check if an array has constant values

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: array(:)

the real array to check

real(kind=dp), intent(in), optional :: tol

optional tolerance

Return Value logical


Subroutines

private elemental subroutine small_values_real(var, tol)

Small value checks for a real variable/array/matrix. Values that are smaller than the specified tolerance tol are set to zero. If tol is not present, DP_LIMIT is used as tolerance.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(inout) :: var

the real variable/array/matrix to check, modified on output

real(kind=dp), intent(in), optional :: tol

optional tolerance to check against

private elemental subroutine small_values_complex(var, tol)

Small value checks for a complex variable/array/matrix, with the real and imaginary parts checked separately. Values that are smaller than the specified tolerance tol are set to zero. If tol is not present, DP_LIMIT is used as tolerance.

Arguments

TypeIntentOptionalAttributesName
complex(kind=dp), intent(inout) :: var

the complex variable/array/matrix to check, modified on output

real(kind=dp), intent(in), optional :: tol

optional tolerance to check against