LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine zget01 ( integer  M,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldafac, * )  AFAC,
integer  LDAFAC,
integer, dimension( * )  IPIV,
double precision, dimension( * )  RWORK,
double precision  RESID 
)

ZGET01

Purpose:
 ZGET01 reconstructs a matrix A from its L*U factorization and
 computes the residual
    norm(L*U - A) / ( N * norm(A) * EPS ),
 where EPS is the machine epsilon.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The original M x N matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,M).
[in,out]AFAC
          AFAC is COMPLEX*16 array, dimension (LDAFAC,N)
          The factored form of the matrix A.  AFAC contains the factors
          L and U from the L*U factorization as computed by ZGETRF.
          Overwritten with the reconstructed matrix, and then with the
          difference L*U - A.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.  LDAFAC >= max(1,M).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from ZGETRF.
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (M)
[out]RESID
          RESID is DOUBLE PRECISION
          norm(L*U - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 110 of file zget01.f.

110 *
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..--
114 * November 2011
115 *
116 * .. Scalar Arguments ..
117  INTEGER lda, ldafac, m, n
118  DOUBLE PRECISION resid
119 * ..
120 * .. Array Arguments ..
121  INTEGER ipiv( * )
122  DOUBLE PRECISION rwork( * )
123  COMPLEX*16 a( lda, * ), afac( ldafac, * )
124 * ..
125 *
126 * =====================================================================
127 *
128 * .. Parameters ..
129  DOUBLE PRECISION zero, one
130  parameter ( zero = 0.0d+0, one = 1.0d+0 )
131  COMPLEX*16 cone
132  parameter ( cone = ( 1.0d+0, 0.0d+0 ) )
133 * ..
134 * .. Local Scalars ..
135  INTEGER i, j, k
136  DOUBLE PRECISION anorm, eps
137  COMPLEX*16 t
138 * ..
139 * .. External Functions ..
140  DOUBLE PRECISION dlamch, zlange
141  COMPLEX*16 zdotu
142  EXTERNAL dlamch, zlange, zdotu
143 * ..
144 * .. External Subroutines ..
145  EXTERNAL zgemv, zlaswp, zscal, ztrmv
146 * ..
147 * .. Intrinsic Functions ..
148  INTRINSIC dble, min
149 * ..
150 * .. Executable Statements ..
151 *
152 * Quick exit if M = 0 or N = 0.
153 *
154  IF( m.LE.0 .OR. n.LE.0 ) THEN
155  resid = zero
156  RETURN
157  END IF
158 *
159 * Determine EPS and the norm of A.
160 *
161  eps = dlamch( 'Epsilon' )
162  anorm = zlange( '1', m, n, a, lda, rwork )
163 *
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
166 * column N.
167 *
168  DO 10 k = n, 1, -1
169  IF( k.GT.m ) THEN
170  CALL ztrmv( 'Lower', 'No transpose', 'Unit', m, afac,
171  $ ldafac, afac( 1, k ), 1 )
172  ELSE
173 *
174 * Compute elements (K+1:M,K)
175 *
176  t = afac( k, k )
177  IF( k+1.LE.m ) THEN
178  CALL zscal( m-k, t, afac( k+1, k ), 1 )
179  CALL zgemv( 'No transpose', m-k, k-1, cone,
180  $ afac( k+1, 1 ), ldafac, afac( 1, k ), 1,
181  $ cone, afac( k+1, k ), 1 )
182  END IF
183 *
184 * Compute the (K,K) element
185 *
186  afac( k, k ) = t + zdotu( k-1, afac( k, 1 ), ldafac,
187  $ afac( 1, k ), 1 )
188 *
189 * Compute elements (1:K-1,K)
190 *
191  CALL ztrmv( 'Lower', 'No transpose', 'Unit', k-1, afac,
192  $ ldafac, afac( 1, k ), 1 )
193  END IF
194  10 CONTINUE
195  CALL zlaswp( n, afac, ldafac, 1, min( m, n ), ipiv, -1 )
196 *
197 * Compute the difference L*U - A and store in AFAC.
198 *
199  DO 30 j = 1, n
200  DO 20 i = 1, m
201  afac( i, j ) = afac( i, j ) - a( i, j )
202  20 CONTINUE
203  30 CONTINUE
204 *
205 * Compute norm( L*U - A ) / ( N * norm(A) * EPS )
206 *
207  resid = zlange( '1', m, n, afac, ldafac, rwork )
208 *
209  IF( anorm.LE.zero ) THEN
210  IF( resid.NE.zero )
211  $ resid = one / eps
212  ELSE
213  resid = ( ( resid / dble( n ) ) / anorm ) / eps
214  END IF
215 *
216  RETURN
217 *
218 * End of ZGET01
219 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zlaswp(N, A, LDA, K1, K2, IPIV, INCX)
ZLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: zlaswp.f:116
subroutine zgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
ZGEMV
Definition: zgemv.f:160
complex *16 function zdotu(N, ZX, INCX, ZY, INCY)
ZDOTU
Definition: zdotu.f:54
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:117
subroutine ztrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
ZTRMV
Definition: ztrmv.f:149
subroutine zscal(N, ZA, ZX, INCX)
ZSCAL
Definition: zscal.f:54

Here is the call graph for this function:

Here is the caller graph for this function: