LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ ctrt01()

 subroutine ctrt01 ( character UPLO, character DIAG, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldainv, * ) AINV, integer LDAINV, real RCOND, real, dimension( * ) RWORK, real RESID )

CTRT01

Purpose:
``` CTRT01 computes the residual for a triangular matrix A times its
inverse:
RESID = norm( A*AINV - I ) / ( N * norm(A) * norm(AINV) * EPS ),
where EPS is the machine epsilon.```
Parameters
 [in] UPLO ``` UPLO is CHARACTER*1 Specifies whether the matrix A is upper or lower triangular. = 'U': Upper triangular = 'L': Lower triangular``` [in] DIAG ``` DIAG is CHARACTER*1 Specifies whether or not the matrix A is unit triangular. = 'N': Non-unit triangular = 'U': Unit triangular``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] A ``` A is COMPLEX array, dimension (LDA,N) The triangular matrix A. If UPLO = 'U', the leading n by n upper triangular part of the array A contains the upper triangular matrix, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading n by n lower triangular part of the array A contains the lower triangular matrix, and the strictly upper triangular part of A is not referenced. If DIAG = 'U', the diagonal elements of A are also not referenced and are assumed to be 1.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).``` [in] AINV ``` AINV is COMPLEX array, dimension (LDAINV,N) On entry, the (triangular) inverse of the matrix A, in the same storage format as A. On exit, the contents of AINV are destroyed.``` [in] LDAINV ``` LDAINV is INTEGER The leading dimension of the array AINV. LDAINV >= max(1,N).``` [out] RCOND ``` RCOND is REAL The reciprocal condition number of A, computed as 1/(norm(A) * norm(AINV)).``` [out] RWORK ` RWORK is REAL array, dimension (N)` [out] RESID ``` RESID is REAL norm(A*AINV - I) / ( N * norm(A) * norm(AINV) * EPS )```
Date
December 2016

Definition at line 127 of file ctrt01.f.

127 *
128 * -- LAPACK test routine (version 3.7.0) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * December 2016
132 *
133 * .. Scalar Arguments ..
134  CHARACTER diag, uplo
135  INTEGER lda, ldainv, n
136  REAL rcond, resid
137 * ..
138 * .. Array Arguments ..
139  REAL rwork( * )
140  COMPLEX a( lda, * ), ainv( ldainv, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL zero, one
147  parameter( zero = 0.0e+0, one = 1.0e+0 )
148 * ..
149 * .. Local Scalars ..
150  INTEGER j
151  REAL ainvnm, anorm, eps
152 * ..
153 * .. External Functions ..
154  LOGICAL lsame
155  REAL clantr, slamch
156  EXTERNAL lsame, clantr, slamch
157 * ..
158 * .. External Subroutines ..
159  EXTERNAL ctrmv
160 * ..
161 * .. Intrinsic Functions ..
162  INTRINSIC real
163 * ..
164 * .. Executable Statements ..
165 *
166 * Quick exit if N = 0
167 *
168  IF( n.LE.0 ) THEN
169  rcond = one
170  resid = zero
171  RETURN
172  END IF
173 *
174 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
175 *
176  eps = slamch( 'Epsilon' )
177  anorm = clantr( '1', uplo, diag, n, n, a, lda, rwork )
178  ainvnm = clantr( '1', uplo, diag, n, n, ainv, ldainv, rwork )
179  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
180  rcond = zero
181  resid = one / eps
182  RETURN
183  END IF
184  rcond = ( one / anorm ) / ainvnm
185 *
186 * Set the diagonal of AINV to 1 if AINV has unit diagonal.
187 *
188  IF( lsame( diag, 'U' ) ) THEN
189  DO 10 j = 1, n
190  ainv( j, j ) = one
191  10 CONTINUE
192  END IF
193 *
194 * Compute A * AINV, overwriting AINV.
195 *
196  IF( lsame( uplo, 'U' ) ) THEN
197  DO 20 j = 1, n
198  CALL ctrmv( 'Upper', 'No transpose', diag, j, a, lda,
199  \$ ainv( 1, j ), 1 )
200  20 CONTINUE
201  ELSE
202  DO 30 j = 1, n
203  CALL ctrmv( 'Lower', 'No transpose', diag, n-j+1, a( j, j ),
204  \$ lda, ainv( j, j ), 1 )
205  30 CONTINUE
206  END IF
207 *
208 * Subtract 1 from each diagonal element to form A*AINV - I.
209 *
210  DO 40 j = 1, n
211  ainv( j, j ) = ainv( j, j ) - one
212  40 CONTINUE
213 *
214 * Compute norm(A*AINV - I) / (N * norm(A) * norm(AINV) * EPS)
215 *
216  resid = clantr( '1', uplo, 'Non-unit', n, n, ainv, ldainv, rwork )
217 *
218  resid = ( ( resid*rcond ) / REAL( N ) ) / eps
219 *
220  RETURN
221 *
222 * End of CTRT01
223 *
real function clantr(NORM, UPLO, DIAG, M, N, A, LDA, WORK)
CLANTR returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a trapezoidal or triangular matrix.
Definition: clantr.f:144
subroutine ctrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
CTRMV
Definition: ctrmv.f:149
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
Here is the call graph for this function:
Here is the caller graph for this function: