LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cppt03()

subroutine cppt03 ( character  UPLO,
integer  N,
complex, dimension( * )  A,
complex, dimension( * )  AINV,
complex, dimension( ldwork, * )  WORK,
integer  LDWORK,
real, dimension( * )  RWORK,
real  RCOND,
real  RESID 
)

CPPT03

Purpose:
 CPPT03 computes the residual for a Hermitian packed matrix times its
 inverse:
    norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS ),
 where EPS is the machine epsilon.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          Hermitian matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The number of rows and columns of the matrix A.  N >= 0.
[in]A
          A is COMPLEX array, dimension (N*(N+1)/2)
          The original Hermitian matrix A, stored as a packed
          triangular matrix.
[in]AINV
          AINV is COMPLEX array, dimension (N*(N+1)/2)
          The (Hermitian) inverse of the matrix A, stored as a packed
          triangular matrix.
[out]WORK
          WORK is COMPLEX array, dimension (LDWORK,N)
[in]LDWORK
          LDWORK is INTEGER
          The leading dimension of the array WORK.  LDWORK >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RCOND
          RCOND is REAL
          The reciprocal of the condition number of A, computed as
          ( 1/norm(A) ) / norm(AINV).
[out]RESID
          RESID is REAL
          norm(I - A*AINV) / ( 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 112 of file cppt03.f.

112 *
113 * -- LAPACK test routine (version 3.7.0) --
114 * -- LAPACK is a software package provided by Univ. of Tennessee, --
115 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * December 2016
117 *
118 * .. Scalar Arguments ..
119  CHARACTER uplo
120  INTEGER ldwork, n
121  REAL rcond, resid
122 * ..
123 * .. Array Arguments ..
124  REAL rwork( * )
125  COMPLEX a( * ), ainv( * ), work( ldwork, * )
126 * ..
127 *
128 * =====================================================================
129 *
130 * .. Parameters ..
131  REAL zero, one
132  parameter( zero = 0.0e+0, one = 1.0e+0 )
133  COMPLEX czero, cone
134  parameter( czero = ( 0.0e+0, 0.0e+0 ),
135  $ cone = ( 1.0e+0, 0.0e+0 ) )
136 * ..
137 * .. Local Scalars ..
138  INTEGER i, j, jj
139  REAL ainvnm, anorm, eps
140 * ..
141 * .. External Functions ..
142  LOGICAL lsame
143  REAL clange, clanhp, slamch
144  EXTERNAL lsame, clange, clanhp, slamch
145 * ..
146 * .. Intrinsic Functions ..
147  INTRINSIC conjg, real
148 * ..
149 * .. External Subroutines ..
150  EXTERNAL ccopy, chpmv
151 * ..
152 * .. Executable Statements ..
153 *
154 * Quick exit if N = 0.
155 *
156  IF( n.LE.0 ) THEN
157  rcond = one
158  resid = zero
159  RETURN
160  END IF
161 *
162 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
163 *
164  eps = slamch( 'Epsilon' )
165  anorm = clanhp( '1', uplo, n, a, rwork )
166  ainvnm = clanhp( '1', uplo, n, ainv, rwork )
167  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
168  rcond = zero
169  resid = one / eps
170  RETURN
171  END IF
172  rcond = ( one/anorm ) / ainvnm
173 *
174 * UPLO = 'U':
175 * Copy the leading N-1 x N-1 submatrix of AINV to WORK(1:N,2:N) and
176 * expand it to a full matrix, then multiply by A one column at a
177 * time, moving the result one column to the left.
178 *
179  IF( lsame( uplo, 'U' ) ) THEN
180 *
181 * Copy AINV
182 *
183  jj = 1
184  DO 20 j = 1, n - 1
185  CALL ccopy( j, ainv( jj ), 1, work( 1, j+1 ), 1 )
186  DO 10 i = 1, j - 1
187  work( j, i+1 ) = conjg( ainv( jj+i-1 ) )
188  10 CONTINUE
189  jj = jj + j
190  20 CONTINUE
191  jj = ( ( n-1 )*n ) / 2 + 1
192  DO 30 i = 1, n - 1
193  work( n, i+1 ) = conjg( ainv( jj+i-1 ) )
194  30 CONTINUE
195 *
196 * Multiply by A
197 *
198  DO 40 j = 1, n - 1
199  CALL chpmv( 'Upper', n, -cone, a, work( 1, j+1 ), 1, czero,
200  $ work( 1, j ), 1 )
201  40 CONTINUE
202  CALL chpmv( 'Upper', n, -cone, a, ainv( jj ), 1, czero,
203  $ work( 1, n ), 1 )
204 *
205 * UPLO = 'L':
206 * Copy the trailing N-1 x N-1 submatrix of AINV to WORK(1:N,1:N-1)
207 * and multiply by A, moving each column to the right.
208 *
209  ELSE
210 *
211 * Copy AINV
212 *
213  DO 50 i = 1, n - 1
214  work( 1, i ) = conjg( ainv( i+1 ) )
215  50 CONTINUE
216  jj = n + 1
217  DO 70 j = 2, n
218  CALL ccopy( n-j+1, ainv( jj ), 1, work( j, j-1 ), 1 )
219  DO 60 i = 1, n - j
220  work( j, j+i-1 ) = conjg( ainv( jj+i ) )
221  60 CONTINUE
222  jj = jj + n - j + 1
223  70 CONTINUE
224 *
225 * Multiply by A
226 *
227  DO 80 j = n, 2, -1
228  CALL chpmv( 'Lower', n, -cone, a, work( 1, j-1 ), 1, czero,
229  $ work( 1, j ), 1 )
230  80 CONTINUE
231  CALL chpmv( 'Lower', n, -cone, a, ainv( 1 ), 1, czero,
232  $ work( 1, 1 ), 1 )
233 *
234  END IF
235 *
236 * Add the identity matrix to WORK .
237 *
238  DO 90 i = 1, n
239  work( i, i ) = work( i, i ) + cone
240  90 CONTINUE
241 *
242 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
243 *
244  resid = clange( '1', n, n, work, ldwork, rwork )
245 *
246  resid = ( ( resid*rcond )/eps ) / REAL( n )
247 *
248  RETURN
249 *
250 * End of CPPT03
251 *
subroutine chpmv(UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY)
CHPMV
Definition: chpmv.f:151
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:117
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine ccopy(N, CX, INCX, CY, INCY)
CCOPY
Definition: ccopy.f:83
real function clanhp(NORM, UPLO, N, AP, WORK)
CLANHP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian matrix supplied in packed form.
Definition: clanhp.f:119
Here is the call graph for this function:
Here is the caller graph for this function: