LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ ctpt01()

subroutine ctpt01 ( character  UPLO,
character  DIAG,
integer  N,
complex, dimension( * )  AP,
complex, dimension( * )  AINVP,
real  RCOND,
real, dimension( * )  RWORK,
real  RESID 
)

CTPT01

Purpose:
 CTPT01 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 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 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 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 )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 108 of file ctpt01.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  REAL RCOND, RESID
118 * ..
119 * .. Array Arguments ..
120  REAL RWORK( * )
121  COMPLEX AINVP( * ), AP( * )
122 * ..
123 *
124 * =====================================================================
125 *
126 * .. Parameters ..
127  REAL ZERO, ONE
128  parameter( zero = 0.0e+0, one = 1.0e+0 )
129 * ..
130 * .. Local Scalars ..
131  LOGICAL UNITD
132  INTEGER J, JC
133  REAL AINVNM, ANORM, EPS
134 * ..
135 * .. External Functions ..
136  LOGICAL LSAME
137  REAL CLANTP, SLAMCH
138  EXTERNAL lsame, clantp, slamch
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL ctpmv
142 * ..
143 * .. Intrinsic Functions ..
144  INTRINSIC real
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 = slamch( 'Epsilon' )
159  anorm = clantp( '1', uplo, diag, n, ap, rwork )
160  ainvnm = clantp( '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 ctpmv( '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 ctpmv( '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 = clantp( '1', uplo, 'Non-unit', n, ainvp, rwork )
208 *
209  resid = ( ( resid*rcond ) / real( n ) ) / eps
210 *
211  RETURN
212 *
213 * End of CTPT01
214 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine ctpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
CTPMV
Definition: ctpmv.f:142
real function clantp(NORM, UPLO, DIAG, N, AP, WORK)
CLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clantp.f:125
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: