29 SUBROUTINE zmexp (M, A, LDA, EA, LDE, R, IR, NR, NI, NQ, J,
36 DOUBLE COMPLEX a(lda*m), ea(lde*m)
37 INTEGER nr, ni, nq, j, lwork
39 DOUBLE COMPLEX r(nr), work(lwork)
42 INTEGER i, iq, nqc, nb, info, nnr
43 INTEGER mm, mm1, mm12, mm13, mm14, mnb, mw
44 DOUBLE PRECISION two /2.d0/
45 DOUBLE COMPLEX czero /(0.d0, 0.d0)/, cone /(1.d0, 0.d0)/
51 INTEGER floor, ceiling
70 nqc = floor(dfloat(nq) / two) + 1
72 nnr = floor(dfloat(nqc - 1) /
73 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
74 nb = (2 * nnr + 2) * mm
80 r(mm14 + nqc) = dcmplx(c)
82 c = c * dfloat(nq - iq + 1) / dfloat((2 * nq - iq + 1) * iq)
85 r(mm14 + i) = dcmplx(c)
87 r(mm14 + nqc + i) = dcmplx(c)
94 CALL
zcopym(m, m, a, lda, ea, lde)
96 tj = dcmplx(two ** dfloat(-j))
97 CALL
zscalm(m, m, tj, ea, lde)
100 CALL
zcopym(m, m, ea, lde, r(mm1), m)
101 CALL zgemm(trans, trans, m, m, m, cone, r(mm1), m,
102 1 ea, lde, czero, r, m)
103 CALL zscal(mm, czero, r(mm1), 1)
106 CALL
zpoly2(m, r, nqc, r(mm14), r(mm14 + nqc), r(mm1), r(mm12),
107 1 r(mnb), r(mnb + (nnr + 2) * mm))
108 CALL
zcopym(m, m, r(mm1), m, ea, lde)
109 CALL zgemm(trans, trans, m, m, m, tj,
110 1 a, m, r(mm12), m, cone, ea, lde)
111 CALL zgemm(trans, trans, m, m, m, -tj,
112 1 a, m, r(mm12), m, cone, r(mm1), m)
113 CALL zcopy(mm, r(mm1), 1, r(mm13), 1)
114 CALL
zcopym(m, m, ea, lde, r(mm12), m)
117 CALL zhetrf(uplo, m, r(mm1), m, ir, work, lwork, info)
118 CALL zcopy(mm, r(mm1), 1, r, 1)
119 CALL zhetrs(uplo, m, m, r(mm1), m, ir, ea, lde, info)
120 CALL zherfs(uplo, m, m, r(mm13), m, r, m, ir,
121 1 r(mm12), m, ea, lde, r(mw), r(mw + m),
122 2 r(mw + 2*m), work, info)
124 CALL zgetrf(m, m, r(mm1), m, ir, info)
125 CALL zcopy(mm, r(mm1), 1, r, 1)
127 CALL zgetrs(trans, m, m, r(mm1), m, ir, ea, lde, info)
128 CALL zgerfs(trans, m, m, r(mm13), m, r, m, ir,
129 1 r(mm12), m, ea, lde, r(mw), r(mw + m), r(mw + 2*m),
135 CALL
zcopym(m, m, ea, lde, r, m)
136 CALL
zcopym(m, m, ea, lde, r(mm1), m)
137 CALL zgemm(trans, trans, m, m, m, cone,
138 1 r, m, r(mm1), m, czero, ea, lde)
156 SUBROUTINE zmexpc (M, A, LDA, TOL, NR, NI, NQ, J)
161 DOUBLE COMPLEX a(lda*m)
163 INTEGER nr, ni, nq, j
164 DOUBLE PRECISION anrm, tmp, eq
165 DOUBLE PRECISION one /1.d0/, two /2.d0/
166 DOUBLE PRECISION twol /0.69314718055994530941723212145818d0/
169 INTEGER floor, ceiling
170 DOUBLE PRECISION tiny
175 anrm =
zinfnm(m, m, a, lda)
177 eq = 0.16666666666666666666666666666667d0
180 IF (tmp * dexp(tmp) .LT. tol .AND. nq .GT. 1) goto 15
182 eq = eq / dfloat(16 * (4 * nq * nq - 1))
188 IF (anrm .GT. tiny(one))
THEN
189 j = 1 + ceiling(dlog(anrm) / twol)
192 nqc = floor(dfloat(nq) / two) + 1
193 nb = floor(dfloat(nqc - 1) /
194 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
195 nb = (2 * nb + 2) * mm
197 nr = 4 * mm + 2 * nqc + nb + 5 * m
202 SUBROUTINE zpoly2 (M, A, N, V1, V2, P1, P2, B, B2)
204 DOUBLE COMPLEX a(m*m), v1(n), v2(n), p1(m*m), p2(m*m), b(1), b2(1)
205 DOUBLE COMPLEX cone /(1.d0, 0.d0)/, czero /(0.d0, 0.d0)/
206 INTEGER i, k, ns, nr, nqsr, mm, nrm
208 CHARACTER trans /
'N'/
209 INTEGER floor, ceiling
212 DO 10 i = 1, mm, m + 1
218 ns = ceiling(dsqrt(q))
219 nr = floor(q / dfloat(ns))
220 nqsr = n - 1 - ns * nr
221 nrm = (nr + 1) * mm + 1
223 CALL zcopy(mm, a, 1, b, 1)
226 DO 30 i = 1, mm, m + 1
227 b(mm * k + i) = v1(ns * k + 1)
228 b2(mm * (k - 1) + i) = v2(ns * k + 1)
233 CALL zaxpy(mm, v1(i + 1), b, 1, p1, 1)
234 CALL zaxpy(mm, v2(i + 1), b, 1, p2, 1)
237 CALL zaxpy(mm, v1(ns * k + i + 1), b, 1,
239 CALL zaxpy(mm, v2(ns * k + i + 1), b, 1,
240 1 b2((k - 1) * mm + 1), 1)
243 IF (i .LE. nqsr)
THEN
244 CALL zaxpy(mm, v1(ns * nr + i + 1), b, 1,
246 CALL zaxpy(mm, v2(ns * nr + i + 1), b, 1,
247 1 b2((nr - 1) * mm + 1), 1)
250 CALL zcopy(mm, b, 1, b(nrm), 1)
251 CALL zgemm(trans, trans, m, m, m, cone, b(nrm), m, a, m,
255 CALL zgemm(trans, trans, m, m, m, cone, b(mm + 1), m,
257 CALL zgemm(trans, trans, m, m, m, cone, b2, m,
260 IF (nr .GT. 1) CALL zcopy(mm, b, 1, b(nrm), 1)
263 CALL zcopy(mm, b, 1, b(mm + 1), 1)
264 CALL zgemm(trans, trans, m, m, m, cone, b(mm + 1), m,
265 1 b(nrm), m, czero, b, m)
266 CALL zgemm(trans, trans, m, m, m, cone,
267 1 b(k * mm + 1), m, b, m, cone, p1, m)
268 CALL zgemm(trans, trans, m, m, m, cone,
269 1 b2((k - 1) * mm + 1), m, b, m, cone, p2, m)