30 SUBROUTINE dmexp (M, A, LDA, EA, LDE, R, IR, NR, NI, NQ, J,
31 1 issymm, work, lwork)
37 DOUBLE PRECISION a(lda*m), ea(lde*m)
38 INTEGER nr, ni, nq, j, lwork
40 DOUBLE PRECISION r(nr), work(lwork)
43 INTEGER i, iq, nqc, nb, info, nnr
44 INTEGER mm, mm1, mm12, mm13, mm14, mnb, mw
45 DOUBLE PRECISION zero /0.d0/, one /1.d0/, two /2.d0/
46 DOUBLE PRECISION tj, c
50 INTEGER floor, ceiling
69 nqc = floor(dfloat(nq) / two) + 1
71 nnr = floor(dfloat(nqc - 1) /
72 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
73 nb = (2 * nnr + 2) * mm
81 c = c * dfloat(nq - iq + 1) / dfloat((2 * nq - iq + 1) * iq)
93 CALL
dcopym(m, m, a, lda, ea, lde)
95 tj = two ** dfloat(-j)
96 CALL
dscalm(m, m, tj, ea, lde)
99 CALL
dcopym(m, m, ea, lde, r(mm1), m)
100 CALL dgemm(trans, trans, m, m, m, one, r(mm1), m,
101 1 ea, lde, zero, r, m)
102 CALL dscal(mm, zero, r(mm1), 1)
105 CALL
dpoly2(m, r, nqc, r(mm14), r(mm14 + nqc), r(mm1), r(mm12),
106 1 r(mnb), r(mnb + (nnr + 2) * mm))
107 CALL
dcopym(m, m, r(mm1), m, ea, lde)
108 CALL dgemm(trans, trans, m, m, m, tj,
109 1 a, lda, r(mm12), m, one, ea, lde)
110 CALL dgemm(trans, trans, m, m, m, -tj,
111 1 a, lda, r(mm12), m, one, r(mm1), m)
112 CALL dcopy(mm, r(mm1), 1, r(mm13), 1)
113 CALL
dcopym(m, m, ea, lde, r(mm12), m)
116 CALL dsytrf(uplo, m, r(mm1), m, ir, work, lwork, info)
117 CALL dcopy(mm, r(mm1), 1, r, 1)
118 CALL dsytrs(uplo, m, m, r(mm1), m, ir, ea, lde, info)
119 CALL dsyrfs(uplo, m, m, r(mm13), m, r, m, ir,
120 1 r(mm12), m, ea, lde, r(mw), r(mw + m),
121 2 r(mw + 2*m), ir(m + 1), info)
123 CALL dgetrf(m, m, r(mm1), m, ir, info)
124 CALL dcopy(mm, r(mm1), 1, r, 1)
126 CALL dgetrs(trans, m, m, r(mm1), m, ir, ea, lde, info)
127 CALL dgerfs(trans, m, m, r(mm13), m, r, m, ir,
128 1 r(mm12), m, ea, lde, r(mw), r(mw + m),
129 2 r(mw + 2*m), ir(m + 1), info)
133 CALL
dcopym(m, m, ea, lde, r, m)
134 CALL
dcopym(m, m, ea, lde, r(mm1), m)
135 CALL dgemm(trans, trans, m, m, m, one,
136 1 r, m, r(mm1), m, zero, ea, lde)
155 SUBROUTINE dmexpc (M, A, LDA, TOL, NR, NI, NQ, J)
160 DOUBLE PRECISION a(lda*m), tol
161 INTEGER nr, ni, nq, j
163 DOUBLE PRECISION anrm, tmp, eq
164 DOUBLE PRECISION one /1.d0/, two /2.d0/
165 DOUBLE PRECISION twol /0.69314718055994530941723212145818d0/
168 INTEGER floor, ceiling
169 DOUBLE PRECISION tiny
174 anrm =
dinfnm(m, m, a, lda)
176 eq = 0.16666666666666666666666666666667d0
179 IF (tmp * dexp(tmp) .LT. tol .AND. nq .GT. 1) goto 15
181 eq = eq / dfloat(16 * (4 * nq * nq - 1))
187 IF (anrm .GT. tiny(one))
THEN
188 j = 1 + ceiling(dlog(anrm) / twol)
191 nqc = floor(dfloat(nq) / two) + 1
192 nb = floor(dfloat(nqc - 1) /
193 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
194 nb = (2 * nb + 2) * mm
196 nr = 4 * mm + 2 * nqc + nb + 5 * m
201 SUBROUTINE dpoly2 (M, A, N, V1, V2, P1, P2, B, B2)
203 DOUBLE PRECISION a(m*m), v1(n), v2(n), p1(m*m), p2(m*m)
204 DOUBLE PRECISION b(1), b2(1)
205 INTEGER i, k, ns, nr, nqsr, mm, nrm
206 DOUBLE PRECISION q, one /1.d0/, zero /0.d0/
207 CHARACTER trans /
'N'/
208 INTEGER floor, ceiling
211 DO 10 i = 1, mm, m + 1
217 ns = ceiling(dsqrt(q))
218 nr = floor(q / dfloat(ns))
219 nqsr = n - 1 - ns * nr
220 nrm = (nr + 1) * mm + 1
222 CALL dcopy(mm, a, 1, b, 1)
225 DO 30 i = 1, mm, m + 1
226 b(mm * k + i) = v1(ns * k + 1)
227 b2(mm * (k - 1) + i) = v2(ns * k + 1)
232 CALL daxpy(mm, v1(i + 1), b, 1, p1, 1)
233 CALL daxpy(mm, v2(i + 1), b, 1, p2, 1)
236 CALL daxpy(mm, v1(ns * k + i + 1), b, 1,
238 CALL daxpy(mm, v2(ns * k + i + 1), b, 1,
239 1 b2((k - 1) * mm + 1), 1)
242 IF (i .LE. nqsr)
THEN
243 CALL daxpy(mm, v1(ns * nr + i + 1), b, 1,
245 CALL daxpy(mm, v2(ns * nr + i + 1), b, 1,
246 1 b2((nr - 1) * mm + 1), 1)
249 CALL dcopy(mm, b, 1, b(nrm), 1)
250 CALL dgemm(trans, trans, m, m, m, one, b(nrm), m, a, m,
254 CALL dgemm(trans, trans, m, m, m, one, b(mm + 1), m,
256 CALL dgemm(trans, trans, m, m, m, one, b2, m,
259 IF (nr .GT. 1) CALL dcopy(mm, b, 1, b(nrm), 1)
262 CALL dcopy(mm, b, 1, b(mm + 1), 1)
263 CALL dgemm(trans, trans, m, m, m, one, b(mm + 1), m,
264 1 b(nrm), m, zero, b, m)
265 CALL dgemm(trans, trans, m, m, m, one,
266 1 b(k * mm + 1), m, b, m, one, p1, m)
267 CALL dgemm(trans, trans, m, m, m, one,
268 1 b2((k - 1) * mm + 1), m, b, m, one, p2, m)