Statistiques
| Révision :

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

Historique | Voir | Annoter | Télécharger (6,53 ko)

1 1 pfleura2
      SUBROUTINE DLARZB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V,
2 1 pfleura2
     $                   LDV, T, LDT, C, LDC, WORK, LDWORK )
3 1 pfleura2
*
4 1 pfleura2
*  -- LAPACK routine (version 3.2) --
5 1 pfleura2
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
6 1 pfleura2
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
7 1 pfleura2
*     November 2006
8 1 pfleura2
*
9 1 pfleura2
*     .. Scalar Arguments ..
10 1 pfleura2
      CHARACTER          DIRECT, SIDE, STOREV, TRANS
11 1 pfleura2
      INTEGER            K, L, LDC, LDT, LDV, LDWORK, M, N
12 1 pfleura2
*     ..
13 1 pfleura2
*     .. Array Arguments ..
14 1 pfleura2
      DOUBLE PRECISION   C( LDC, * ), T( LDT, * ), V( LDV, * ),
15 1 pfleura2
     $                   WORK( LDWORK, * )
16 1 pfleura2
*     ..
17 1 pfleura2
*
18 1 pfleura2
*  Purpose
19 1 pfleura2
*  =======
20 1 pfleura2
*
21 1 pfleura2
*  DLARZB applies a real block reflector H or its transpose H**T to
22 1 pfleura2
*  a real distributed M-by-N  C from the left or the right.
23 1 pfleura2
*
24 1 pfleura2
*  Currently, only STOREV = 'R' and DIRECT = 'B' are supported.
25 1 pfleura2
*
26 1 pfleura2
*  Arguments
27 1 pfleura2
*  =========
28 1 pfleura2
*
29 1 pfleura2
*  SIDE    (input) CHARACTER*1
30 1 pfleura2
*          = 'L': apply H or H' from the Left
31 1 pfleura2
*          = 'R': apply H or H' from the Right
32 1 pfleura2
*
33 1 pfleura2
*  TRANS   (input) CHARACTER*1
34 1 pfleura2
*          = 'N': apply H (No transpose)
35 1 pfleura2
*          = 'C': apply H' (Transpose)
36 1 pfleura2
*
37 1 pfleura2
*  DIRECT  (input) CHARACTER*1
38 1 pfleura2
*          Indicates how H is formed from a product of elementary
39 1 pfleura2
*          reflectors
40 1 pfleura2
*          = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet)
41 1 pfleura2
*          = 'B': H = H(k) . . . H(2) H(1) (Backward)
42 1 pfleura2
*
43 1 pfleura2
*  STOREV  (input) CHARACTER*1
44 1 pfleura2
*          Indicates how the vectors which define the elementary
45 1 pfleura2
*          reflectors are stored:
46 1 pfleura2
*          = 'C': Columnwise                        (not supported yet)
47 1 pfleura2
*          = 'R': Rowwise
48 1 pfleura2
*
49 1 pfleura2
*  M       (input) INTEGER
50 1 pfleura2
*          The number of rows of the matrix C.
51 1 pfleura2
*
52 1 pfleura2
*  N       (input) INTEGER
53 1 pfleura2
*          The number of columns of the matrix C.
54 1 pfleura2
*
55 1 pfleura2
*  K       (input) INTEGER
56 1 pfleura2
*          The order of the matrix T (= the number of elementary
57 1 pfleura2
*          reflectors whose product defines the block reflector).
58 1 pfleura2
*
59 1 pfleura2
*  L       (input) INTEGER
60 1 pfleura2
*          The number of columns of the matrix V containing the
61 1 pfleura2
*          meaningful part of the Householder reflectors.
62 1 pfleura2
*          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
63 1 pfleura2
*
64 1 pfleura2
*  V       (input) DOUBLE PRECISION array, dimension (LDV,NV).
65 1 pfleura2
*          If STOREV = 'C', NV = K; if STOREV = 'R', NV = L.
66 1 pfleura2
*
67 1 pfleura2
*  LDV     (input) INTEGER
68 1 pfleura2
*          The leading dimension of the array V.
69 1 pfleura2
*          If STOREV = 'C', LDV >= L; if STOREV = 'R', LDV >= K.
70 1 pfleura2
*
71 1 pfleura2
*  T       (input) DOUBLE PRECISION array, dimension (LDT,K)
72 1 pfleura2
*          The triangular K-by-K matrix T in the representation of the
73 1 pfleura2
*          block reflector.
74 1 pfleura2
*
75 1 pfleura2
*  LDT     (input) INTEGER
76 1 pfleura2
*          The leading dimension of the array T. LDT >= K.
77 1 pfleura2
*
78 1 pfleura2
*  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
79 1 pfleura2
*          On entry, the M-by-N matrix C.
80 1 pfleura2
*          On exit, C is overwritten by H*C or H'*C or C*H or C*H'.
81 1 pfleura2
*
82 1 pfleura2
*  LDC     (input) INTEGER
83 1 pfleura2
*          The leading dimension of the array C. LDC >= max(1,M).
84 1 pfleura2
*
85 1 pfleura2
*  WORK    (workspace) DOUBLE PRECISION array, dimension (LDWORK,K)
86 1 pfleura2
*
87 1 pfleura2
*  LDWORK  (input) INTEGER
88 1 pfleura2
*          The leading dimension of the array WORK.
89 1 pfleura2
*          If SIDE = 'L', LDWORK >= max(1,N);
90 1 pfleura2
*          if SIDE = 'R', LDWORK >= max(1,M).
91 1 pfleura2
*
92 1 pfleura2
*  Further Details
93 1 pfleura2
*  ===============
94 1 pfleura2
*
95 1 pfleura2
*  Based on contributions by
96 1 pfleura2
*    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
97 1 pfleura2
*
98 1 pfleura2
*  =====================================================================
99 1 pfleura2
*
100 1 pfleura2
*     .. Parameters ..
101 1 pfleura2
      DOUBLE PRECISION   ONE
102 1 pfleura2
      PARAMETER          ( ONE = 1.0D+0 )
103 1 pfleura2
*     ..
104 1 pfleura2
*     .. Local Scalars ..
105 1 pfleura2
      CHARACTER          TRANST
106 1 pfleura2
      INTEGER            I, INFO, J
107 1 pfleura2
*     ..
108 1 pfleura2
*     .. External Functions ..
109 1 pfleura2
      LOGICAL            LSAME
110 1 pfleura2
      EXTERNAL           LSAME
111 1 pfleura2
*     ..
112 1 pfleura2
*     .. External Subroutines ..
113 1 pfleura2
      EXTERNAL           DCOPY, DGEMM, DTRMM, XERBLA
114 1 pfleura2
*     ..
115 1 pfleura2
*     .. Executable Statements ..
116 1 pfleura2
*
117 1 pfleura2
*     Quick return if possible
118 1 pfleura2
*
119 1 pfleura2
      IF( M.LE.0 .OR. N.LE.0 )
120 1 pfleura2
     $   RETURN
121 1 pfleura2
*
122 1 pfleura2
*     Check for currently supported options
123 1 pfleura2
*
124 1 pfleura2
      INFO = 0
125 1 pfleura2
      IF( .NOT.LSAME( DIRECT, 'B' ) ) THEN
126 1 pfleura2
         INFO = -3
127 1 pfleura2
      ELSE IF( .NOT.LSAME( STOREV, 'R' ) ) THEN
128 1 pfleura2
         INFO = -4
129 1 pfleura2
      END IF
130 1 pfleura2
      IF( INFO.NE.0 ) THEN
131 1 pfleura2
         CALL XERBLA( 'DLARZB', -INFO )
132 1 pfleura2
         RETURN
133 1 pfleura2
      END IF
134 1 pfleura2
*
135 1 pfleura2
      IF( LSAME( TRANS, 'N' ) ) THEN
136 1 pfleura2
         TRANST = 'T'
137 1 pfleura2
      ELSE
138 1 pfleura2
         TRANST = 'N'
139 1 pfleura2
      END IF
140 1 pfleura2
*
141 1 pfleura2
      IF( LSAME( SIDE, 'L' ) ) THEN
142 1 pfleura2
*
143 1 pfleura2
*        Form  H * C  or  H' * C
144 1 pfleura2
*
145 1 pfleura2
*        W( 1:n, 1:k ) = C( 1:k, 1:n )'
146 1 pfleura2
*
147 1 pfleura2
         DO 10 J = 1, K
148 1 pfleura2
            CALL DCOPY( N, C( J, 1 ), LDC, WORK( 1, J ), 1 )
149 1 pfleura2
   10    CONTINUE
150 1 pfleura2
*
151 1 pfleura2
*        W( 1:n, 1:k ) = W( 1:n, 1:k ) + ...
152 1 pfleura2
*                        C( m-l+1:m, 1:n )' * V( 1:k, 1:l )'
153 1 pfleura2
*
154 1 pfleura2
         IF( L.GT.0 )
