dbcsr_scalar_one Function

public elemental function dbcsr_scalar_one(data_type) result(one)

Returns an encapsulated scalar "1"

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: data_type

use the data type

Return Value type(dbcsr_scalar_type)

encapsulated value of one


Source Code

   ELEMENTAL FUNCTION dbcsr_scalar_one(data_type) RESULT(one)
      !! Returns an encapsulated scalar "1"

      INTEGER, INTENT(IN)                                :: data_type
         !! use the data type
      TYPE(dbcsr_scalar_type)                            :: one
         !! encapsulated value of one

      one = dbcsr_scalar_zero(data_type)
      SELECT CASE (data_type)
      CASE (dbcsr_type_real_4)
         one%r_sp = 1.0_real_4
      CASE (dbcsr_type_real_8)
         one%r_dp = 1.0_real_8
      CASE (dbcsr_type_complex_4)
         one%c_sp = CMPLX(1.0, 0.0, real_4)
      CASE (dbcsr_type_complex_8)
         one%c_dp = CMPLX(1.0, 0.0, real_8)
      END SELECT
   END FUNCTION dbcsr_scalar_one