function that extracts the diagonal of a matrix where is a vector containing the diagonal elements of the matrix .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A |
function Diag(A) result(D) real(dp), dimension(:, :), intent(in) :: A real(dp), dimension(size(A, 1)) :: D integer :: i, N N = size(A, 1) forall (i=1:N) D(i) = A(i, i) end function Diag