1
subroutine corth(nm,n,low,igh,ar,ai,ortr,orti)
3
integer i,j,m,n,ii,jj,la,mp,nm,igh,kp1,low
4
double precision ar(nm,n),ai(nm,n),ortr(igh),orti(igh)
5
double precision f,g,h,fi,fr,scale
9
c given a complex general matrix, this subroutine
10
c reduces a submatrix situated in rows and columns
11
c low through igh to upper hessenberg form by
12
c unitary similarity transformations.
15
c subroutine corth(nm,n,low,igh,ar,ai,ortr,orti)
17
c integer i,j,m,n,ii,jj,la,mp,nm,igh,kp1,low
18
c double precision ar(nm,n),ai(nm,n),ortr(igh),orti(igh)
19
c double precision f,g,h,fi,fr,scale
23
c nm must be set to the row dimension of two-dimensional
24
c array parameters as declared in the calling program
25
c dimension statement;
27
c n is the order of the matrix;
29
c low and igh are integers determined by the balancing
30
c subroutine cbal. if cbal has not been used,
33
c ar and ai contain the real and imaginary parts,
34
c respectively, of the complex input matrix.
38
c ar and ai contain the real and imaginary parts,
39
c respectively, of the hessenberg matrix. information
40
c about the unitary transformations used in the reduction
41
c is stored in the remaining triangles under the
44
c ortr and orti contain further information about the
45
c transformations. only elements low through igh are used.
49
c this subroutine is a translation of a complex analogue of
50
c the algol procedure orthes, num. math. 12, 349-368(1968)
51
c by martin and wilkinson.
52
c handbook for auto. comp., vol.ii-linear algebra, 339-358(1971).
53
c questions and comments should be directed to b. s. garbow,
54
c applied mathematics division, argonne national laboratory
57
c ------------------------------------------------------------------
61
if (la .lt. kp1) go to 200
68
c :::::::::: scale column (algol tol then not needed) ::::::::::
70
90 scale = scale + abs(ar(i,m-1)) + abs(ai(i,m-1))
72
if (scale .eq. 0.0d+0) go to 180
74
c :::::::::: for i=igh step -1 until m do -- ::::::::::
77
ortr(i) = ar(i,m-1) / scale
78
orti(i) = ai(i,m-1) / scale
79
h = h + ortr(i) * ortr(i) + orti(i) * orti(i)
83
f = sqrt(ortr(m)*ortr(m)+orti(m)*orti(m))
84
if (f .eq. 0.0d+0) go to 103
87
ortr(m) = (1.0d+0 + g) * ortr(m)
88
orti(m) = (1.0d+0 + g) * orti(m)
93
c :::::::::: form (i-(u*ut)/h) * a ::::::::::
97
c :::::::::: for i=igh step -1 until m do -- ::::::::::
100
fr = fr + ortr(i) * ar(i,j) + orti(i) * ai(i,j)
101
fi = fi + ortr(i) * ai(i,j) - orti(i) * ar(i,j)
108
ar(i,j) = ar(i,j) - fr * ortr(i) + fi * orti(i)
109
ai(i,j) = ai(i,j) - fr * orti(i) - fi * ortr(i)
113
c :::::::::: form (i-(u*ut)/h)*a*(i-(u*ut)/h) ::::::::::
117
c :::::::::: for j=igh step -1 until m do -- ::::::::::
120
fr = fr + ortr(j) * ar(i,j) - orti(j) * ai(i,j)
121
fi = fi + ortr(j) * ai(i,j) + orti(j) * ar(i,j)
128
ar(i,j) = ar(i,j) - fr * ortr(j) - fi * orti(j)
129
ai(i,j) = ai(i,j) + fr * orti(j) - fi * ortr(j)
134
ortr(m) = scale * ortr(m)
135
orti(m) = scale * orti(m)
136
ar(m,m-1) = -g * ar(m,m-1)
137
ai(m,m-1) = -g * ai(m,m-1)
141
c :::::::::: last card of corth ::::::::::