LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine stpt01 ( character  UPLO,
character  DIAG,
integer  N,
real, dimension( * )  AP,
real, dimension( * )  AINVP,
real  RCOND,
real, dimension( * )  WORK,
real  RESID 
)

STPT01

Purpose:
 STPT01 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 REAL 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,out]AINVP
          AINVP is REAL 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]WORK
          WORK 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.
Date
November 2011

Definition at line 110 of file stpt01.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  CHARACTER diag, uplo
118  INTEGER n
119  REAL rcond, resid
120 * ..
121 * .. Array Arguments ..
122  REAL ainvp( * ), ap( * ), work( * )
123 * ..
124 *
125 * =====================================================================
126 *
127 * .. Parameters ..
128  REAL zero, one
129  parameter ( zero = 0.0e+0, one = 1.0e+0 )
130 * ..
131 * .. Local Scalars ..
132  LOGICAL unitd
133  INTEGER j, jc
134  REAL ainvnm, anorm, eps
135 * ..
136 * .. External Functions ..
137  LOGICAL lsame
138  REAL slamch, slantp
139  EXTERNAL lsame, slamch, slantp
140 * ..
141 * .. External Subroutines ..
142  EXTERNAL stpmv
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC real
146 * ..
147 * .. Executable Statements ..
148 *
149 * Quick exit if N = 0.
150 *
151  IF( n.LE.0 ) THEN
152  rcond = one
153  resid = zero
154  RETURN
155  END IF
156 *
157 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
158 *
159  eps = slamch( 'Epsilon' )
160  anorm = slantp( '1', uplo, diag, n, ap, work )
161  ainvnm = slantp( '1', uplo, diag, n, ainvp, work )
162  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
163  rcond = zero
164  resid = one / eps
165  RETURN
166  END IF
167  rcond = ( one / anorm ) / ainvnm
168 *
169 * Compute A * AINV, overwriting AINV.
170 *
171  unitd = lsame( diag, 'U' )
172  IF( lsame( uplo, 'U' ) ) THEN
173  jc = 1
174  DO 10 j = 1, n
175  IF( unitd )
176  $ ainvp( jc+j-1 ) = one
177 *
178 * Form the j-th column of A*AINV
179 *
180  CALL stpmv( 'Upper', 'No transpose', diag, j, ap,
181  $ ainvp( jc ), 1 )
182 *
183 * Subtract 1 from the diagonal
184 *
185  ainvp( jc+j-1 ) = ainvp( jc+j-1 ) - one
186  jc = jc + j
187  10 CONTINUE
188  ELSE
189  jc = 1
190  DO 20 j = 1, n
191  IF( unitd )
192  $ ainvp( jc ) = one
193 *
194 * Form the j-th column of A*AINV
195 *
196  CALL stpmv( 'Lower', 'No transpose', diag, n-j+1, ap( jc ),
197  $ ainvp( jc ), 1 )
198 *
199 * Subtract 1 from the diagonal
200 *
201  ainvp( jc ) = ainvp( jc ) - one
202  jc = jc + n - j + 1
203  20 CONTINUE
204  END IF
205 *
206 * Compute norm(A*AINV - I) / (N * norm(A) * norm(AINV) * EPS)
207 *
208  resid = slantp( '1', uplo, 'Non-unit', n, ainvp, work )
209 *
210  resid = ( ( resid*rcond ) / REAL( N ) ) / eps
211 *
212  RETURN
213 *
214 * End of STPT01
215 *
subroutine stpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
STPMV
Definition: stpmv.f:144
real function slantp(NORM, UPLO, DIAG, N, AP, WORK)
SLANTP 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: slantp.f:126
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: