function calc_eigenvalues_cmplx(matrix) result(e_values)
complex(dp), intent(in) :: matrix(:,:)
real(dp) :: e_values(size(matrix,1))
character(*), parameter :: this_routine = 'calc_eigenvalues_cmplx'
integer :: n, info
complex(dp) :: work(3*size(matrix,1))
complex(dp) :: tmp_matrix(size(matrix,1),size(matrix,2))
real(dp), allocatable :: rwork(:)
n = size(matrix,1)
tmp_matrix = matrix
allocate(rwork(max(1, 3*n - 2)))
call zheev('N','N', n, tmp_matrix, n, e_values, work, 3*n, rwork, info)
if (info /= 0) call stop_all(this_routine, 'Failed in BLAS call.')
deallocate(rwork)
call sort(e_values)
end function calc_eigenvalues_cmplx