Statistiques
| Révision :

root / src / lapack / double / dgebd2.f @ 10

Historique | Voir | Annoter | Télécharger (7,87 ko)

1 1 pfleura2
      SUBROUTINE DGEBD2( M, N, A, LDA, D, E, TAUQ, TAUP, WORK, INFO )
2 1 pfleura2
*
3 1 pfleura2
*  -- LAPACK routine (version 3.2) --
4 1 pfleura2
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
5 1 pfleura2
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6 1 pfleura2
*     November 2006
7 1 pfleura2
*
8 1 pfleura2
*     .. Scalar Arguments ..
9 1 pfleura2
      INTEGER            INFO, LDA, M, N
10 1 pfleura2
*     ..
11 1 pfleura2
*     .. Array Arguments ..
12 1 pfleura2
      DOUBLE PRECISION   A( LDA, * ), D( * ), E( * ), TAUP( * ),
13 1 pfleura2
     $                   TAUQ( * ), WORK( * )
14 1 pfleura2
*     ..
15 1 pfleura2
*
16 1 pfleura2
*  Purpose
17 1 pfleura2
*  =======
18 1 pfleura2
*
19 1 pfleura2
*  DGEBD2 reduces a real general m by n matrix A to upper or lower
20 1 pfleura2
*  bidiagonal form B by an orthogonal transformation: Q' * A * P = B.
21 1 pfleura2
*
22 1 pfleura2
*  If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
23 1 pfleura2
*
24 1 pfleura2
*  Arguments
25 1 pfleura2
*  =========
26 1 pfleura2
*
27 1 pfleura2
*  M       (input) INTEGER
28 1 pfleura2
*          The number of rows in the matrix A.  M >= 0.
29 1 pfleura2
*
30 1 pfleura2
*  N       (input) INTEGER
31 1 pfleura2
*          The number of columns in the matrix A.  N >= 0.
32 1 pfleura2
*
33 1 pfleura2
*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
34 1 pfleura2
*          On entry, the m by n general matrix to be reduced.
35 1 pfleura2
*          On exit,
36 1 pfleura2
*          if m >= n, the diagonal and the first superdiagonal are
37 1 pfleura2
*            overwritten with the upper bidiagonal matrix B; the
38 1 pfleura2
*            elements below the diagonal, with the array TAUQ, represent
39 1 pfleura2
*            the orthogonal matrix Q as a product of elementary
40 1 pfleura2
*            reflectors, and the elements above the first superdiagonal,
41 1 pfleura2
*            with the array TAUP, represent the orthogonal matrix P as
42 1 pfleura2
*            a product of elementary reflectors;
43 1 pfleura2
*          if m < n, the diagonal and the first subdiagonal are
44 1 pfleura2
*            overwritten with the lower bidiagonal matrix B; the
45 1 pfleura2
*            elements below the first subdiagonal, with the array TAUQ,
46 1 pfleura2
*            represent the orthogonal matrix Q as a product of
47 1 pfleura2
*            elementary reflectors, and the elements above the diagonal,
48 1 pfleura2
*            with the array TAUP, represent the orthogonal matrix P as
49 1 pfleura2
*            a product of elementary reflectors.
50 1 pfleura2
*          See Further Details.
51 1 pfleura2
*
52 1 pfleura2
*  LDA     (input) INTEGER
53 1 pfleura2
*          The leading dimension of the array A.  LDA >= max(1,M).
54 1 pfleura2
*
55 1 pfleura2
*  D       (output) DOUBLE PRECISION array, dimension (min(M,N))
56 1 pfleura2
*          The diagonal elements of the bidiagonal matrix B:
57 1 pfleura2
*          D(i) = A(i,i).
58 1 pfleura2
*
59 1 pfleura2
*  E       (output) DOUBLE PRECISION array, dimension (min(M,N)-1)
60 1 pfleura2
*          The off-diagonal elements of the bidiagonal matrix B:
61 1 pfleura2
*          if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n-1;
62 1 pfleura2
*          if m < n, E(i) = A(i+1,i) for i = 1,2,...,m-1.
63 1 pfleura2
*
64 1 pfleura2
*  TAUQ    (output) DOUBLE PRECISION array dimension (min(M,N))
65 1 pfleura2
*          The scalar factors of the elementary reflectors which
66 1 pfleura2
*          represent the orthogonal matrix Q. See Further Details.
67 1 pfleura2
*
68 1 pfleura2
*  TAUP    (output) DOUBLE PRECISION array, dimension (min(M,N))
69 1 pfleura2
*          The scalar factors of the elementary reflectors which
70 1 pfleura2
*          represent the orthogonal matrix P. See Further Details.
71 1 pfleura2
*
72 1 pfleura2
*  WORK    (workspace) DOUBLE PRECISION array, dimension (max(M,N))
73 1 pfleura2
*
74 1 pfleura2
*  INFO    (output) INTEGER
75 1 pfleura2
*          = 0: successful exit.
76 1 pfleura2
*          < 0: if INFO = -i, the i-th argument had an illegal value.
77 1 pfleura2
*
78 1 pfleura2
*  Further Details
79 1 pfleura2
*  ===============
80 1 pfleura2
*
81 1 pfleura2
*  The matrices Q and P are represented as products of elementary
82 1 pfleura2
*  reflectors:
83 1 pfleura2
*
84 1 pfleura2
*  If m >= n,
85 1 pfleura2
*
86 1 pfleura2
*     Q = H(1) H(2) . . . H(n)  and  P = G(1) G(2) . . . G(n-1)
87 1 pfleura2
*
88 1 pfleura2
*  Each H(i) and G(i) has the form:
89 1 pfleura2
*
90 1 pfleura2
*     H(i) = I - tauq * v * v'  and G(i) = I - taup * u * u'
91 1 pfleura2
*
92 1 pfleura2
*  where tauq and taup are real scalars, and v and u are real vectors;
93 1 pfleura2
*  v(1:i-1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i);
94 1 pfleura2
*  u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n);
95 1 pfleura2
*  tauq is stored in TAUQ(i) and taup in TAUP(i).
96 1 pfleura2
*
97 1 pfleura2
*  If m < n,
98 1 pfleura2
*
99 1 pfleura2
*     Q = H(1) H(2) . . . H(m-1)  and  P = G(1) G(2) . . . G(m)
100 1 pfleura2
*
101 1 pfleura2
*  Each H(i) and G(i) has the form:
102 1 pfleura2
*
103 1 pfleura2
*     H(i) = I - tauq * v * v'  and G(i) = I - taup * u * u'
104 1 pfleura2
*
105 1 pfleura2
*  where tauq and taup are real scalars, and v and u are real vectors;
106 1 pfleura2
*  v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i);
107 1 pfleura2
*  u(1:i-1) = 0, u(i) = 1, and u(i+1:n) is stored on exit in A(i,i+1:n);
108 1 pfleura2
*  tauq is stored in TAUQ(i) and taup in TAUP(i).
109 1 pfleura2
*
110 1 pfleura2
*  The contents of A on exit are illustrated by the following examples:
111 1 pfleura2
*
112 1 pfleura2
*  m = 6 and n = 5 (m > n):          m = 5 and n = 6 (m < n):
113 1 pfleura2
*
114 1 pfleura2
*    (  d   e   u1  u1  u1 )           (  d   u1  u1  u1  u1  u1 )
115 1 pfleura2
*    (  v1  d   e   u2  u2 )           (  e   d   u2  u2  u2  u2 )
116 1 pfleura2
*    (  v1  v2  d   e   u3 )           (  v1  e   d   u3  u3  u3 )
117 1 pfleura2
*    (  v1  v2  v3  d   e  )           (  v1  v2  e   d   u4  u4 )
118 1 pfleura2
*    (  v1  v2  v3  v4  d  )           (  v1  v2  v3  e   d   u5 )
119 1 pfleura2
*    (  v1  v2  v3  v4  v5 )
120 1 pfleura2
*
121 1 pfleura2
*  where d and e denote diagonal and off-diagonal elements of B, vi
122 1 pfleura2
*  denotes an element of the vector defining H(i), and ui an element of
123 1 pfleura2
*  the vector defining G(i).
124 1 pfleura2
*
125 1 pfleura2
*  =====================================================================
126 1 pfleura2
*
127 1 pfleura2
*     .. Parameters ..
128 1 pfleura2
      DOUBLE PRECISION   ZERO, ONE
