Elmtrans copies the Hessenberg matrix stored in mat
to h
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | Dimension of mat |
||
integer, | intent(in) | :: | low | First nonzero row |
||
integer, | intent(in) | :: | high | Last nonzero row |
||
real(kind=double), | intent(in) | :: | mat(0:n-1,0:n-1) |
|
||
integer, | intent(in) | :: | perm(0:n-1) | Permutation data from elmhes |
||
real(kind=double), | intent(out) | :: | h(0:n-1,0:n-1) | Hessenberg matrix |
Subroutine elmtrans(n, low, high, mat, perm, h )
!+ Elmtrans copies the Hessenberg matrix stored in `mat` to `h`
integer,intent(in) :: n
!+ Dimension of mat
integer,intent(in) :: low
!+ First nonzero row
integer,intent(in) :: high
!+ Last nonzero row
real(double), intent(in) :: mat(0:n-1,0:n-1)
!+ `n`x`n` input matrix
integer,intent(in) :: perm(0:n-1)
!+ Permutation data from elmhes
real(double),intent(out) :: h(0:n-1,0:n-1)
!+ Hessenberg matrix
integer :: i, j, k
do i = 0, n-1
do k = 0, n-1
h(i,k) = ZERO
enddo
h(i,i) = ONE
enddo
do i = high - 1, low+1, -1
j = perm(i)
do k = i + 1, high
h(k,i) = mat(k,i-1)
enddo
if (i.ne.j) then
do k = i, high
h(i,k) = h(j,k)
h(j,k) = ZERO
enddo
h(j,i) = ONE
endif
enddo
end subroutine elmtrans