utility_re_tr Function

public function utility_re_tr(mat)

Uses

  • proc~~utility_re_tr~~UsesGraph proc~utility_re_tr utility_re_tr module~w90_constants w90_constants proc~utility_re_tr->module~w90_constants

Real part of the trace

Arguments

Type IntentOptional AttributesName
complex(kind=dp), dimension(:, :):: mat

Return Value real(kind=dp)


Contents

Source Code


Source Code

  function utility_re_tr(mat)
    !========================!
    !                        !
    !! Real part of the trace
    !                        !
    !========================!

    use w90_constants, only: dp, cmplx_0, cmplx_i

    real(kind=dp)                    :: utility_re_tr
    complex(kind=dp), dimension(:, :) :: mat

    integer          :: i, mydim
    complex(kind=dp) :: cdum

    mydim = size(mat, 1)

    cdum = cmplx_0
    do i = 1, mydim
      cdum = cdum + mat(i, i)
    enddo
    utility_re_tr = aimag(cmplx_i*cdum)

  end function utility_re_tr