LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cupmtr()

subroutine cupmtr ( character side,
character uplo,
character trans,
integer m,
integer n,
complex, dimension( * ) ap,
complex, dimension( * ) tau,
complex, dimension( ldc, * ) c,
integer ldc,
complex, dimension( * ) work,
integer info )

CUPMTR

Download CUPMTR + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> CUPMTR overwrites the general complex M-by-N matrix C with
!>
!>                 SIDE = 'L'     SIDE = 'R'
!> TRANS = 'N':      Q * C          C * Q
!> TRANS = 'C':      Q**H * C       C * Q**H
!>
!> where Q is a complex unitary matrix of order nq, with nq = m if
!> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
!> nq-1 elementary reflectors, as returned by CHPTRD using packed
!> storage:
!>
!> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
!>
!> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
!> 
Parameters
[in]SIDE
!>          SIDE is CHARACTER*1
!>          = 'L': apply Q or Q**H from the Left;
!>          = 'R': apply Q or Q**H from the Right.
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          = 'U': Upper triangular packed storage used in previous
!>                 call to CHPTRD;
!>          = 'L': Lower triangular packed storage used in previous
!>                 call to CHPTRD.
!> 
[in]TRANS
!>          TRANS is CHARACTER*1
!>          = 'N':  No transpose, apply Q;
!>          = 'C':  Conjugate transpose, apply Q**H.
!> 
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix C. M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix C. N >= 0.
!> 
[in]AP
!>          AP is COMPLEX array, dimension
!>                               (M*(M+1)/2) if SIDE = 'L'
!>                               (N*(N+1)/2) if SIDE = 'R'
!>          The vectors which define the elementary reflectors, as
!>          returned by CHPTRD.  AP is modified by the routine but
!>          restored on exit.
!> 
[in]TAU
!>          TAU is COMPLEX array, dimension (M-1) if SIDE = 'L'
!>                                     or (N-1) if SIDE = 'R'
!>          TAU(i) must contain the scalar factor of the elementary
!>          reflector H(i), as returned by CHPTRD.
!> 
[in,out]C
!>          C is COMPLEX array, dimension (LDC,N)
!>          On entry, the M-by-N matrix C.
!>          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
!> 
[in]LDC
!>          LDC is INTEGER
!>          The leading dimension of the array C. LDC >= max(1,M).
!> 
[out]WORK
!>          WORK is COMPLEX array, dimension
!>                                   (N) if SIDE = 'L'
!>                                   (M) if SIDE = 'R'
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 146 of file cupmtr.f.