129 1 pfleura2
      PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
130 1 pfleura2
*     ..
131 1 pfleura2
*     .. Local Scalars ..
132 1 pfleura2
      INTEGER            I
133 1 pfleura2
*     ..
134 1 pfleura2
*     .. External Subroutines ..
135 1 pfleura2
      EXTERNAL           DLARF, DLARFG, XERBLA
136 1 pfleura2
*     ..
137 1 pfleura2
*     .. Intrinsic Functions ..
138 1 pfleura2
      INTRINSIC          MAX, MIN
139 1 pfleura2
*     ..
140 1 pfleura2
*     .. Executable Statements ..
141 1 pfleura2
*
142 1 pfleura2
*     Test the input parameters
143 1 pfleura2
*
144 1 pfleura2
      INFO = 0
145 1 pfleura2
      IF( M.LT.0 ) THEN
146 1 pfleura2
         INFO = -1
147 1 pfleura2
      ELSE IF( N.LT.0 ) THEN
148 1 pfleura2
         INFO = -2
149 1 pfleura2
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
150 1 pfleura2
         INFO = -4
151 1 pfleura2
      END IF
152 1 pfleura2
      IF( INFO.LT.0 ) THEN
153 1 pfleura2
         CALL XERBLA( 'DGEBD2', -INFO )
154 1 pfleura2
         RETURN
155 1 pfleura2
      END IF
