30 SUBROUTINE smexp (M, A, LDA, EA, LDE, R, IR, NR, NI, NQ, J,
31 1 issymm, work, lwork)
37 REAL a(lda*m), ea(lde*m)
38 INTEGER nr, ni, nq, j, lwork
40 REAL r(nr), work(lwork)
43 INTEGER i, iq, nqc, nb, info, nnr
44 INTEGER mm, mm1, mm12, mm13, mm14, mnb, mw
45 REAL zero /0./, one /1./, two /2./
46 DOUBLE PRECISION dtwo /2.d0/
51 INTEGER floor, ceiling
68 nqc = floor(dfloat(nq) / dtwo) + 1
70 nnr = floor(dfloat(nqc - 1) /
71 1 dfloat(ceiling(dsqrt(dfloat(nqc - 1)))))
72 nb = (2 * nnr + 2) * mm
81 c = c * float(nq - iq + 1) / float((2 * nq - iq + 1) * iq)
93 CALL
scopym(m, m, a, lda, ea, lde)
96 CALL
sscalm(m, m, tj, ea, lde)
99 CALL
scopym(m, m, ea, lde, r(mm1), m)
100 CALL sgemm(trans, trans, m, m, m, one, r(mm1), m,
101 1 ea, lde, zero, r, m)
102 CALL sscal(mm, zero, r(mm1), 1)
105 CALL
spoly2(m, r, nqc, r(mm14), r(mm14 + nqc), r(mm1), r(mm12),
106 1 r(mnb), r(mnb + (nnr + 2) * mm))
107 CALL
scopym(m, m, r(mm1), m, ea, lde)
108 CALL sgemm(trans, trans, m, m, m, tj,
109 1 a, lda, r(mm12), m, one, ea, lde)
110 CALL sgemm(trans, trans, m, m, m, -tj,
111 1 a, lda, r(mm12), m, one, r(mm1), m)
112 CALL scopy(mm, r(mm1), 1, r(mm13), 1)
113 CALL
scopym(m, m, ea, lde, r(mm12), m)
116 CALL ssytrf(uplo, m, r(mm1), m, ir, work, lwork, info)
117 CALL scopy(mm, r(mm1), 1, r, 1)
118 CALL ssytrs(uplo, m, m, r(mm1), m, ir, ea, lde, info)
119 CALL ssyrfs(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 sgetrf(m, m, r(mm1), m, ir, info)
124 CALL scopy(mm, r(mm1), 1, r, 1)
126 CALL sgetrs(trans, m, m, r(mm1), m, ir, ea, lde, info)
127 CALL sgerfs(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
scopym(m, m, ea, lde, r, m)
134 CALL
scopym(m, m, ea, lde, r(mm1), m)
135 CALL sgemm(trans, trans, m, m, m, one,
136 1 r, m, r(mm1), m, zero, ea, lde)
154 SUBROUTINE smexpc (M, A, LDA, TOL, NR, NI, NQ, J)
160 INTEGER nr, ni, nq, j
164 DOUBLE PRECISION dtwo /2.d0/
165 DOUBLE PRECISION dtwol /0.69314718055994530941723212145818d0/
168 INTEGER floor, ceiling
174 anrm =
sinfnm(m, m, a, lda)
176 eq = 0.16666666666666666666666666666667
179 IF (tmp *
exp(tmp) .LT. tol .AND. nq .GT. 1) goto 15
181 eq = eq / float(16 * (4 * nq * nq - 1))
187 IF (anrm .GT. tiny(one))
THEN
188 j = 1 + ceiling(dlog(dble(anrm)) / dtwol)
191 nqc = floor(dfloat(nq) / dtwo) + 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 spoly2 (M, A, N, V1, V2, P1, P2, B, B2)
203 REAL a(m*m), v1(n), v2(n), p1(m*m), p2(m*m)
205 INTEGER i, k, ns, nr, nqsr, mm, nrm
206 REAL q, one /1./, zero /0./
207 CHARACTER trans /
'N'/
208 INTEGER floor, ceiling
211 DO 10 i = 1, mm, m + 1
217 ns = ceiling(dsqrt(dble(q)))
218 nr = floor(dble(q) / dfloat(ns))
219 nqsr = n - 1 - ns * nr
220 nrm = (nr + 1) * mm + 1
222 CALL scopy(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 saxpy(mm, v1(i + 1), b, 1, p1, 1)
233 CALL saxpy(mm, v2(i + 1), b, 1, p2, 1)
236 CALL saxpy(mm, v1(ns * k + i + 1), b, 1,
238 CALL saxpy(mm, v2(ns * k + i + 1), b, 1,
239 1 b2((k - 1) * mm + 1), 1)
242 IF (i .LE. nqsr)
THEN
243 CALL saxpy(mm, v1(ns * nr + i + 1), b, 1,
245 CALL saxpy(mm, v2(ns * nr + i + 1), b, 1,
246 1 b2((nr - 1) * mm + 1), 1)
249 CALL scopy(mm, b, 1, b(nrm), 1)
250 CALL sgemm(trans, trans, m, m, m, one, b(nrm), m, a, m,
254 CALL sgemm(trans, trans, m, m, m, one, b(mm + 1), m,
256 CALL sgemm(trans, trans, m, m, m, one, b2, m,
259 IF (nr .GT. 1) CALL scopy(mm, b, 1, b(nrm), 1)
262 CALL scopy(mm, b, 1, b(mm + 1), 1)
263 CALL sgemm(trans, trans, m, m, m, one, b(mm + 1), m,
264 1 b(nrm), m, zero, b, m)
265 CALL sgemm(trans, trans, m, m, m, one,
266 1 b(k * mm + 1), m, b, m, one, p1, m)
267 CALL sgemm(trans, trans, m, m, m, one,
268 1 b2((k - 1) * mm + 1), m, b, m, one, p2, m)