dbcsr_scalar_are_equal Function

public elemental function dbcsr_scalar_are_equal(s1, s2) result(are_equal)

Returns whether an encapsulated scalar is equal to another value

Arguments

Type IntentOptional Attributes Name
type(dbcsr_scalar_type), intent(in) :: s1

one value another value

type(dbcsr_scalar_type), intent(in) :: s2

one value another value

Return Value logical

whether values are equal


Source Code

   ELEMENTAL FUNCTION dbcsr_scalar_are_equal(s1, s2) RESULT(are_equal)
      !! Returns whether an encapsulated scalar is equal to another value

      TYPE(dbcsr_scalar_type), INTENT(IN)                :: s1, s2
         !! one value
         !! another value
      LOGICAL                                            :: are_equal
         !! whether values are equal

      IF (s1%data_type .NE. s2%data_type) THEN
         are_equal = .FALSE.
      ELSE
         SELECT CASE (s1%data_type)
         CASE (dbcsr_type_real_4)
            are_equal = s1%r_sp .EQ. s2%r_sp
         CASE (dbcsr_type_real_8)
            are_equal = s1%r_dp .EQ. s2%r_dp
         CASE (dbcsr_type_complex_4)
            are_equal = s1%c_sp .EQ. s2%c_sp
         CASE (dbcsr_type_complex_8)
            are_equal = s1%c_dp .EQ. s2%c_dp
         CASE default
            are_equal = .FALSE.
         END SELECT
      END IF
   END FUNCTION dbcsr_scalar_are_equal