156 1 pfleura2
*
157 1 pfleura2
      IF( M.GE.N ) THEN
158 1 pfleura2
*
159 1 pfleura2
*        Reduce to upper bidiagonal form
160 1 pfleura2
*
161 1 pfleura2
         DO 10 I = 1, N
162 1 pfleura2
*
163 1 pfleura2
*           Generate elementary reflector H(i) to annihilate A(i+1:m,i)
164 1 pfleura2
*
165 1 pfleura2
            CALL DLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
166 1 pfleura2
     $                   TAUQ( I ) )
167 1 pfleura2
            D( I ) = A( I, I )
168 1 pfleura2
            A( I, I ) = ONE
169 1 pfleura2
*
170 1 pfleura2
*           Apply H(i) to A(i:m,i+1:n) from the left
171 1 pfleura2
*
172 1 pfleura2
            IF( I.LT.N )
173 1 pfleura2
     $         CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
174 1 pfleura2
     $                     A( I, I+1 ), LDA, WORK )
175 1 pfleura2
            A( I, I ) = D( I )
176 1 pfleura2
*
177 1 pfleura2
            IF( I.LT.N ) THEN
178 1 pfleura2
*
179 1 pfleura2
*              Generate elementary reflector G(i) to annihilate
180 1 pfleura2
*              A(i,i+2:n)
181 1 pfleura2
*
182 1 pfleura2
               CALL DLARFG( N-I, A( I, I+1 ), A( I, MIN( I+2, N ) ),
183 1 pfleura2
     $                      LDA, TAUP( I ) )
184 1 pfleura2
               E( I ) = A( I, I+1 )
185 1 pfleura2
               A( I, I+1 ) = ONE
186 1 pfleura2
*
187 1 pfleura2
*              Apply G(i) to A(i+1:m,i+1:n) from the right
188 1 pfleura2
*
189 1 pfleura2
               CALL DLARF( 'Right', M-I, N-I, A( I, I+1 ), LDA,
190 1 pfleura2
     $                     TAUP( I ), A( I+1, I+1 ), LDA, WORK )
191 1 pfleura2
               A( I, I+1 ) = E( I )
192 1 pfleura2
            ELSE
193 1 pfleura2
               TAUP( I ) = ZERO
194 1 pfleura2
            END IF
195 1 pfleura2
   10    CONTINUE
196 1 pfleura2
      ELSE
197 1 pfleura2
*
198 1 pfleura2
*        Reduce to lower bidiagonal form
199 1 pfleura2
*
200 1 pfleura2
         DO 20 I = 1, M
201 1 pfleura2
*
202 1 pfleura2
*           Generate elementary reflector G(i) to annihilate A(i,i+1:n)
203 1 pfleura2
*
204 1 pfleura2
            CALL DLARFG( N-I+1, A( I, I ), A( I, MIN( I+1, N ) ), LDA,
205 1 pfleura2
     $                   TAUP( I ) )
206 1 pfleura2
            D( I ) = A( I, I )
207 1 pfleura2
            A( I, I ) = ONE
208 1 pfleura2
*
209 1 pfleura2
*           Apply G(i) to A(i+1:m,i:n) from the right
210 1 pfleura2
*
211 1 pfleura2
            IF( I.LT.M )
212 1 pfleura2
     $         CALL DLARF( 'Right', M-I, N-I+1, A( I, I ), LDA,
213 1 pfleura2
     $                     TAUP( I ), A( I+1, I ), LDA, WORK )
214 1 pfleura2
            A( I, I ) = D( I )
215 1 pfleura2
*
216 1 pfleura2
            IF( I.LT.M ) THEN
217 1 pfleura2
*
218 1 pfleura2
*              Generate elementary reflector H(i) to annihilate
219 1 pfleura2
*              A(i+2:m,i)
220 1 pfleura2
*
221 1 pfleura2
               CALL DLARFG( M-I, A( I+1, I ), A( MIN( I+2, M ), I ), 1,
222 1 pfleura2
     $                      TAUQ( I ) )
223 1 pfleura2
               E( I ) = A( I+1, I )
224 1 pfleura2
               A( I+1, I ) = ONE
225 1 pfleura2
*
226 1 pfleura2
*              Apply H(i) to A(i+1:m,i+1:n) from the left
227 1 pfleura2
*
228 1 pfleura2
               CALL DLARF( 'Left', M-I, N-I, A( I+1, I ), 1, TAUQ( I ),
229 1 pfleura2
     $                     A( I+1, I+1 ), LDA, WORK )
230 1 pfleura2
               A( I+1, I ) = E( I )
231 1 pfleura2
            ELSE
232 1 pfleura2
               TAUQ( I ) = ZERO
233 1 pfleura2
            END IF
234 1 pfleura2
   20    CONTINUE
235 1 pfleura2
      END IF
236 1 pfleura2
      RETURN
237 1 pfleura2
*
238 1 pfleura2
*     End of DGEBD2
239 1 pfleura2
*
240 1 pfleura2
      END