LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ 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 148 of file cupmtr.f.

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