LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dlqt02.f
Go to the documentation of this file.
00001 *> \brief \b DLQT02
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       SUBROUTINE DLQT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
00012 *                          RWORK, RESULT )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       INTEGER            K, LDA, LWORK, M, N
00016 *       ..
00017 *       .. Array Arguments ..
00018 *       DOUBLE PRECISION   A( LDA, * ), AF( LDA, * ), L( LDA, * ),
00019 *      $                   Q( LDA, * ), RESULT( * ), RWORK( * ), TAU( * ),
00020 *      $                   WORK( LWORK )
00021 *       ..
00022 *  
00023 *
00024 *> \par Purpose:
00025 *  =============
00026 *>
00027 *> \verbatim
00028 *>
00029 *> DLQT02 tests DORGLQ, which generates an m-by-n matrix Q with
00030 *> orthonornmal rows that is defined as the product of k elementary
00031 *> reflectors.
00032 *>
00033 *> Given the LQ factorization of an m-by-n matrix A, DLQT02 generates
00034 *> the orthogonal matrix Q defined by the factorization of the first k
00035 *> rows of A; it compares L(1:k,1:m) with A(1:k,1:n)*Q(1:m,1:n)', and
00036 *> checks that the rows of Q are orthonormal.
00037 *> \endverbatim
00038 *
00039 *  Arguments:
00040 *  ==========
00041 *
00042 *> \param[in] M
00043 *> \verbatim
00044 *>          M is INTEGER
00045 *>          The number of rows of the matrix Q to be generated.  M >= 0.
00046 *> \endverbatim
00047 *>
00048 *> \param[in] N
00049 *> \verbatim
00050 *>          N is INTEGER
00051 *>          The number of columns of the matrix Q to be generated.
00052 *>          N >= M >= 0.
00053 *> \endverbatim
00054 *>
00055 *> \param[in] K
00056 *> \verbatim
00057 *>          K is INTEGER
00058 *>          The number of elementary reflectors whose product defines the
00059 *>          matrix Q. M >= K >= 0.
00060 *> \endverbatim
00061 *>
00062 *> \param[in] A
00063 *> \verbatim
00064 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00065 *>          The m-by-n matrix A which was factorized by DLQT01.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] AF
00069 *> \verbatim
00070 *>          AF is DOUBLE PRECISION array, dimension (LDA,N)
00071 *>          Details of the LQ factorization of A, as returned by DGELQF.
00072 *>          See DGELQF for further details.
00073 *> \endverbatim
00074 *>
00075 *> \param[out] Q
00076 *> \verbatim
00077 *>          Q is DOUBLE PRECISION array, dimension (LDA,N)
00078 *> \endverbatim
00079 *>
00080 *> \param[out] L
00081 *> \verbatim
00082 *>          L is DOUBLE PRECISION array, dimension (LDA,M)
00083 *> \endverbatim
00084 *>
00085 *> \param[in] LDA
00086 *> \verbatim
00087 *>          LDA is INTEGER
00088 *>          The leading dimension of the arrays A, AF, Q and L. LDA >= N.
00089 *> \endverbatim
00090 *>
00091 *> \param[in] TAU
00092 *> \verbatim
00093 *>          TAU is DOUBLE PRECISION array, dimension (M)
00094 *>          The scalar factors of the elementary reflectors corresponding
00095 *>          to the LQ factorization in AF.
00096 *> \endverbatim
00097 *>
00098 *> \param[out] WORK
00099 *> \verbatim
00100 *>          WORK is DOUBLE PRECISION array, dimension (LWORK)
00101 *> \endverbatim
00102 *>
00103 *> \param[in] LWORK
00104 *> \verbatim
00105 *>          LWORK is INTEGER
00106 *>          The dimension of the array WORK.
00107 *> \endverbatim
00108 *>
00109 *> \param[out] RWORK
00110 *> \verbatim
00111 *>          RWORK is DOUBLE PRECISION array, dimension (M)
00112 *> \endverbatim
00113 *>
00114 *> \param[out] RESULT
00115 *> \verbatim
00116 *>          RESULT is DOUBLE PRECISION array, dimension (2)
00117 *>          The test ratios:
00118 *>          RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
00119 *>          RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
00120 *> \endverbatim
00121 *
00122 *  Authors:
00123 *  ========
00124 *
00125 *> \author Univ. of Tennessee 
00126 *> \author Univ. of California Berkeley 
00127 *> \author Univ. of Colorado Denver 
00128 *> \author NAG Ltd. 
00129 *
00130 *> \date November 2011
00131 *
00132 *> \ingroup double_lin
00133 *
00134 *  =====================================================================
00135       SUBROUTINE DLQT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
00136      $                   RWORK, RESULT )
00137 *
00138 *  -- LAPACK test routine (version 3.4.0) --
00139 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00140 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00141 *     November 2011
00142 *
00143 *     .. Scalar Arguments ..
00144       INTEGER            K, LDA, LWORK, M, N
00145 *     ..
00146 *     .. Array Arguments ..
00147       DOUBLE PRECISION   A( LDA, * ), AF( LDA, * ), L( LDA, * ),
00148      $                   Q( LDA, * ), RESULT( * ), RWORK( * ), TAU( * ),
00149      $                   WORK( LWORK )
00150 *     ..
00151 *
00152 *  =====================================================================
00153 *
00154 *     .. Parameters ..
00155       DOUBLE PRECISION   ZERO, ONE
00156       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00157       DOUBLE PRECISION   ROGUE
00158       PARAMETER          ( ROGUE = -1.0D+10 )
00159 *     ..
00160 *     .. Local Scalars ..
00161       INTEGER            INFO
00162       DOUBLE PRECISION   ANORM, EPS, RESID
00163 *     ..
00164 *     .. External Functions ..
00165       DOUBLE PRECISION   DLAMCH, DLANGE, DLANSY
00166       EXTERNAL           DLAMCH, DLANGE, DLANSY
00167 *     ..
00168 *     .. External Subroutines ..
00169       EXTERNAL           DGEMM, DLACPY, DLASET, DORGLQ, DSYRK
00170 *     ..
00171 *     .. Intrinsic Functions ..
00172       INTRINSIC          DBLE, MAX
00173 *     ..
00174 *     .. Scalars in Common ..
00175       CHARACTER*32       SRNAMT
00176 *     ..
00177 *     .. Common blocks ..
00178       COMMON             / SRNAMC / SRNAMT
00179 *     ..
00180 *     .. Executable Statements ..
00181 *
00182       EPS = DLAMCH( 'Epsilon' )
00183 *
00184 *     Copy the first k rows of the factorization to the array Q
00185 *
00186       CALL DLASET( 'Full', M, N, ROGUE, ROGUE, Q, LDA )
00187       CALL DLACPY( 'Upper', K, N-1, AF( 1, 2 ), LDA, Q( 1, 2 ), LDA )
00188 *
00189 *     Generate the first n columns of the matrix Q
00190 *
00191       SRNAMT = 'DORGLQ'
00192       CALL DORGLQ( M, N, K, Q, LDA, TAU, WORK, LWORK, INFO )
00193 *
00194 *     Copy L(1:k,1:m)
00195 *
00196       CALL DLASET( 'Full', K, M, ZERO, ZERO, L, LDA )
00197       CALL DLACPY( 'Lower', K, M, AF, LDA, L, LDA )
00198 *
00199 *     Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
00200 *
00201       CALL DGEMM( 'No transpose', 'Transpose', K, M, N, -ONE, A, LDA, Q,
00202      $            LDA, ONE, L, LDA )
00203 *
00204 *     Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
00205 *
00206       ANORM = DLANGE( '1', K, N, A, LDA, RWORK )
00207       RESID = DLANGE( '1', K, M, L, LDA, RWORK )
00208       IF( ANORM.GT.ZERO ) THEN
00209          RESULT( 1 ) = ( ( RESID / DBLE( MAX( 1, N ) ) ) / ANORM ) / EPS
00210       ELSE
00211          RESULT( 1 ) = ZERO
00212       END IF
00213 *
00214 *     Compute I - Q*Q'
00215 *
00216       CALL DLASET( 'Full', M, M, ZERO, ONE, L, LDA )
00217       CALL DSYRK( 'Upper', 'No transpose', M, N, -ONE, Q, LDA, ONE, L,
00218      $            LDA )
00219 *
00220 *     Compute norm( I - Q*Q' ) / ( N * EPS ) .
00221 *
00222       RESID = DLANSY( '1', 'Upper', M, L, LDA, RWORK )
00223 *
00224       RESULT( 2 ) = ( RESID / DBLE( MAX( 1, N ) ) ) / EPS
00225 *
00226       RETURN
00227 *
00228 *     End of DLQT02
00229 *
00230       END
 All Files Functions