155 1 pfleura2
     $      CALL DGEMM( 'Transpose', 'Transpose', N, K, L, ONE,
156 1 pfleura2
     $                  C( M-L+1, 1 ), LDC, V, LDV, ONE, WORK, LDWORK )
157 1 pfleura2
*
158 1 pfleura2
*        W( 1:n, 1:k ) = W( 1:n, 1:k ) * T'  or  W( 1:m, 1:k ) * T
159 1 pfleura2
*
160 1 pfleura2
         CALL DTRMM( 'Right', 'Lower', TRANST, 'Non-unit', N, K, ONE, T,
161 1 pfleura2
     $               LDT, WORK, LDWORK )
162 1 pfleura2
*
163 1 pfleura2
*        C( 1:k, 1:n ) = C( 1:k, 1:n ) - W( 1:n, 1:k )'
164 1 pfleura2
*
165 1 pfleura2
         DO 30 J = 1, N
166 1 pfleura2
            DO 20 I = 1, K
167 1 pfleura2
               C( I, J ) = C( I, J ) - WORK( J, I )
168 1 pfleura2
   20       CONTINUE
169 1 pfleura2
   30    CONTINUE
170 1 pfleura2
*
171 1 pfleura2
*        C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
172 1 pfleura2
*                            V( 1:k, 1:l )' * W( 1:n, 1:k )'
173 1 pfleura2
*
174 1 pfleura2
         IF( L.GT.0 )
175 1 pfleura2
     $      CALL DGEMM( 'Transpose', 'Transpose', L, N, K, -ONE, V, LDV,
176 1 pfleura2
     $                  WORK, LDWORK, ONE, C( M-L+1, 1 ), LDC )
177 1 pfleura2
*
178 1 pfleura2
      ELSE IF( LSAME( SIDE, 'R' ) ) THEN
179 1 pfleura2
*
180 1 pfleura2
*        Form  C * H  or  C * H'
181 1 pfleura2
*
182 1 pfleura2
*        W( 1:m, 1:k ) = C( 1:m, 1:k )
183 1 pfleura2
*
184 1 pfleura2
         DO 40 J = 1, K
185 1 pfleura2
            CALL DCOPY( M, C( 1, J ), 1, WORK( 1, J ), 1 )
186 1 pfleura2
   40    CONTINUE
187 1 pfleura2
*
188 1 pfleura2
*        W( 1:m, 1:k ) = W( 1:m, 1:k ) + ...
189 1 pfleura2
*                        C( 1:m, n-l+1:n ) * V( 1:k, 1:l )'
190 1 pfleura2
*
191 1 pfleura2
         IF( L.GT.0 )
192 1 pfleura2
     $      CALL DGEMM( 'No transpose', 'Transpose', M, K, L, ONE,
193 1 pfleura2
     $                  C( 1, N-L+1 ), LDC, V, LDV, ONE, WORK, LDWORK )
194 1 pfleura2
*
195 1 pfleura2
*        W( 1:m, 1:k ) = W( 1:m, 1:k ) * T  or  W( 1:m, 1:k ) * T'
196 1 pfleura2
*
197 1 pfleura2
         CALL DTRMM( 'Right', 'Lower', TRANS, 'Non-unit', M, K, ONE, T,
198 1 pfleura2
     $               LDT, WORK, LDWORK )
199 1 pfleura2
*
200 1 pfleura2
*        C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k )
201 1 pfleura2
*
202 1 pfleura2
         DO 60 J = 1, K
203 1 pfleura2
            DO 50 I = 1, M
204 1 pfleura2
               C( I, J ) = C( I, J ) - WORK( I, J )
205 1 pfleura2
   50       CONTINUE
206 1 pfleura2
   60    CONTINUE
207 1 pfleura2
*
208 1 pfleura2
*        C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
209 1 pfleura2
*                            W( 1:m, 1:k ) * V( 1:k, 1:l )
210 1 pfleura2
*
211 1 pfleura2
         IF( L.GT.0 )
212 1 pfleura2
     $      CALL DGEMM( 'No transpose', 'No transpose', M, L, K, -ONE,
213 1 pfleura2
     $                  WORK, LDWORK, V, LDV, ONE, C( 1, N-L+1 ), LDC )
214 1 pfleura2
*
215 1 pfleura2
      END IF
216 1 pfleura2
*
217 1 pfleura2
      RETURN
218 1 pfleura2
*
219 1 pfleura2
*     End of DLARZB
220 1 pfleura2
*
221 1 pfleura2
      END