Real part of the trace
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=dp), | dimension(:, :) | :: | mat |
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