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