LAPACK 3.3.0

zlatrz.f

Go to the documentation of this file.
00001       SUBROUTINE ZLATRZ( M, N, L, A, LDA, TAU, WORK )
00002 *
00003 *  -- LAPACK routine (version 3.2.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 *     June 2010
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            L, LDA, M, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       COMPLEX*16         A( LDA, * ), TAU( * ), WORK( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  ZLATRZ factors the M-by-(M+L) complex upper trapezoidal matrix
00019 *  [ A1 A2 ] = [ A(1:M,1:M) A(1:M,N-L+1:N) ] as ( R  0 ) * Z by means
00020 *  of unitary transformations, where  Z is an (M+L)-by-(M+L) unitary
00021 *  matrix and, R and A1 are M-by-M upper triangular matrices.
00022 *
00023 *  Arguments
00024 *  =========
00025 *
00026 *  M       (input) INTEGER
00027 *          The number of rows of the matrix A.  M >= 0.
00028 *
00029 *  N       (input) INTEGER
00030 *          The number of columns of the matrix A.  N >= 0.
00031 *
00032 *  L       (input) INTEGER
00033 *          The number of columns of the matrix A containing the
00034 *          meaningful part of the Householder vectors. N-M >= L >= 0.
00035 *
00036 *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
00037 *          On entry, the leading M-by-N upper trapezoidal part of the
00038 *          array A must contain the matrix to be factorized.
00039 *          On exit, the leading M-by-M upper triangular part of A
00040 *          contains the upper triangular matrix R, and elements N-L+1 to
00041 *          N of the first M rows of A, with the array TAU, represent the
00042 *          unitary matrix Z as a product of M elementary reflectors.
00043 *
00044 *  LDA     (input) INTEGER
00045 *          The leading dimension of the array A.  LDA >= max(1,M).
00046 *
00047 *  TAU     (output) COMPLEX*16 array, dimension (M)
00048 *          The scalar factors of the elementary reflectors.
00049 *
00050 *  WORK    (workspace) COMPLEX*16 array, dimension (M)
00051 *
00052 *  Further Details
00053 *  ===============
00054 *
00055 *  Based on contributions by
00056 *    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
00057 *
00058 *  The factorization is obtained by Householder's method.  The kth
00059 *  transformation matrix, Z( k ), which is used to introduce zeros into
00060 *  the ( m - k + 1 )th row of A, is given in the form
00061 *
00062 *     Z( k ) = ( I     0   ),
00063 *              ( 0  T( k ) )
00064 *
00065 *  where
00066 *
00067 *     T( k ) = I - tau*u( k )*u( k )',   u( k ) = (   1    ),
00068 *                                                 (   0    )
00069 *                                                 ( z( k ) )
00070 *
00071 *  tau is a scalar and z( k ) is an l element vector. tau and z( k )
00072 *  are chosen to annihilate the elements of the kth row of A2.
00073 *
00074 *  The scalar tau is returned in the kth element of TAU and the vector
00075 *  u( k ) in the kth row of A2, such that the elements of z( k ) are
00076 *  in  a( k, l + 1 ), ..., a( k, n ). The elements of R are returned in
00077 *  the upper triangular part of A1.
00078 *
00079 *  Z is given by
00080 *
00081 *     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ).
00082 *
00083 *  =====================================================================
00084 *
00085 *     .. Parameters ..
00086       COMPLEX*16         ZERO
00087       PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ) )
00088 *     ..
00089 *     .. Local Scalars ..
00090       INTEGER            I
00091       COMPLEX*16         ALPHA
00092 *     ..
00093 *     .. External Subroutines ..
00094       EXTERNAL           ZLACGV, ZLARFG, ZLARZ
00095 *     ..
00096 *     .. Intrinsic Functions ..
00097       INTRINSIC          DCONJG
00098 *     ..
00099 *     .. Executable Statements ..
00100 *
00101 *     Quick return if possible
00102 *
00103       IF( M.EQ.0 ) THEN
00104          RETURN
00105       ELSE IF( M.EQ.N ) THEN
00106          DO 10 I = 1, N
00107             TAU( I ) = ZERO
00108    10    CONTINUE
00109          RETURN
00110       END IF
00111 *
00112       DO 20 I = M, 1, -1
00113 *
00114 *        Generate elementary reflector H(i) to annihilate
00115 *        [ A(i,i) A(i,n-l+1:n) ]
00116 *
00117          CALL ZLACGV( L, A( I, N-L+1 ), LDA )
00118          ALPHA = DCONJG( A( I, I ) )
00119          CALL ZLARFG( L+1, ALPHA, A( I, N-L+1 ), LDA, TAU( I ) )
00120          TAU( I ) = DCONJG( TAU( I ) )
00121 *
00122 *        Apply H(i) to A(1:i-1,i:n) from the right
00123 *
00124          CALL ZLARZ( 'Right', I-1, N-I+1, L, A( I, N-L+1 ), LDA,
00125      $               DCONJG( TAU( I ) ), A( 1, I ), LDA, WORK )
00126          A( I, I ) = DCONJG( ALPHA )
00127 *
00128    20 CONTINUE
00129 *
00130       RETURN
00131 *
00132 *     End of ZLATRZ
00133 *
00134       END
 All Files Functions