29 SUBROUTINE cmexp (M, A, LDA, EA, LDE, R, IR, NR, NI, NQ, J,
36 COMPLEX a(lda*m), ea(lde*m)
37 INTEGER nr, ni, nq, j, lwork
39 COMPLEX r(nr), work(lwork)
42 INTEGER i, iq, nqc, nb, info, nnr
43 INTEGER mm, mm1, mm12, mm13, mm14, mnb, mw
45 DOUBLE PRECISION dtwo /2.d0/
46 COMPLEX czero /(0., 0.)/, cone /(1., 0.)/
52 INTEGER floor, ceiling
69 nqc = floor(dfloat(nq) / dtwo) + 1
71 nnr = floor(dfloat(nqc - 1) /
72 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
73 nb = (2 * nnr + 2) * mm
80 r(mm14 + nqc) = cmplx(c)
82 c = c * float(nq - iq + 1) / float((2 * nq - iq + 1) * iq)
85 r(mm14 + i) = cmplx(c)
87 r(mm14 + nqc + i) = cmplx(c)
94 CALL
ccopym(m, m, a, lda, ea, lde)
96 tj = cmplx(two ** float(-j))
97 CALL
cscalm(m, m, tj, ea, lde)
100 CALL
ccopym(m, m, ea, lde, r(mm1), m)
101 CALL cgemm(trans, trans, m, m, m, cone, r(mm1), m,
102 1 ea, lde, czero, r, m)
103 CALL cscal(mm, czero, r(mm1), 1)
106 CALL
cpoly2(m, r, nqc, r(mm14), r(mm14 + nqc), r(mm1), r(mm12),
107 1 r(mnb), r(mnb + (nnr + 2) * mm))
108 CALL
ccopym(m, m, r(mm1), m, ea, lde)
109 CALL cgemm(trans, trans, m, m, m, tj,
110 1 a, lda, r(mm12), m, cone, ea, lde)
111 CALL cgemm(trans, trans, m, m, m, -tj,
112 1 a, lda, r(mm12), m, cone, r(mm1), m)
113 CALL ccopy(mm, r(mm1), 1, r(mm13), 1)
114 CALL
ccopym(m, m, ea, lde, r(mm12), m)
117 CALL chetrf(uplo, m, r(mm1), m, ir, work, lwork, info)
118 CALL ccopy(mm, r(mm1), 1, r, 1)
119 CALL chetrs(uplo, m, m, r(mm1), m, ir, ea, lde, info)
120 CALL cherfs(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 cgetrf(m, m, r(mm1), m, ir, info)
125 CALL ccopy(mm, r(mm1), 1, r, 1)
127 CALL cgetrs(trans, m, m, r(mm1), m, ir, ea, lde, info)
128 CALL cgerfs(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),
134 CALL
ccopym(m, m, ea, lde, r, m)
135 CALL
ccopym(m, m, ea, lde, r(mm1), m)
136 CALL cgemm(trans, trans, m, m, m, cone,
137 1 r, m, r(mm1), m, czero, ea, lde)
156 SUBROUTINE cmexpc (M, A, LDA, TOL, NR, NI, NQ, J)
163 INTEGER nr, ni, nq, j
167 DOUBLE PRECISION dtwo /2.d0/
168 DOUBLE PRECISION dtwol /0.69314718055994530941723212145818d0/
171 INTEGER floor, ceiling
177 anrm =
cinfnm(m, m, a, lda)
179 eq = 0.16666666666666666666666666666667
182 IF (tmp *
exp(tmp) .LT. tol .AND. nq .GT. 1) goto 15
184 eq = eq / float(16 * (4 * nq * nq - 1))
190 IF (anrm .GT. tiny(one))
THEN
191 j = 1 + ceiling(dlog(dble(anrm)) / dtwol)
194 nqc = floor(dfloat(nq) / dtwo) + 1
195 nb = floor(dfloat(nqc - 1) /
196 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
197 nb = (2 * nb + 2) * mm
199 nr = 4 * mm + 2 * nqc + nb + 5 * m
205 SUBROUTINE cpoly2 (M, A, N, V1, V2, P1, P2, B, B2)
207 COMPLEX a(m*m), v1(n), v2(n), p1(m*m), p2(m*m), b(1), b2(1)
208 COMPLEX cone /(1., 0.)/, czero /(0., 0.)/
209 INTEGER i, k, ns, nr, nqsr, mm, nrm
211 CHARACTER trans /
'N'/
212 INTEGER floor, ceiling
215 DO 10 i = 1, mm, m + 1
221 ns = ceiling(dsqrt(dble(q)))
222 nr = floor(dble(q) / dfloat(ns))
223 nqsr = n - 1 - ns * nr
224 nrm = (nr + 1) * mm + 1
226 CALL ccopy(mm, a, 1, b, 1)
229 DO 30 i = 1, mm, m + 1
230 b(mm * k + i) = v1(ns * k + 1)
231 b2(mm * (k - 1) + i) = v2(ns * k + 1)
236 CALL caxpy(mm, v1(i + 1), b, 1, p1, 1)
237 CALL caxpy(mm, v2(i + 1), b, 1, p2, 1)
240 CALL caxpy(mm, v1(ns * k + i + 1), b, 1,
242 CALL caxpy(mm, v2(ns * k + i + 1), b, 1,
243 1 b2((k - 1) * mm + 1), 1)
246 IF (i .LE. nqsr)
THEN
247 CALL caxpy(mm, v1(ns * nr + i + 1), b, 1,
249 CALL caxpy(mm, v2(ns * nr + i + 1), b, 1,
250 1 b2((nr - 1) * mm + 1), 1)
253 CALL ccopy(mm, b, 1, b(nrm), 1)
254 CALL cgemm(trans, trans, m, m, m, cone, b(nrm), m, a, m,
258 CALL cgemm(trans, trans, m, m, m, cone, b(mm + 1), m,
260 CALL cgemm(trans, trans, m, m, m, cone, b2, m,
263 IF (nr .GT. 1) CALL ccopy(mm, b, 1, b(nrm), 1)
266 CALL ccopy(mm, b, 1, b(mm + 1), 1)
267 CALL cgemm(trans, trans, m, m, m, cone, b(mm + 1), m,
268 1 b(nrm), m, czero, b, m)
269 CALL cgemm(trans, trans, m, m, m, cone,
270 1 b(k * mm + 1), m, b, m, cone, p1, m)
271 CALL cgemm(trans, trans, m, m, m, cone,
272 1 b2((k - 1) * mm + 1), m, b, m, cone, p2, m)