LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zlasr()

subroutine zlasr ( character  SIDE,
character  PIVOT,
character  DIRECT,
integer  M,
integer  N,
double precision, dimension( * )  C,
double precision, dimension( * )  S,
complex*16, dimension( lda, * )  A,
integer  LDA 
)

ZLASR applies a sequence of plane rotations to a general rectangular matrix.

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

Purpose:
 ZLASR applies a sequence of real plane rotations to a complex matrix
 A, from either the left or the right.

 When SIDE = 'L', the transformation takes the form

    A := P*A

 and when SIDE = 'R', the transformation takes the form

    A := A*P**T

 where P is an orthogonal matrix consisting of a sequence of z plane
 rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
 and P**T is the transpose of P.

 When DIRECT = 'F' (Forward sequence), then

    P = P(z-1) * ... * P(2) * P(1)

 and when DIRECT = 'B' (Backward sequence), then

    P = P(1) * P(2) * ... * P(z-1)

 where P(k) is a plane rotation matrix defined by the 2-by-2 rotation

    R(k) = (  c(k)  s(k) )
         = ( -s(k)  c(k) ).

 When PIVOT = 'V' (Variable pivot), the rotation is performed
 for the plane (k,k+1), i.e., P(k) has the form

    P(k) = (  1                                            )
           (       ...                                     )
           (              1                                )
           (                   c(k)  s(k)                  )
           (                  -s(k)  c(k)                  )
           (                                1              )
           (                                     ...       )
           (                                            1  )

 where R(k) appears as a rank-2 modification to the identity matrix in
 rows and columns k and k+1.

 When PIVOT = 'T' (Top pivot), the rotation is performed for the
 plane (1,k+1), so P(k) has the form

    P(k) = (  c(k)                    s(k)                 )
           (         1                                     )
           (              ...                              )
           (                     1                         )
           ( -s(k)                    c(k)                 )
           (                                 1             )
           (                                      ...      )
           (                                             1 )

 where R(k) appears in rows and columns 1 and k+1.

 Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
 performed for the plane (k,z), giving P(k) the form

    P(k) = ( 1                                             )
           (      ...                                      )
           (             1                                 )
           (                  c(k)                    s(k) )
           (                         1                     )
           (                              ...              )
           (                                     1         )
           (                 -s(k)                    c(k) )

 where R(k) appears in rows and columns k and z.  The rotations are
 performed without ever forming P(k) explicitly.
Parameters
[in]SIDE
          SIDE is CHARACTER*1
          Specifies whether the plane rotation matrix P is applied to
          A on the left or the right.
          = 'L':  Left, compute A := P*A
          = 'R':  Right, compute A:= A*P**T
[in]PIVOT
          PIVOT is CHARACTER*1
          Specifies the plane for which P(k) is a plane rotation
          matrix.
          = 'V':  Variable pivot, the plane (k,k+1)
          = 'T':  Top pivot, the plane (1,k+1)
          = 'B':  Bottom pivot, the plane (k,z)
[in]DIRECT
          DIRECT is CHARACTER*1
          Specifies whether P is a forward or backward sequence of
          plane rotations.
          = 'F':  Forward, P = P(z-1)*...*P(2)*P(1)
          = 'B':  Backward, P = P(1)*P(2)*...*P(z-1)
[in]M
          M is INTEGER
          The number of rows of the matrix A.  If m <= 1, an immediate
          return is effected.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  If n <= 1, an
          immediate return is effected.
[in]C
          C is DOUBLE PRECISION array, dimension
                  (M-1) if SIDE = 'L'
                  (N-1) if SIDE = 'R'
          The cosines c(k) of the plane rotations.
[in]S
          S is DOUBLE PRECISION array, dimension
                  (M-1) if SIDE = 'L'
                  (N-1) if SIDE = 'R'
          The sines s(k) of the plane rotations.  The 2-by-2 plane
          rotation part of the matrix P(k), R(k), has the form
          R(k) = (  c(k)  s(k) )
                 ( -s(k)  c(k) ).
[in,out]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The M-by-N matrix A.  On exit, A is overwritten by P*A if
          SIDE = 'R' or by A*P**T if SIDE = 'L'.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,M).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 202 of file zlasr.f.

202 *
203 * -- LAPACK auxiliary routine (version 3.7.0) --
204 * -- LAPACK is a software package provided by Univ. of Tennessee, --
205 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
206 * December 2016
207 *
208 * .. Scalar Arguments ..
209  CHARACTER direct, pivot, side
210  INTEGER lda, m, n
211 * ..
212 * .. Array Arguments ..
213  DOUBLE PRECISION c( * ), s( * )
214  COMPLEX*16 a( lda, * )
215 * ..
216 *
217 * =====================================================================
218 *
219 * .. Parameters ..
220  DOUBLE PRECISION one, zero
221  parameter( one = 1.0d+0, zero = 0.0d+0 )
222 * ..
223 * .. Local Scalars ..
224  INTEGER i, info, j
225  DOUBLE PRECISION ctemp, stemp
226  COMPLEX*16 temp
227 * ..
228 * .. Intrinsic Functions ..
229  INTRINSIC max
230 * ..
231 * .. External Functions ..
232  LOGICAL lsame
233  EXTERNAL lsame
234 * ..
235 * .. External Subroutines ..
236  EXTERNAL xerbla
237 * ..
238 * .. Executable Statements ..
239 *
240 * Test the input parameters
241 *
242  info = 0
243  IF( .NOT.( lsame( side, 'L' ) .OR. lsame( side, 'R' ) ) ) THEN
244  info = 1
245  ELSE IF( .NOT.( lsame( pivot, 'V' ) .OR. lsame( pivot,
246  $ 'T' ) .OR. lsame( pivot, 'B' ) ) ) THEN
247  info = 2
248  ELSE IF( .NOT.( lsame( direct, 'F' ) .OR. lsame( direct, 'B' ) ) )
249  $ THEN
250  info = 3
251  ELSE IF( m.LT.0 ) THEN
252  info = 4
253  ELSE IF( n.LT.0 ) THEN
254  info = 5
255  ELSE IF( lda.LT.max( 1, m ) ) THEN
256  info = 9
257  END IF
258  IF( info.NE.0 ) THEN
259  CALL xerbla( 'ZLASR ', info )
260  RETURN
261  END IF
262 *
263 * Quick return if possible
264 *
265  IF( ( m.EQ.0 ) .OR. ( n.EQ.0 ) )
266  $ RETURN
267  IF( lsame( side, 'L' ) ) THEN
268 *
269 * Form P * A
270 *
271  IF( lsame( pivot, 'V' ) ) THEN
272  IF( lsame( direct, 'F' ) ) THEN
273  DO 20 j = 1, m - 1
274  ctemp = c( j )
275  stemp = s( j )
276  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
277  DO 10 i = 1, n
278  temp = a( j+1, i )
279  a( j+1, i ) = ctemp*temp - stemp*a( j, i )
280  a( j, i ) = stemp*temp + ctemp*a( j, i )
281  10 CONTINUE
282  END IF
283  20 CONTINUE
284  ELSE IF( lsame( direct, 'B' ) ) THEN
285  DO 40 j = m - 1, 1, -1
286  ctemp = c( j )
287  stemp = s( j )
288  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
289  DO 30 i = 1, n
290  temp = a( j+1, i )
291  a( j+1, i ) = ctemp*temp - stemp*a( j, i )
292  a( j, i ) = stemp*temp + ctemp*a( j, i )
293  30 CONTINUE
294  END IF
295  40 CONTINUE
296  END IF
297  ELSE IF( lsame( pivot, 'T' ) ) THEN
298  IF( lsame( direct, 'F' ) ) THEN
299  DO 60 j = 2, m
300  ctemp = c( j-1 )
301  stemp = s( j-1 )
302  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
303  DO 50 i = 1, n
304  temp = a( j, i )
305  a( j, i ) = ctemp*temp - stemp*a( 1, i )
306  a( 1, i ) = stemp*temp + ctemp*a( 1, i )
307  50 CONTINUE
308  END IF
309  60 CONTINUE
310  ELSE IF( lsame( direct, 'B' ) ) THEN
311  DO 80 j = m, 2, -1
312  ctemp = c( j-1 )
313  stemp = s( j-1 )
314  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
315  DO 70 i = 1, n
316  temp = a( j, i )
317  a( j, i ) = ctemp*temp - stemp*a( 1, i )
318  a( 1, i ) = stemp*temp + ctemp*a( 1, i )
319  70 CONTINUE
320  END IF
321  80 CONTINUE
322  END IF
323  ELSE IF( lsame( pivot, 'B' ) ) THEN
324  IF( lsame( direct, 'F' ) ) THEN
325  DO 100 j = 1, m - 1
326  ctemp = c( j )
327  stemp = s( j )
328  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
329  DO 90 i = 1, n
330  temp = a( j, i )
331  a( j, i ) = stemp*a( m, i ) + ctemp*temp
332  a( m, i ) = ctemp*a( m, i ) - stemp*temp
333  90 CONTINUE
334  END IF
335  100 CONTINUE
336  ELSE IF( lsame( direct, 'B' ) ) THEN
337  DO 120 j = m - 1, 1, -1
338  ctemp = c( j )
339  stemp = s( j )
340  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
341  DO 110 i = 1, n
342  temp = a( j, i )
343  a( j, i ) = stemp*a( m, i ) + ctemp*temp
344  a( m, i ) = ctemp*a( m, i ) - stemp*temp
345  110 CONTINUE
346  END IF
347  120 CONTINUE
348  END IF
349  END IF
350  ELSE IF( lsame( side, 'R' ) ) THEN
351 *
352 * Form A * P**T
353 *
354  IF( lsame( pivot, 'V' ) ) THEN
355  IF( lsame( direct, 'F' ) ) THEN
356  DO 140 j = 1, n - 1
357  ctemp = c( j )
358  stemp = s( j )
359  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
360  DO 130 i = 1, m
361  temp = a( i, j+1 )
362  a( i, j+1 ) = ctemp*temp - stemp*a( i, j )
363  a( i, j ) = stemp*temp + ctemp*a( i, j )
364  130 CONTINUE
365  END IF
366  140 CONTINUE
367  ELSE IF( lsame( direct, 'B' ) ) THEN
368  DO 160 j = n - 1, 1, -1
369  ctemp = c( j )
370  stemp = s( j )
371  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
372  DO 150 i = 1, m
373  temp = a( i, j+1 )
374  a( i, j+1 ) = ctemp*temp - stemp*a( i, j )
375  a( i, j ) = stemp*temp + ctemp*a( i, j )
376  150 CONTINUE
377  END IF
378  160 CONTINUE
379  END IF
380  ELSE IF( lsame( pivot, 'T' ) ) THEN
381  IF( lsame( direct, 'F' ) ) THEN
382  DO 180 j = 2, n
383  ctemp = c( j-1 )
384  stemp = s( j-1 )
385  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
386  DO 170 i = 1, m
387  temp = a( i, j )
388  a( i, j ) = ctemp*temp - stemp*a( i, 1 )
389  a( i, 1 ) = stemp*temp + ctemp*a( i, 1 )
390  170 CONTINUE
391  END IF
392  180 CONTINUE
393  ELSE IF( lsame( direct, 'B' ) ) THEN
394  DO 200 j = n, 2, -1
395  ctemp = c( j-1 )
396  stemp = s( j-1 )
397  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
398  DO 190 i = 1, m
399  temp = a( i, j )
400  a( i, j ) = ctemp*temp - stemp*a( i, 1 )
401  a( i, 1 ) = stemp*temp + ctemp*a( i, 1 )
402  190 CONTINUE
403  END IF
404  200 CONTINUE
405  END IF
406  ELSE IF( lsame( pivot, 'B' ) ) THEN
407  IF( lsame( direct, 'F' ) ) THEN
408  DO 220 j = 1, n - 1
409  ctemp = c( j )
410  stemp = s( j )
411  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
412  DO 210 i = 1, m
413  temp = a( i, j )
414  a( i, j ) = stemp*a( i, n ) + ctemp*temp
415  a( i, n ) = ctemp*a( i, n ) - stemp*temp
416  210 CONTINUE
417  END IF
418  220 CONTINUE
419  ELSE IF( lsame( direct, 'B' ) ) THEN
420  DO 240 j = n - 1, 1, -1
421  ctemp = c( j )
422  stemp = s( j )
423  IF( ( ctemp.NE.one ) .OR. ( stemp.NE.zero ) ) THEN
424  DO 230 i = 1, m
425  temp = a( i, j )
426  a( i, j ) = stemp*a( i, n ) + ctemp*temp
427  a( i, n ) = ctemp*a( i, n ) - stemp*temp
428  230 CONTINUE
429  END IF
430  240 CONTINUE
431  END IF
432  END IF
433  END IF
434 *
435  RETURN
436 *
437 * End of ZLASR
438 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: