3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE CGET01( M, N, A, LDA, AFAC, LDAFAC, IPIV, RWORK,
14 * .. Scalar Arguments ..
15 * INTEGER LDA, LDAFAC, M, N
18 * .. Array Arguments ..
21 * COMPLEX A( LDA, * ), AFAC( LDAFAC, * )
30 *> CGET01 reconstructs a matrix A from its L*U factorization and
31 *> computes the residual
32 *> norm(L*U - A) / ( N * norm(A) * EPS ),
33 *> where EPS is the machine epsilon.
42 *> The number of rows of the matrix A. M >= 0.
48 *> The number of columns of the matrix A. N >= 0.
53 *> A is COMPLEX array, dimension (LDA,N)
54 *> The original M x N matrix A.
60 *> The leading dimension of the array A. LDA >= max(1,M).
63 *> \param[in,out] AFAC
65 *> AFAC is COMPLEX array, dimension (LDAFAC,N)
66 *> The factored form of the matrix A. AFAC contains the factors
67 *> L and U from the L*U factorization as computed by CGETRF.
68 *> Overwritten with the reconstructed matrix, and then with the
69 *> difference L*U - A.
75 *> The leading dimension of the array AFAC. LDAFAC >= max(1,M).
80 *> IPIV is INTEGER array, dimension (N)
81 *> The pivot indices from CGETRF.
86 *> RWORK is REAL array, dimension (M)
92 *> norm(L*U - A) / ( N * norm(A) * EPS )
98 *> \author Univ. of Tennessee
99 *> \author Univ. of California Berkeley
100 *> \author Univ. of Colorado Denver
103 *> \date November 2011
105 *> \ingroup complex_lin
107 * =====================================================================
108 SUBROUTINE CGET01( M, N, A, LDA, AFAC, LDAFAC, IPIV, RWORK,
111 * -- LAPACK test routine (version 3.4.0) --
112 * -- LAPACK is a software package provided by Univ. of Tennessee, --
113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * .. Scalar Arguments ..
117 INTEGER LDA, LDAFAC, M, N
120 * .. Array Arguments ..
123 COMPLEX A( LDA, * ), AFAC( LDAFAC, * )
126 * =====================================================================
130 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
132 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
134 * .. Local Scalars ..
139 * .. External Functions ..
142 EXTERNAL CLANGE, SLAMCH, CDOTU
144 * .. External Subroutines ..
145 EXTERNAL CGEMV, CLASWP, CSCAL, CTRMV
147 * .. Intrinsic Functions ..
150 * .. Executable Statements ..
152 * Quick exit if M = 0 or N = 0.
154 IF( M.LE.0 .OR. N.LE.0 ) THEN
159 * Determine EPS and the norm of A.
161 EPS = SLAMCH( 'Epsilon' )
162 ANORM = CLANGE( '1', M, N, A, LDA, RWORK )
164 * Compute the product L*U and overwrite AFAC with the result.
165 * A column at a time of the product is obtained, starting with
170 CALL CTRMV( 'Lower', 'No transpose', 'Unit', M, AFAC,
171 $ LDAFAC, AFAC( 1, K ), 1 )
174 * Compute elements (K+1:M,K)
178 CALL CSCAL( M-K, T, AFAC( K+1, K ), 1 )
179 CALL CGEMV( 'No transpose', M-K, K-1, CONE,
180 $ AFAC( K+1, 1 ), LDAFAC, AFAC( 1, K ), 1,
181 $ CONE, AFAC( K+1, K ), 1 )
184 * Compute the (K,K) element
186 AFAC( K, K ) = T + CDOTU( K-1, AFAC( K, 1 ), LDAFAC,
189 * Compute elements (1:K-1,K)
191 CALL CTRMV( 'Lower', 'No transpose', 'Unit', K-1, AFAC,
192 $ LDAFAC, AFAC( 1, K ), 1 )
195 CALL CLASWP( N, AFAC, LDAFAC, 1, MIN( M, N ), IPIV, -1 )
197 * Compute the difference L*U - A and store in AFAC.
201 AFAC( I, J ) = AFAC( I, J ) - A( I, J )
205 * Compute norm( L*U - A ) / ( N * norm(A) * EPS )
207 RESID = CLANGE( '1', M, N, AFAC, LDAFAC, RWORK )
209 IF( ANORM.LE.ZERO ) THEN
213 RESID = ( ( RESID/REAL( N ) )/ANORM ) / EPS