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

DTPT01

Purpose:
 DTPT01 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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]WORK
          WORK 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
November 2011

Definition at line 110 of file dtpt01.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  DOUBLE PRECISION rcond, resid
120 * ..
121 * .. Array Arguments ..
122  DOUBLE PRECISION ainvp( * ), ap( * ), work( * )
123 * ..
124 *
125 * =====================================================================
126 *
127 * .. Parameters ..
128  DOUBLE PRECISION zero, one
129  parameter ( zero = 0.0d+0, one = 1.0d+0 )
130 * ..
131 * .. Local Scalars ..
132  LOGICAL unitd
133  INTEGER j, jc
134  DOUBLE PRECISION ainvnm, anorm, eps
135 * ..
136 * .. External Functions ..
137  LOGICAL lsame
138  DOUBLE PRECISION dlamch, dlantp
139  EXTERNAL lsame, dlamch, dlantp
140 * ..
141 * .. External Subroutines ..
142  EXTERNAL dtpmv
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC dble
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 = dlamch( 'Epsilon' )
160  anorm = dlantp( '1', uplo, diag, n, ap, work )
161  ainvnm = dlantp( '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 dtpmv( '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 dtpmv( '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 = dlantp( '1', uplo, 'Non-unit', n, ainvp, work )
209 *
210  resid = ( ( resid*rcond ) / dble( n ) ) / eps
211 *
212  RETURN
213 *
214 * End of DTPT01
215 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
double precision function dlantp(NORM, UPLO, DIAG, N, AP, WORK)
DLANTP 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: dlantp.f:126
subroutine dtpmv(UPLO, TRANS, DIAG, N, AP, X, INCX)
DTPMV
Definition: dtpmv.f:144
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: