LAPACK 3.3.1
Linear Algebra PACKage

slatrz.f

Go to the documentation of this file.
00001       SUBROUTINE SLATRZ( M, N, L, A, LDA, TAU, WORK )
00002 *
00003 *  -- LAPACK routine (version 3.3.1) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *  -- April 2011                                                      --
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            L, LDA, M, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       REAL               A( LDA, * ), TAU( * ), WORK( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  SLATRZ factors the M-by-(M+L) real 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 orthogonal transformations.  Z is an (M+L)-by-(M+L) orthogonal
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) REAL 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 *          orthogonal 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) REAL array, dimension (M)
00048 *          The scalar factors of the elementary reflectors.
00049 *
00050 *  WORK    (workspace) REAL 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 )**T,   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       REAL               ZERO
00087       PARAMETER          ( ZERO = 0.0E+0 )
00088 *     ..
00089 *     .. Local Scalars ..
00090       INTEGER            I
00091 *     ..
00092 *     .. External Subroutines ..
00093       EXTERNAL           SLARFG, SLARZ
00094 *     ..
00095 *     .. Executable Statements ..
00096 *
00097 *     Test the input arguments
00098 *
00099 *     Quick return if possible
00100 *
00101       IF( M.EQ.0 ) THEN
00102          RETURN
00103       ELSE IF( M.EQ.N ) THEN
00104          DO 10 I = 1, N
00105             TAU( I ) = ZERO
00106    10    CONTINUE
00107          RETURN
00108       END IF
00109 *
00110       DO 20 I = M, 1, -1
00111 *
00112 *        Generate elementary reflector H(i) to annihilate
00113 *        [ A(i,i) A(i,n-l+1:n) ]
00114 *
00115          CALL SLARFG( L+1, A( I, I ), A( I, N-L+1 ), LDA, TAU( I ) )
00116 *
00117 *        Apply H(i) to A(1:i-1,i:n) from the right
00118 *
00119          CALL SLARZ( 'Right', I-1, N-I+1, L, A( I, N-L+1 ), LDA,
00120      $               TAU( I ), A( 1, I ), LDA, WORK )
00121 *
00122    20 CONTINUE
00123 *
00124       RETURN
00125 *
00126 *     End of SLATRZ
00127 *
00128       END
 All Files Functions