LAPACK 3.3.0

zlarz.f

Go to the documentation of this file.
00001       SUBROUTINE ZLARZ( SIDE, M, N, L, V, INCV, TAU, C, LDC, WORK )
00002 *
00003 *  -- LAPACK routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          SIDE
00010       INTEGER            INCV, L, LDC, M, N
00011       COMPLEX*16         TAU
00012 *     ..
00013 *     .. Array Arguments ..
00014       COMPLEX*16         C( LDC, * ), V( * ), WORK( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  ZLARZ applies a complex elementary reflector H to a complex
00021 *  M-by-N matrix C, from either the left or the right. H is represented
00022 *  in the form
00023 *
00024 *        H = I - tau * v * v'
00025 *
00026 *  where tau is a complex scalar and v is a complex vector.
00027 *
00028 *  If tau = 0, then H is taken to be the unit matrix.
00029 *
00030 *  To apply H' (the conjugate transpose of H), supply conjg(tau) instead
00031 *  tau.
00032 *
00033 *  H is a product of k elementary reflectors as returned by ZTZRZF.
00034 *
00035 *  Arguments
00036 *  =========
00037 *
00038 *  SIDE    (input) CHARACTER*1
00039 *          = 'L': form  H * C
00040 *          = 'R': form  C * H
00041 *
00042 *  M       (input) INTEGER
00043 *          The number of rows of the matrix C.
00044 *
00045 *  N       (input) INTEGER
00046 *          The number of columns of the matrix C.
00047 *
00048 *  L       (input) INTEGER
00049 *          The number of entries of the vector V containing
00050 *          the meaningful part of the Householder vectors.
00051 *          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
00052 *
00053 *  V       (input) COMPLEX*16 array, dimension (1+(L-1)*abs(INCV))
00054 *          The vector v in the representation of H as returned by
00055 *          ZTZRZF. V is not used if TAU = 0.
00056 *
00057 *  INCV    (input) INTEGER
00058 *          The increment between elements of v. INCV <> 0.
00059 *
00060 *  TAU     (input) COMPLEX*16
00061 *          The value tau in the representation of H.
00062 *
00063 *  C       (input/output) COMPLEX*16 array, dimension (LDC,N)
00064 *          On entry, the M-by-N matrix C.
00065 *          On exit, C is overwritten by the matrix H * C if SIDE = 'L',
00066 *          or C * H if SIDE = 'R'.
00067 *
00068 *  LDC     (input) INTEGER
00069 *          The leading dimension of the array C. LDC >= max(1,M).
00070 *
00071 *  WORK    (workspace) COMPLEX*16 array, dimension
00072 *                         (N) if SIDE = 'L'
00073 *                      or (M) if SIDE = 'R'
00074 *
00075 *  Further Details
00076 *  ===============
00077 *
00078 *  Based on contributions by
00079 *    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
00080 *
00081 *  =====================================================================
00082 *
00083 *     .. Parameters ..
00084       COMPLEX*16         ONE, ZERO
00085       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ),
00086      $                   ZERO = ( 0.0D+0, 0.0D+0 ) )
00087 *     ..
00088 *     .. External Subroutines ..
00089       EXTERNAL           ZAXPY, ZCOPY, ZGEMV, ZGERC, ZGERU, ZLACGV
00090 *     ..
00091 *     .. External Functions ..
00092       LOGICAL            LSAME
00093       EXTERNAL           LSAME
00094 *     ..
00095 *     .. Executable Statements ..
00096 *
00097       IF( LSAME( SIDE, 'L' ) ) THEN
00098 *
00099 *        Form  H * C
00100 *
00101          IF( TAU.NE.ZERO ) THEN
00102 *
00103 *           w( 1:n ) = conjg( C( 1, 1:n ) )
00104 *
00105             CALL ZCOPY( N, C, LDC, WORK, 1 )
00106             CALL ZLACGV( N, WORK, 1 )
00107 *
00108 *           w( 1:n ) = conjg( w( 1:n ) + C( m-l+1:m, 1:n )' * v( 1:l ) )
00109 *
00110             CALL ZGEMV( 'Conjugate transpose', L, N, ONE, C( M-L+1, 1 ),
00111      $                  LDC, V, INCV, ONE, WORK, 1 )
00112             CALL ZLACGV( N, WORK, 1 )
00113 *
00114 *           C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n )
00115 *
00116             CALL ZAXPY( N, -TAU, WORK, 1, C, LDC )
00117 *
00118 *           C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
00119 *                               tau * v( 1:l ) * conjg( w( 1:n )' )
00120 *
00121             CALL ZGERU( L, N, -TAU, V, INCV, WORK, 1, C( M-L+1, 1 ),
00122      $                  LDC )
00123          END IF
00124 *
00125       ELSE
00126 *
00127 *        Form  C * H
00128 *
00129          IF( TAU.NE.ZERO ) THEN
00130 *
00131 *           w( 1:m ) = C( 1:m, 1 )
00132 *
00133             CALL ZCOPY( M, C, 1, WORK, 1 )
00134 *
00135 *           w( 1:m ) = w( 1:m ) + C( 1:m, n-l+1:n, 1:n ) * v( 1:l )
00136 *
00137             CALL ZGEMV( 'No transpose', M, L, ONE, C( 1, N-L+1 ), LDC,
00138      $                  V, INCV, ONE, WORK, 1 )
00139 *
00140 *           C( 1:m, 1 ) = C( 1:m, 1 ) - tau * w( 1:m )
00141 *
00142             CALL ZAXPY( M, -TAU, WORK, 1, C, 1 )
00143 *
00144 *           C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
00145 *                               tau * w( 1:m ) * v( 1:l )'
00146 *
00147             CALL ZGERC( M, L, -TAU, WORK, 1, V, INCV, C( 1, N-L+1 ),
00148      $                  LDC )
00149 *
00150          END IF
00151 *
00152       END IF
00153 *
00154       RETURN
00155 *
00156 *     End of ZLARZ
00157 *
00158       END
 All Files Functions