LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ ztpt01()

subroutine ztpt01 ( character  uplo,
character  diag,
integer  n,
complex*16, dimension( * )  ap,
complex*16, dimension( * )  ainvp,
double precision  rcond,
double precision, dimension( * )  rwork,
double precision  resid 
)

ZTPT01

Purpose:
 ZTPT01 computes the residual for a triangular matrix A times its
 inverse when A is stored in packed format:
    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]AP
          AP is COMPLEX*16 array, dimension (N*(N+1)/2)
          The original upper or lower triangular matrix A, packed
          columnwise in a linear array.  The j-th column of A is stored
          in the array AP as follows:
          if UPLO = 'U', AP((j-1)*j/2 + i) = A(i,j) for 1<=i<=j;
          if UPLO = 'L',
             AP((j-1)*(n-j) + j*(j+1)/2 + i-j) = A(i,j) for j<=i<=n.
[in]AINVP
          AINVP is COMPLEX*16 array, dimension (N*(N+1)/2)
          On entry, the (triangular) inverse of the matrix A, packed
          columnwise in a linear array as in AP.
          On exit, the contents of AINVP are destroyed.
[out]RCOND
          RCOND is DOUBLE PRECISION
          The reciprocal condition number of A, computed as
          1/(norm(A) * norm(AINV)).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          norm(A*AINV - I) / ( N * norm(A) * norm(AINV) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 108 of file ztpt01.f.

109*
110* -- LAPACK test routine --
111* -- LAPACK is a software package provided by Univ. of Tennessee, --
112* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
113*
114* .. Scalar Arguments ..
115 CHARACTER DIAG, UPLO
116 INTEGER N
117 DOUBLE PRECISION RCOND, RESID
118* ..
119* .. Array Arguments ..
120 DOUBLE PRECISION RWORK( * )
121 COMPLEX*16 AINVP( * ), AP( * )
122* ..
123*
124* =====================================================================
125*
126* .. Parameters ..
127 DOUBLE PRECISION ZERO, ONE
128 parameter( zero = 0.0d+0, one = 1.0d+0 )
129* ..
130* .. Local Scalars ..
131 LOGICAL UNITD
132 INTEGER J, JC
133 DOUBLE PRECISION AINVNM, ANORM, EPS
134* ..
135* .. External Functions ..
136 LOGICAL LSAME
137 DOUBLE PRECISION DLAMCH, ZLANTP
138 EXTERNAL lsame, dlamch, zlantp
139* ..
140* .. External Subroutines ..
141 EXTERNAL ztpmv
142* ..
143* .. Intrinsic Functions ..
144 INTRINSIC dble
145* ..
146* .. Executable Statements ..
147*
148* Quick exit if N = 0.
149*
150 IF( n.LE.0 ) THEN
151 rcond = one
152 resid = zero
153 RETURN
154 END IF
155*
156* Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
157*
158 eps = dlamch( 'Epsilon' )
159 anorm = zlantp( '1', uplo, diag, n, ap, rwork )
160 ainvnm = zlantp( '1', uplo, diag, n, ainvp, rwork )
161 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
162 rcond = zero
163 resid = one / eps
164 RETURN
165 END IF
166 rcond = ( one / anorm ) / ainvnm
167*
168* Compute A * AINV, overwriting AINV.
169*
170 unitd = lsame( diag, 'U' )
171 IF( lsame( uplo, 'U' ) ) THEN
172 jc = 1
173 DO 10 j = 1, n
174 IF( unitd )
175 $ ainvp( jc+j-1 ) = one
176*
177* Form the j-th column of A*AINV.
178*
179 CALL ztpmv( 'Upper', 'No transpose', diag, j, ap,
180 $ ainvp( jc ), 1 )
181*
182* Subtract 1 from the diagonal to form A*AINV - I.
183*
184 ainvp( jc+j-1 ) = ainvp( jc+j-1 ) - one
185 jc = jc + j
186 10 CONTINUE
187 ELSE
188 jc = 1
189 DO 20 j = 1, n
190 IF( unitd )
191 $ ainvp( jc ) = one
192*
193* Form the j-th column of A*AINV.
194*
195 CALL ztpmv( 'Lower', 'No transpose', diag, n-j+1, ap( jc ),
196 $ ainvp( jc ), 1 )
197*
198* Subtract 1 from the diagonal to form A*AINV - I.
199*
200 ainvp( jc ) = ainvp( jc ) - one
201 jc = jc + n - j + 1
202 20 CONTINUE
203 END IF
204*
205* Compute norm(A*AINV - I) / (N * norm(A) * norm(AINV) * EPS)
206*
207 resid = zlantp( '1', uplo, 'Non-unit', n, ainvp, rwork )
208*
209 resid = ( ( resid*rcond ) / dble( n ) ) / eps
210*
211 RETURN
212*
213* End of ZTPT01
214*
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function zlantp(norm, uplo, diag, n, ap, work)
ZLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlantp.f:125
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine ztpmv(uplo, trans, diag, n, ap, x, incx)
ZTPMV
Definition ztpmv.f:142
Here is the call graph for this function:
Here is the caller graph for this function: