LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlatdf.f
Go to the documentation of this file.
1*> \brief \b DLATDF uses the LU factorization of the n-by-n matrix computed by sgetc2 and computes a contribution to the reciprocal Dif-estimate.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DLATDF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlatdf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlatdf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlatdf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DLATDF( IJOB, N, Z, LDZ, RHS, RDSUM, RDSCAL, IPIV,
20* JPIV )
21*
22* .. Scalar Arguments ..
23* INTEGER IJOB, LDZ, N
24* DOUBLE PRECISION RDSCAL, RDSUM
25* ..
26* .. Array Arguments ..
27* INTEGER IPIV( * ), JPIV( * )
28* DOUBLE PRECISION RHS( * ), Z( LDZ, * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> DLATDF uses the LU factorization of the n-by-n matrix Z computed by
38*> DGETC2 and computes a contribution to the reciprocal Dif-estimate
39*> by solving Z * x = b for x, and choosing the r.h.s. b such that
40*> the norm of x is as large as possible. On entry RHS = b holds the
41*> contribution from earlier solved sub-systems, and on return RHS = x.
42*>
43*> The factorization of Z returned by DGETC2 has the form Z = P*L*U*Q,
44*> where P and Q are permutation matrices. L is lower triangular with
45*> unit diagonal elements and U is upper triangular.
46*> \endverbatim
47*
48* Arguments:
49* ==========
50*
51*> \param[in] IJOB
52*> \verbatim
53*> IJOB is INTEGER
54*> IJOB = 2: First compute an approximative null-vector e
55*> of Z using DGECON, e is normalized and solve for
56*> Zx = +-e - f with the sign giving the greater value
57*> of 2-norm(x). About 5 times as expensive as Default.
58*> IJOB .ne. 2: Local look ahead strategy where all entries of
59*> the r.h.s. b is chosen as either +1 or -1 (Default).
60*> \endverbatim
61*>
62*> \param[in] N
63*> \verbatim
64*> N is INTEGER
65*> The number of columns of the matrix Z.
66*> \endverbatim
67*>
68*> \param[in] Z
69*> \verbatim
70*> Z is DOUBLE PRECISION array, dimension (LDZ, N)
71*> On entry, the LU part of the factorization of the n-by-n
72*> matrix Z computed by DGETC2: Z = P * L * U * Q
73*> \endverbatim
74*>
75*> \param[in] LDZ
76*> \verbatim
77*> LDZ is INTEGER
78*> The leading dimension of the array Z. LDA >= max(1, N).
79*> \endverbatim
80*>
81*> \param[in,out] RHS
82*> \verbatim
83*> RHS is DOUBLE PRECISION array, dimension (N)
84*> On entry, RHS contains contributions from other subsystems.
85*> On exit, RHS contains the solution of the subsystem with
86*> entries according to the value of IJOB (see above).
87*> \endverbatim
88*>
89*> \param[in,out] RDSUM
90*> \verbatim
91*> RDSUM is DOUBLE PRECISION
92*> On entry, the sum of squares of computed contributions to
93*> the Dif-estimate under computation by DTGSYL, where the
94*> scaling factor RDSCAL (see below) has been factored out.
95*> On exit, the corresponding sum of squares updated with the
96*> contributions from the current sub-system.
97*> If TRANS = 'T' RDSUM is not touched.
98*> NOTE: RDSUM only makes sense when DTGSY2 is called by STGSYL.
99*> \endverbatim
100*>
101*> \param[in,out] RDSCAL
102*> \verbatim
103*> RDSCAL is DOUBLE PRECISION
104*> On entry, scaling factor used to prevent overflow in RDSUM.
105*> On exit, RDSCAL is updated w.r.t. the current contributions
106*> in RDSUM.
107*> If TRANS = 'T', RDSCAL is not touched.
108*> NOTE: RDSCAL only makes sense when DTGSY2 is called by
109*> DTGSYL.
110*> \endverbatim
111*>
112*> \param[in] IPIV
113*> \verbatim
114*> IPIV is INTEGER array, dimension (N).
115*> The pivot indices; for 1 <= i <= N, row i of the
116*> matrix has been interchanged with row IPIV(i).
117*> \endverbatim
118*>
119*> \param[in] JPIV
120*> \verbatim
121*> JPIV is INTEGER array, dimension (N).
122*> The pivot indices; for 1 <= j <= N, column j of the
123*> matrix has been interchanged with column JPIV(j).
124*> \endverbatim
125*
126* Authors:
127* ========
128*
129*> \author Univ. of Tennessee
130*> \author Univ. of California Berkeley
131*> \author Univ. of Colorado Denver
132*> \author NAG Ltd.
133*
134*> \ingroup latdf
135*
136*> \par Further Details:
137* =====================
138*>
139*> This routine is a further developed implementation of algorithm
140*> BSOLVE in [1] using complete pivoting in the LU factorization.
141*
142*> \par Contributors:
143* ==================
144*>
145*> Bo Kagstrom and Peter Poromaa, Department of Computing Science,
146*> Umea University, S-901 87 Umea, Sweden.
147*
148*> \par References:
149* ================
150*>
151*> \verbatim
152*>
153*>
154*> [1] Bo Kagstrom and Lars Westin,
155*> Generalized Schur Methods with Condition Estimators for
156*> Solving the Generalized Sylvester Equation, IEEE Transactions
157*> on Automatic Control, Vol. 34, No. 7, July 1989, pp 745-751.
158*>
159*> [2] Peter Poromaa,
160*> On Efficient and Robust Estimators for the Separation
161*> between two Regular Matrix Pairs with Applications in
162*> Condition Estimation. Report IMINF-95.05, Departement of
163*> Computing Science, Umea University, S-901 87 Umea, Sweden, 1995.
164*> \endverbatim
165*>
166* =====================================================================
167 SUBROUTINE dlatdf( IJOB, N, Z, LDZ, RHS, RDSUM, RDSCAL, IPIV,
168 $ JPIV )
169*
170* -- LAPACK auxiliary routine --
171* -- LAPACK is a software package provided by Univ. of Tennessee, --
172* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
173*
174* .. Scalar Arguments ..
175 INTEGER IJOB, LDZ, N
176 DOUBLE PRECISION RDSCAL, RDSUM
177* ..
178* .. Array Arguments ..
179 INTEGER IPIV( * ), JPIV( * )
180 DOUBLE PRECISION RHS( * ), Z( LDZ, * )
181* ..
182*
183* =====================================================================
184*
185* .. Parameters ..
186 INTEGER MAXDIM
187 parameter( maxdim = 8 )
188 DOUBLE PRECISION ZERO, ONE
189 parameter( zero = 0.0d+0, one = 1.0d+0 )
190* ..
191* .. Local Scalars ..
192 INTEGER I, INFO, J, K
193 DOUBLE PRECISION BM, BP, PMONE, SMINU, SPLUS, TEMP
194* ..
195* .. Local Arrays ..
196 INTEGER IWORK( MAXDIM )
197 DOUBLE PRECISION WORK( 4*MAXDIM ), XM( MAXDIM ), XP( MAXDIM )
198* ..
199* .. External Subroutines ..
200 EXTERNAL daxpy, dcopy, dgecon, dgesc2, dlassq,
201 $ dlaswp,
202 $ dscal
203* ..
204* .. External Functions ..
205 DOUBLE PRECISION DASUM, DDOT
206 EXTERNAL dasum, ddot
207* ..
208* .. Intrinsic Functions ..
209 INTRINSIC abs, sqrt
210* ..
211* .. Executable Statements ..
212*
213 IF( ijob.NE.2 ) THEN
214*
215* Apply permutations IPIV to RHS
216*
217 CALL dlaswp( 1, rhs, ldz, 1, n-1, ipiv, 1 )
218*
219* Solve for L-part choosing RHS either to +1 or -1.
220*
221 pmone = -one
222*
223 DO 10 j = 1, n - 1
224 bp = rhs( j ) + one
225 bm = rhs( j ) - one
226 splus = one
227*
228* Look-ahead for L-part RHS(1:N-1) = + or -1, SPLUS and
229* SMIN computed more efficiently than in BSOLVE [1].
230*
231 splus = splus + ddot( n-j, z( j+1, j ), 1, z( j+1, j ),
232 $ 1 )
233 sminu = ddot( n-j, z( j+1, j ), 1, rhs( j+1 ), 1 )
234 splus = splus*rhs( j )
235 IF( splus.GT.sminu ) THEN
236 rhs( j ) = bp
237 ELSE IF( sminu.GT.splus ) THEN
238 rhs( j ) = bm
239 ELSE
240*
241* In this case the updating sums are equal and we can
242* choose RHS(J) +1 or -1. The first time this happens
243* we choose -1, thereafter +1. This is a simple way to
244* get good estimates of matrices like Byers well-known
245* example (see [1]). (Not done in BSOLVE.)
246*
247 rhs( j ) = rhs( j ) + pmone
248 pmone = one
249 END IF
250*
251* Compute the remaining r.h.s.
252*
253 temp = -rhs( j )
254 CALL daxpy( n-j, temp, z( j+1, j ), 1, rhs( j+1 ), 1 )
255*
256 10 CONTINUE
257*
258* Solve for U-part, look-ahead for RHS(N) = +-1. This is not done
259* in BSOLVE and will hopefully give us a better estimate because
260* any ill-conditioning of the original matrix is transferred to U
261* and not to L. U(N, N) is an approximation to sigma_min(LU).
262*
263 CALL dcopy( n-1, rhs, 1, xp, 1 )
264 xp( n ) = rhs( n ) + one
265 rhs( n ) = rhs( n ) - one
266 splus = zero
267 sminu = zero
268 DO 30 i = n, 1, -1
269 temp = one / z( i, i )
270 xp( i ) = xp( i )*temp
271 rhs( i ) = rhs( i )*temp
272 DO 20 k = i + 1, n
273 xp( i ) = xp( i ) - xp( k )*( z( i, k )*temp )
274 rhs( i ) = rhs( i ) - rhs( k )*( z( i, k )*temp )
275 20 CONTINUE
276 splus = splus + abs( xp( i ) )
277 sminu = sminu + abs( rhs( i ) )
278 30 CONTINUE
279 IF( splus.GT.sminu )
280 $ CALL dcopy( n, xp, 1, rhs, 1 )
281*
282* Apply the permutations JPIV to the computed solution (RHS)
283*
284 CALL dlaswp( 1, rhs, ldz, 1, n-1, jpiv, -1 )
285*
286* Compute the sum of squares
287*
288 CALL dlassq( n, rhs, 1, rdscal, rdsum )
289*
290 ELSE
291*
292* IJOB = 2, Compute approximate nullvector XM of Z
293*
294 CALL dgecon( 'I', n, z, ldz, one, temp, work, iwork, info )
295 CALL dcopy( n, work( n+1 ), 1, xm, 1 )
296*
297* Compute RHS
298*
299 CALL dlaswp( 1, xm, ldz, 1, n-1, ipiv, -1 )
300 temp = one / sqrt( ddot( n, xm, 1, xm, 1 ) )
301 CALL dscal( n, temp, xm, 1 )
302 CALL dcopy( n, xm, 1, xp, 1 )
303 CALL daxpy( n, one, rhs, 1, xp, 1 )
304 CALL daxpy( n, -one, xm, 1, rhs, 1 )
305 CALL dgesc2( n, z, ldz, rhs, ipiv, jpiv, temp )
306 CALL dgesc2( n, z, ldz, xp, ipiv, jpiv, temp )
307 IF( dasum( n, xp, 1 ).GT.dasum( n, rhs, 1 ) )
308 $ CALL dcopy( n, xp, 1, rhs, 1 )
309*
310* Compute the sum of squares
311*
312 CALL dlassq( n, rhs, 1, rdscal, rdsum )
313*
314 END IF
315*
316 RETURN
317*
318* End of DLATDF
319*
320 END
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
Definition daxpy.f:89
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dgecon(norm, n, a, lda, anorm, rcond, work, iwork, info)
DGECON
Definition dgecon.f:130
subroutine dgesc2(n, a, lda, rhs, ipiv, jpiv, scale)
DGESC2 solves a system of linear equations using the LU factorization with complete pivoting computed...
Definition dgesc2.f:112
subroutine dlassq(n, x, incx, scale, sumsq)
DLASSQ updates a sum of squares represented in scaled form.
Definition dlassq.f90:122
subroutine dlaswp(n, a, lda, k1, k2, ipiv, incx)
DLASWP performs a series of row interchanges on a general rectangular matrix.
Definition dlaswp.f:113
subroutine dlatdf(ijob, n, z, ldz, rhs, rdsum, rdscal, ipiv, jpiv)
DLATDF uses the LU factorization of the n-by-n matrix computed by sgetc2 and computes a contribution ...
Definition dlatdf.f:169
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79