pure function zeye_matrix(n) result(A) integer, intent(in) :: n complex(8) :: A(n, n) integer :: i A = zero do i = 1, n A(i,i) = one end do end function zeye_matrix