149*
150* -- LAPACK computational routine --
151* -- LAPACK is a software package provided by Univ. of Tennessee, --
152* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153*
154* .. Scalar Arguments ..
155 CHARACTER SIDE, TRANS, UPLO
156 INTEGER INFO, LDC, M, N
157* ..
158* .. Array Arguments ..
159 COMPLEX AP( * ), C( LDC, * ), TAU( * ), WORK( * )
160* ..
161*
162* =====================================================================
163*
164* .. Local Scalars ..
165 LOGICAL FORWRD, LEFT, NOTRAN, UPPER
166 INTEGER I, I1, I2, I3, IC, II, JC, MI, NI, NQ
167 COMPLEX TAUI
168* ..
169* .. External Functions ..
170 LOGICAL LSAME
171 EXTERNAL lsame
172* ..
173* .. External Subroutines ..
174 EXTERNAL clarf1f, clarf1l, xerbla
175* ..
176* .. Intrinsic Functions ..
177 INTRINSIC conjg, max
178* ..
179* .. Executable Statements ..
180*
181* Test the input arguments
182*
183 info = 0
184 left = lsame( side, 'L' )
185 notran = lsame( trans, 'N' )
186 upper = lsame( uplo, 'U' )
187*
188* NQ is the order of Q
189*
190 IF( left ) THEN
191 nq = m
192 ELSE
193 nq = n
194 END IF
195 IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
196 info = -1
197 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
198 info = -2
199 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'C' ) ) THEN
200 info = -3
201 ELSE IF( m.LT.0 ) THEN
202 info = -4
203 ELSE IF( n.LT.0 ) THEN
204 info = -5
205 ELSE IF( ldc.LT.max( 1, m ) ) THEN
206 info = -9
207 END IF
208 IF( info.NE.0 ) THEN
209 CALL xerbla( 'CUPMTR', -info )
210 RETURN
211 END IF
212*
213* Quick return if possible
214*
215 IF( m.EQ.0 .OR. n.EQ.0 )
216 $ RETURN
217*
218 IF( upper ) THEN
219*
220* Q was determined by a call to CHPTRD with UPLO = 'U'
221*
222 forwrd = ( left .AND. notran ) .OR.
223 $ ( .NOT.left .AND. .NOT.notran )
224*
225 IF( forwrd ) THEN
226 i1 = 1
227 i2 = nq - 1
228 i3 = 1
229 ii = 2
230 ELSE
231 i1 = nq - 1
232 i2 = 1
233 i3 = -1
234 ii = nq*( nq+1 ) / 2 - 1
235 END IF
236*
237 IF( left ) THEN
238 ni = n
239 ELSE
240 mi = m
241 END IF
242*
243 DO 10 i = i1, i2, i3
244 IF( left ) THEN
245*
246* H(i) or H(i)**H is applied to C(1:i,1:n)
247*
248 mi = i
249 ELSE
250*
251* H(i) or H(i)**H is applied to C(1:m,1:i)
252*
253 ni = i
254 END IF
255*
256* Apply H(i) or H(i)**H
257*
258 IF( notran ) THEN
259 taui = tau( i )
260 ELSE
261 taui = conjg( tau( i ) )
262 END IF
263 CALL clarf1l( side, mi, ni, ap( ii-i+1 ), 1, taui, c,
264 $ ldc, work )
265*
266 IF( forwrd ) THEN
267 ii = ii + i + 2
268 ELSE
269 ii = ii - i - 1
270 END IF
271 10 CONTINUE
272 ELSE
273*
274* Q was determined by a call to CHPTRD with UPLO = 'L'.
275*
276 forwrd = ( left .AND. .NOT.notran ) .OR.
277 $ ( .NOT.left .AND. notran )
278*
279 IF( forwrd ) THEN
280 i1 = 1
281 i2 = nq - 1
282 i3 = 1
283 ii = 2
284 ELSE
285 i1 = nq - 1
286 i2 = 1
287 i3 = -1
288 ii = nq*( nq+1 ) / 2 - 1
289 END IF
290*
291 IF( left ) THEN
292 ni = n
293 jc = 1
294 ELSE
295 mi = m
296 ic = 1
297 END IF
298*
299 DO 20 i = i1, i2, i3
300 IF( left ) THEN
301*
302* H(i) or H(i)**H is applied to C(i+1:m,1:n)
303*
304 mi = m - i
305 ic = i + 1
306 ELSE
307*
308* H(i) or H(i)**H is applied to C(1:m,i+1:n)
309*
310 ni = n - i
311 jc = i + 1
312 END IF
313*
314* Apply H(i) or H(i)**H
315*
316 IF( notran ) THEN
317 taui = tau( i )
318 ELSE
319 taui = conjg( tau( i ) )
320 END IF
321 CALL clarf1f( side, mi, ni, ap( ii ), 1, taui, c( ic,
322 $ jc ), ldc, work )
323*
324 IF( forwrd ) THEN
325 ii = ii + nq - i + 1
326 ELSE
327 ii = ii - nq + i - 2
328 END IF
329 20 CONTINUE
330 END IF
331 RETURN
332*
333* End of CUPMTR
334*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine clarf1f(side, m, n, v, incv, tau, c, ldc, work)
CLARF1F applies an elementary reflector to a general rectangular
Definition clarf1f.f:126
subroutine clarf1l(side, m, n, v, incv, tau, c, ldc, work)
CLARF1L applies an elementary reflector to a general rectangular
Definition clarf1l.f:127
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: