annotate libcruft/lapack/dlals0.f @ 8203:a9da991c77aa

update contrib.txi
author John W. Eaton <jwe@octave.org>
date Wed, 08 Oct 2008 14:29:51 -0400
parents b48d486f641d
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 DLALS0( ICOMPQ, NL, NR, SQRE, NRHS, B, LDB, BX, LDBX,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
2 $ PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
3 $ POLES, DIFL, DIFR, Z, K, C, S, WORK, INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
4 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
5 * -- LAPACK routine (version 3.1) --
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
6 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
7 * November 2006
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
8 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
9 * .. Scalar Arguments ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
10 INTEGER GIVPTR, ICOMPQ, INFO, K, LDB, LDBX, LDGCOL,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
11 $ LDGNUM, NL, NR, NRHS, SQRE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
12 DOUBLE PRECISION C, S
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
13 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
14 * .. Array Arguments ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
15 INTEGER GIVCOL( LDGCOL, * ), PERM( * )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
16 DOUBLE PRECISION B( LDB, * ), BX( LDBX, * ), DIFL( * ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
17 $ DIFR( LDGNUM, * ), GIVNUM( LDGNUM, * ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
18 $ POLES( LDGNUM, * ), WORK( * ), Z( * )
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 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
21 * Purpose
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
22 * =======
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
23 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
24 * DLALS0 applies back the multiplying factors of either the left or the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
25 * right singular vector matrix of a diagonal matrix appended by a row
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
26 * to the right hand side matrix B in solving the least squares problem
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
27 * using the divide-and-conquer SVD approach.
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 * For the left singular vector matrix, three types of orthogonal
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
30 * matrices are involved:
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 * (1L) Givens rotations: the number of such rotations is GIVPTR; the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
33 * pairs of columns/rows they were applied to are stored in GIVCOL;
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
34 * and the C- and S-values of these rotations are stored in GIVNUM.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
35 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
36 * (2L) Permutation. The (NL+1)-st row of B is to be moved to the first
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
37 * row, and for J=2:N, PERM(J)-th row of B is to be moved to the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
38 * J-th row.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
39 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
40 * (3L) The left singular vector matrix of the remaining matrix.
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 * For the right singular vector matrix, four types of orthogonal
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
43 * matrices are involved:
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 * (1R) The right singular vector matrix of the remaining matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
46 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
47 * (2R) If SQRE = 1, one extra Givens rotation to generate the right
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
48 * null space.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
49 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
50 * (3R) The inverse transformation of (2L).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
51 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
52 * (4R) The inverse transformation of (1L).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
53 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
54 * Arguments
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
55 * =========
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
56 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
57 * ICOMPQ (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
58 * Specifies whether singular vectors are to be computed in
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
59 * factored form:
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
60 * = 0: Left singular vector matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
61 * = 1: Right singular vector matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
62 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
63 * NL (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
64 * The row dimension of the upper block. NL >= 1.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
65 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
66 * NR (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
67 * The row dimension of the lower block. NR >= 1.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
68 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
69 * SQRE (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
70 * = 0: the lower block is an NR-by-NR square matrix.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
71 * = 1: the lower block is an NR-by-(NR+1) rectangular 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 * The bidiagonal matrix has row dimension N = NL + NR + 1,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
74 * and column dimension M = N + SQRE.
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 * NRHS (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
77 * The number of columns of B and BX. NRHS must be at least 1.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
78 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
79 * B (input/output) DOUBLE PRECISION array, dimension ( LDB, NRHS )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
80 * On input, B contains the right hand sides of the least
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
81 * squares problem in rows 1 through M. On output, B contains
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
82 * the solution X in rows 1 through N.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
83 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
84 * LDB (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
85 * The leading dimension of B. LDB must be at least
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
86 * max(1,MAX( M, N ) ).
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 * BX (workspace) DOUBLE PRECISION array, dimension ( LDBX, NRHS )
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 * LDBX (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
91 * The leading dimension of BX.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
92 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
93 * PERM (input) INTEGER array, dimension ( N )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
94 * The permutations (from deflation and sorting) applied
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
95 * to the two blocks.
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 * GIVPTR (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
98 * The number of Givens rotations which took place in this
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
99 * subproblem.
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 * GIVCOL (input) INTEGER array, dimension ( LDGCOL, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
102 * Each pair of numbers indicates a pair of rows/columns
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
103 * involved in a Givens rotation.
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 * LDGCOL (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
106 * The leading dimension of GIVCOL, must be at least N.
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 * GIVNUM (input) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
109 * Each number indicates the C or S value used in the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
110 * corresponding Givens rotation.
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 * LDGNUM (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
113 * The leading dimension of arrays DIFR, POLES and
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
114 * GIVNUM, must be at least K.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
115 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
116 * POLES (input) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
117 * On entry, POLES(1:K, 1) contains the new singular
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
118 * values obtained from solving the secular equation, and
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
119 * POLES(1:K, 2) is an array containing the poles in the secular
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
120 * equation.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
121 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
122 * DIFL (input) DOUBLE PRECISION array, dimension ( K ).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
123 * On entry, DIFL(I) is the distance between I-th updated
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
124 * (undeflated) singular value and the I-th (undeflated) old
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
125 * singular value.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
126 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
127 * DIFR (input) DOUBLE PRECISION array, dimension ( LDGNUM, 2 ).
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
128 * On entry, DIFR(I, 1) contains the distances between I-th
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
129 * updated (undeflated) singular value and the I+1-th
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
130 * (undeflated) old singular value. And DIFR(I, 2) is the
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
131 * normalizing factor for the I-th right singular vector.
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 * Z (input) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
134 * Contain the components of the deflation-adjusted updating row
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
135 * vector.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
136 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
137 * K (input) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
138 * Contains the dimension of the non-deflated matrix,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
139 * This is the order of the related secular equation. 1 <= K <=N.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
140 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
141 * C (input) DOUBLE PRECISION
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
142 * C contains garbage if SQRE =0 and the C-value of a Givens
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
143 * rotation related to the right null space if SQRE = 1.
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 * S (input) DOUBLE PRECISION
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
146 * S contains garbage if SQRE =0 and the S-value of a Givens
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
147 * rotation related to the right null space if SQRE = 1.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
148 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
149 * WORK (workspace) DOUBLE PRECISION array, dimension ( K )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
150 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
151 * INFO (output) INTEGER
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
152 * = 0: successful exit.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
153 * < 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
154 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
155 * Further Details
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
156 * ===============
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
157 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
158 * Based on contributions by
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
159 * Ming Gu and Ren-Cang Li, Computer Science Division, University of
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
160 * California at Berkeley, USA
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
161 * Osni Marques, LBNL/NERSC, USA
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
162 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
163 * =====================================================================
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
164 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
165 * .. Parameters ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
166 DOUBLE PRECISION ONE, ZERO, NEGONE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
167 PARAMETER ( ONE = 1.0D0, ZERO = 0.0D0, NEGONE = -1.0D0 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
168 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
169 * .. Local Scalars ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
170 INTEGER I, J, M, N, NLP1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
171 DOUBLE PRECISION DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, TEMP
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
172 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
173 * .. External Subroutines ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
174 EXTERNAL DCOPY, DGEMV, DLACPY, DLASCL, DROT, DSCAL,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
175 $ XERBLA
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
176 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
177 * .. External Functions ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
178 DOUBLE PRECISION DLAMC3, DNRM2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
179 EXTERNAL DLAMC3, DNRM2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
180 * ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
181 * .. Intrinsic Functions ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
182 INTRINSIC MAX
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 * .. Executable Statements ..
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
185 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
186 * Test the input parameters.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
187 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
188 INFO = 0
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
189 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
190 IF( ( ICOMPQ.LT.0 ) .OR. ( ICOMPQ.GT.1 ) ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
191 INFO = -1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
192 ELSE IF( NL.LT.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
193 INFO = -2
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
194 ELSE IF( NR.LT.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
195 INFO = -3
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
196 ELSE IF( ( SQRE.LT.0 ) .OR. ( SQRE.GT.1 ) ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
197 INFO = -4
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
198 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
199 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
200 N = NL + NR + 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
201 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
202 IF( NRHS.LT.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
203 INFO = -5
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
204 ELSE IF( LDB.LT.N ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
205 INFO = -7
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
206 ELSE IF( LDBX.LT.N ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
207 INFO = -9
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
208 ELSE IF( GIVPTR.LT.0 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
209 INFO = -11
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
210 ELSE IF( LDGCOL.LT.N ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
211 INFO = -13
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
212 ELSE IF( LDGNUM.LT.N ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
213 INFO = -15
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
214 ELSE IF( K.LT.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
215 INFO = -20
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
216 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
217 IF( INFO.NE.0 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
218 CALL XERBLA( 'DLALS0', -INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
219 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
220 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
221 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
222 M = N + SQRE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
223 NLP1 = NL + 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
224 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
225 IF( ICOMPQ.EQ.0 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
226 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
227 * Apply back orthogonal transformations from the left.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
228 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
229 * Step (1L): apply back the Givens rotations performed.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
230 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
231 DO 10 I = 1, GIVPTR
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
232 CALL DROT( NRHS, B( GIVCOL( I, 2 ), 1 ), LDB,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
233 $ B( GIVCOL( I, 1 ), 1 ), LDB, GIVNUM( I, 2 ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
234 $ GIVNUM( I, 1 ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
235 10 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
236 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
237 * Step (2L): permute rows of B.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
238 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
239 CALL DCOPY( NRHS, B( NLP1, 1 ), LDB, BX( 1, 1 ), LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
240 DO 20 I = 2, N
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
241 CALL DCOPY( NRHS, B( PERM( I ), 1 ), LDB, BX( I, 1 ), LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
242 20 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
243 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
244 * Step (3L): apply the inverse of the left singular vector
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
245 * matrix to BX.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
246 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
247 IF( K.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
248 CALL DCOPY( NRHS, BX, LDBX, B, LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
249 IF( Z( 1 ).LT.ZERO ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
250 CALL DSCAL( NRHS, NEGONE, B, LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
251 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
252 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
253 DO 50 J = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
254 DIFLJ = DIFL( J )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
255 DJ = POLES( J, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
256 DSIGJ = -POLES( J, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
257 IF( J.LT.K ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
258 DIFRJ = -DIFR( J, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
259 DSIGJP = -POLES( J+1, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
260 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
261 IF( ( Z( J ).EQ.ZERO ) .OR. ( POLES( J, 2 ).EQ.ZERO ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
262 $ THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
263 WORK( J ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
264 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
265 WORK( J ) = -POLES( J, 2 )*Z( J ) / DIFLJ /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
266 $ ( POLES( J, 2 )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
267 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
268 DO 30 I = 1, J - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
269 IF( ( Z( I ).EQ.ZERO ) .OR.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
270 $ ( POLES( I, 2 ).EQ.ZERO ) ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
271 WORK( I ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
272 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
273 WORK( I ) = POLES( I, 2 )*Z( I ) /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
274 $ ( DLAMC3( POLES( I, 2 ), DSIGJ )-
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
275 $ DIFLJ ) / ( POLES( I, 2 )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
276 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
277 30 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
278 DO 40 I = J + 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
279 IF( ( Z( I ).EQ.ZERO ) .OR.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
280 $ ( POLES( I, 2 ).EQ.ZERO ) ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
281 WORK( I ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
282 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
283 WORK( I ) = POLES( I, 2 )*Z( I ) /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
284 $ ( DLAMC3( POLES( I, 2 ), DSIGJP )+
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
285 $ DIFRJ ) / ( POLES( I, 2 )+DJ )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
286 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
287 40 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
288 WORK( 1 ) = NEGONE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
289 TEMP = DNRM2( K, WORK, 1 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
290 CALL DGEMV( 'T', K, NRHS, ONE, BX, LDBX, WORK, 1, ZERO,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
291 $ B( J, 1 ), LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
292 CALL DLASCL( 'G', 0, 0, TEMP, ONE, 1, NRHS, B( J, 1 ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
293 $ LDB, INFO )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
294 50 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
295 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
296 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
297 * Move the deflated rows of BX to B also.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
298 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
299 IF( K.LT.MAX( M, N ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
300 $ CALL DLACPY( 'A', N-K, NRHS, BX( K+1, 1 ), LDBX,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
301 $ B( K+1, 1 ), LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
302 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
303 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
304 * Apply back the right orthogonal transformations.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
305 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
306 * Step (1R): apply back the new right singular vector matrix
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
307 * to B.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
308 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
309 IF( K.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
310 CALL DCOPY( NRHS, B, LDB, BX, LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
311 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
312 DO 80 J = 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
313 DSIGJ = POLES( J, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
314 IF( Z( J ).EQ.ZERO ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
315 WORK( J ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
316 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
317 WORK( J ) = -Z( J ) / DIFL( J ) /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
318 $ ( DSIGJ+POLES( J, 1 ) ) / DIFR( J, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
319 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
320 DO 60 I = 1, J - 1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
321 IF( Z( J ).EQ.ZERO ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
322 WORK( I ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
323 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
324 WORK( I ) = Z( J ) / ( DLAMC3( DSIGJ, -POLES( I+1,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
325 $ 2 ) )-DIFR( I, 1 ) ) /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
326 $ ( DSIGJ+POLES( I, 1 ) ) / DIFR( I, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
327 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
328 60 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
329 DO 70 I = J + 1, K
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
330 IF( Z( J ).EQ.ZERO ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
331 WORK( I ) = ZERO
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
332 ELSE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
333 WORK( I ) = Z( J ) / ( DLAMC3( DSIGJ, -POLES( I,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
334 $ 2 ) )-DIFL( I ) ) /
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
335 $ ( DSIGJ+POLES( I, 1 ) ) / DIFR( I, 2 )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
336 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
337 70 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
338 CALL DGEMV( 'T', K, NRHS, ONE, B, LDB, WORK, 1, ZERO,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
339 $ BX( J, 1 ), LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
340 80 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
341 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
342 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
343 * Step (2R): if SQRE = 1, apply back the rotation that is
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
344 * related to the right null space of the subproblem.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
345 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
346 IF( SQRE.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
347 CALL DCOPY( NRHS, B( M, 1 ), LDB, BX( M, 1 ), LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
348 CALL DROT( NRHS, BX( 1, 1 ), LDBX, BX( M, 1 ), LDBX, C, S )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
349 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
350 IF( K.LT.MAX( M, N ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
351 $ CALL DLACPY( 'A', N-K, NRHS, B( K+1, 1 ), LDB, BX( K+1, 1 ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
352 $ LDBX )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
353 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
354 * Step (3R): permute rows of B.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
355 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
356 CALL DCOPY( NRHS, BX( 1, 1 ), LDBX, B( NLP1, 1 ), LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
357 IF( SQRE.EQ.1 ) THEN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
358 CALL DCOPY( NRHS, BX( M, 1 ), LDBX, B( M, 1 ), LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
359 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
360 DO 90 I = 2, N
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
361 CALL DCOPY( NRHS, BX( I, 1 ), LDBX, B( PERM( I ), 1 ), LDB )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
362 90 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
363 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
364 * Step (4R): apply back the Givens rotations performed.
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
365 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
366 DO 100 I = GIVPTR, 1, -1
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
367 CALL DROT( NRHS, B( GIVCOL( I, 2 ), 1 ), LDB,
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
368 $ B( GIVCOL( I, 1 ), 1 ), LDB, GIVNUM( I, 2 ),
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
369 $ -GIVNUM( I, 1 ) )
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
370 100 CONTINUE
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
371 END IF
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
372 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
373 RETURN
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
374 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
375 * End of DLALS0
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
376 *
b48d486f641d [project @ 2007-10-26 15:52:57 by jwe]
jwe
parents:
diff changeset
377 END