annotate libcruft/lapack/dlasd8.f @ 7072:b48d486f641d

[project @ 2007-10-26 15:52:57 by jwe]
author jwe
date Fri, 26 Oct 2007 15:52:58 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7072
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
1 SUBROUTINE DLASD8( ICOMPQ, K, D, Z, VF, VL, DIFL, DIFR, LDDIFR,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
2 $ DSIGMA, WORK, INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
3 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
4 * -- LAPACK auxiliary routine (version 3.1) --
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
6 * November 2006
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
7 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
8 * .. Scalar Arguments ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
9 INTEGER ICOMPQ, INFO, K, LDDIFR
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
10 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
11 * .. Array Arguments ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
12 DOUBLE PRECISION D( * ), DIFL( * ), DIFR( LDDIFR, * ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
13 $ DSIGMA( * ), VF( * ), VL( * ), WORK( * ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
14 $ Z( * )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
15 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
16 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
17 * Purpose
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
18 * =======
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
19 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
20 * DLASD8 finds the square roots of the roots of the secular equation,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
21 * as defined by the values in DSIGMA and Z. It makes the appropriate
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
22 * calls to DLASD4, and stores, for each element in D, the distance
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
23 * to its two nearest poles (elements in DSIGMA). It also updates
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
24 * the arrays VF and VL, the first and last components of all the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
25 * right singular vectors of the original bidiagonal matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
26 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
27 * DLASD8 is called from DLASD6.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
28 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
29 * Arguments
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
30 * =========
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
31 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
32 * ICOMPQ (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
33 * Specifies whether singular vectors are to be computed in
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
34 * factored form in the calling routine:
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
35 * = 0: Compute singular values only.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
36 * = 1: Compute singular vectors in factored form as well.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
37 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
38 * K (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
39 * The number of terms in the rational function to be solved
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
40 * by DLASD4. K >= 1.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
41 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
42 * D (output) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
43 * On output, D contains the updated singular values.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
44 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
45 * Z (input) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
46 * The first K elements of this array contain the components
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
47 * of the deflation-adjusted updating row vector.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
48 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
49 * VF (input/output) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
50 * On entry, VF contains information passed through DBEDE8.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
51 * On exit, VF contains the first K components of the first
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
52 * components of all right singular vectors of the bidiagonal
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
53 * matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
54 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
55 * VL (input/output) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
56 * On entry, VL contains information passed through DBEDE8.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
57 * On exit, VL contains the first K components of the last
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
58 * components of all right singular vectors of the bidiagonal
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
59 * matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
60 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
61 * DIFL (output) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
62 * On exit, DIFL(I) = D(I) - DSIGMA(I).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
63 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
64 * DIFR (output) DOUBLE PRECISION array,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
65 * dimension ( LDDIFR, 2 ) if ICOMPQ = 1 and
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
66 * dimension ( K ) if ICOMPQ = 0.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
67 * On exit, DIFR(I,1) = D(I) - DSIGMA(I+1), DIFR(K,1) is not
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
68 * defined and will not be referenced.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
69 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
70 * If ICOMPQ = 1, DIFR(1:K,2) is an array containing the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
71 * normalizing factors for the right singular vector matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
72 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
73 * LDDIFR (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
74 * The leading dimension of DIFR, must be at least K.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
75 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
76 * DSIGMA (input) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
77 * The first K elements of this array contain the old roots
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
78 * of the deflated updating problem. These are the poles
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
79 * of the secular equation.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
80 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
81 * WORK (workspace) DOUBLE PRECISION array, dimension at least 3 * K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
82 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
83 * INFO (output) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
84 * = 0: successful exit.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
85 * < 0: if INFO = -i, the i-th argument had an illegal value.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
86 * > 0: if INFO = 1, an singular value did not converge
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
87 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
88 * Further Details
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
89 * ===============
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
90 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
91 * Based on contributions by
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
92 * Ming Gu and Huan Ren, Computer Science Division, University of
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
93 * California at Berkeley, USA
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
94 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
95 * =====================================================================
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
96 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
97 * .. Parameters ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
98 DOUBLE PRECISION ONE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
99 PARAMETER ( ONE = 1.0D+0 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
100 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
101 * .. Local Scalars ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
102 INTEGER I, IWK1, IWK2, IWK2I, IWK3, IWK3I, J
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
103 DOUBLE PRECISION DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, RHO, TEMP
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
104 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
105 * .. External Subroutines ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
106 EXTERNAL DCOPY, DLASCL, DLASD4, DLASET, XERBLA
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
107 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
108 * .. External Functions ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
109 DOUBLE PRECISION DDOT, DLAMC3, DNRM2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
110 EXTERNAL DDOT, DLAMC3, DNRM2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
111 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
112 * .. Intrinsic Functions ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
113 INTRINSIC ABS, SIGN, SQRT
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
114 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
115 * .. Executable Statements ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
116 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
117 * Test the input parameters.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
118 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
119 INFO = 0
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
120 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
121 IF( ( ICOMPQ.LT.0 ) .OR. ( ICOMPQ.GT.1 ) ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
122 INFO = -1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
123 ELSE IF( K.LT.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
124 INFO = -2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
125 ELSE IF( LDDIFR.LT.K ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
126 INFO = -9
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
127 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
128 IF( INFO.NE.0 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
129 CALL XERBLA( 'DLASD8', -INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
130 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
131 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
132 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
133 * Quick return if possible
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
134 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
135 IF( K.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
136 D( 1 ) = ABS( Z( 1 ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
137 DIFL( 1 ) = D( 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
138 IF( ICOMPQ.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
139 DIFL( 2 ) = ONE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
140 DIFR( 1, 2 ) = ONE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
141 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
142 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
143 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
144 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
145 * Modify values DSIGMA(i) to make sure all DSIGMA(i)-DSIGMA(j) can
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
146 * be computed with high relative accuracy (barring over/underflow).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
147 * This is a problem on machines without a guard digit in
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
148 * add/subtract (Cray XMP, Cray YMP, Cray C 90 and Cray 2).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
149 * The following code replaces DSIGMA(I) by 2*DSIGMA(I)-DSIGMA(I),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
150 * which on any of these machines zeros out the bottommost
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
151 * bit of DSIGMA(I) if it is 1; this makes the subsequent
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
152 * subtractions DSIGMA(I)-DSIGMA(J) unproblematic when cancellation
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
153 * occurs. On binary machines with a guard digit (almost all
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
154 * machines) it does not change DSIGMA(I) at all. On hexadecimal
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
155 * and decimal machines with a guard digit, it slightly
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
156 * changes the bottommost bits of DSIGMA(I). It does not account
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
157 * for hexadecimal or decimal machines without guard digits
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
158 * (we know of none). We use a subroutine call to compute
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
159 * 2*DSIGMA(I) to prevent optimizing compilers from eliminating
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
160 * this code.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
161 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
162 DO 10 I = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
163 DSIGMA( I ) = DLAMC3( DSIGMA( I ), DSIGMA( I ) ) - DSIGMA( I )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
164 10 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
165 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
166 * Book keeping.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
167 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
168 IWK1 = 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
169 IWK2 = IWK1 + K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
170 IWK3 = IWK2 + K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
171 IWK2I = IWK2 - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
172 IWK3I = IWK3 - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
173 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
174 * Normalize Z.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
175 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
176 RHO = DNRM2( K, Z, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
177 CALL DLASCL( 'G', 0, 0, RHO, ONE, K, 1, Z, K, INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
178 RHO = RHO*RHO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
179 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
180 * Initialize WORK(IWK3).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
181 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
182 CALL DLASET( 'A', K, 1, ONE, ONE, WORK( IWK3 ), K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
183 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
184 * Compute the updated singular values, the arrays DIFL, DIFR,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
185 * and the updated Z.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
186 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
187 DO 40 J = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
188 CALL DLASD4( K, J, DSIGMA, Z, WORK( IWK1 ), RHO, D( J ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
189 $ WORK( IWK2 ), INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
190 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
191 * If the root finder fails, the computation is terminated.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
192 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
193 IF( INFO.NE.0 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
194 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
195 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
196 WORK( IWK3I+J ) = WORK( IWK3I+J )*WORK( J )*WORK( IWK2I+J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
197 DIFL( J ) = -WORK( J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
198 DIFR( J, 1 ) = -WORK( J+1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
199 DO 20 I = 1, J - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
200 WORK( IWK3I+I ) = WORK( IWK3I+I )*WORK( I )*
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
201 $ WORK( IWK2I+I ) / ( DSIGMA( I )-
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
202 $ DSIGMA( J ) ) / ( DSIGMA( I )+
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
203 $ DSIGMA( J ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
204 20 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
205 DO 30 I = J + 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
206 WORK( IWK3I+I ) = WORK( IWK3I+I )*WORK( I )*
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
207 $ WORK( IWK2I+I ) / ( DSIGMA( I )-
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
208 $ DSIGMA( J ) ) / ( DSIGMA( I )+
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
209 $ DSIGMA( J ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
210 30 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
211 40 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
212 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
213 * Compute updated Z.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
214 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
215 DO 50 I = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
216 Z( I ) = SIGN( SQRT( ABS( WORK( IWK3I+I ) ) ), Z( I ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
217 50 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
218 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
219 * Update VF and VL.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
220 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
221 DO 80 J = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
222 DIFLJ = DIFL( J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
223 DJ = D( J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
224 DSIGJ = -DSIGMA( J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
225 IF( J.LT.K ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
226 DIFRJ = -DIFR( J, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
227 DSIGJP = -DSIGMA( J+1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
228 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
229 WORK( J ) = -Z( J ) / DIFLJ / ( DSIGMA( J )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
230 DO 60 I = 1, J - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
231 WORK( I ) = Z( I ) / ( DLAMC3( DSIGMA( I ), DSIGJ )-DIFLJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
232 $ / ( DSIGMA( I )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
233 60 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
234 DO 70 I = J + 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
235 WORK( I ) = Z( I ) / ( DLAMC3( DSIGMA( I ), DSIGJP )+DIFRJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
236 $ / ( DSIGMA( I )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
237 70 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
238 TEMP = DNRM2( K, WORK, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
239 WORK( IWK2I+J ) = DDOT( K, WORK, 1, VF, 1 ) / TEMP
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
240 WORK( IWK3I+J ) = DDOT( K, WORK, 1, VL, 1 ) / TEMP
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
241 IF( ICOMPQ.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
242 DIFR( J, 2 ) = TEMP
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
243 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
244 80 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
245 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
246 CALL DCOPY( K, WORK( IWK2 ), 1, VF, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
247 CALL DCOPY( K, WORK( IWK3 ), 1, VL, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
248 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
249 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
250 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
251 * End of DLASD8
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
252 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
253 END