LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 111 of file ztpt01.f.

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