LAPACK 3.3.0

clarz.f

Go to the documentation of this file.
00001       SUBROUTINE CLARZ( 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            TAU
00012 *     ..
00013 *     .. Array Arguments ..
00014       COMPLEX            C( LDC, * ), V( * ), WORK( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  CLARZ 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 CTZRZF.
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 array, dimension (1+(L-1)*abs(INCV))
00054 *          The vector v in the representation of H as returned by
00055 *          CTZRZF. 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
00061 *          The value tau in the representation of H.
00062 *
00063 *  C       (input/output) COMPLEX 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 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            ONE, ZERO
00085       PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ),
00086      $                   ZERO = ( 0.0E+0, 0.0E+0 ) )
00087 *     ..
00088 *     .. External Subroutines ..
00089       EXTERNAL           CAXPY, CCOPY, CGEMV, CGERC, CGERU, CLACGV
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 CCOPY( N, C, LDC, WORK, 1 )
00106             CALL CLACGV( 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 CGEMV( 'Conjugate transpose', L, N, ONE, C( M-L+1, 1 ),
00111      $                  LDC, V, INCV, ONE, WORK, 1 )
00112             CALL CLACGV( N, WORK, 1 )
00113 *
00114 *           C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n )
00115 *
00116             CALL CAXPY( 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 CGERU( 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 CCOPY( 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 CGEMV( '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 CAXPY( 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 CGERC( 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 CLARZ
00157 *
00158       END
 All Files Functions