Computes the diagonal elements of the matrix mat1.mat2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=dp) | :: | mat1(dim,dim) | ||||
complex(kind=dp) | :: | mat2(dim,dim) | ||||
integer | :: | dim |
function utility_matmul_diag(mat1, mat2, dim)
!===========================================================!
! !
!! Computes the diagonal elements of the matrix mat1.mat2
! !
!===========================================================!
use w90_constants, only: dp, cmplx_0
integer :: dim
complex(kind=dp) :: utility_matmul_diag(dim)
complex(kind=dp) :: mat1(dim, dim)
complex(kind=dp) :: mat2(dim, dim)
integer i, j
utility_matmul_diag = cmplx_0
do i = 1, dim
do j = 1, dim
utility_matmul_diag(i) = utility_matmul_diag(i) + mat1(i, j)*mat2(j, i)
end do
end do
end function utility_matmul_diag