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