LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ cpbt01()

subroutine cpbt01 ( character  UPLO,
integer  N,
integer  KD,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( ldafac, * )  AFAC,
integer  LDAFAC,
real, dimension( * )  RWORK,
real  RESID 
)

CPBT01

Purpose:
 CPBT01 reconstructs a Hermitian positive definite band matrix A from
 its L*L' or U'*U factorization and computes the residual
    norm( L*L' - A ) / ( N * norm(A) * EPS ) or
    norm( U'*U - A ) / ( N * norm(A) * EPS ),
 where EPS is the machine epsilon, L' is the conjugate transpose of
 L, and U' is the conjugate transpose of U.
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]KD
          KD is INTEGER
          The number of super-diagonals of the matrix A if UPLO = 'U',
          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0.
[in]A
          A is COMPLEX array, dimension (LDA,N)
          The original Hermitian band matrix A.  If UPLO = 'U', the
          upper triangular part of A is stored as a band matrix; if
          UPLO = 'L', the lower triangular part of A is stored.  The
          columns of the appropriate triangle are stored in the columns
          of A and the diagonals of the triangle are stored in the rows
          of A.  See CPBTRF for further details.
[in]LDA
          LDA is INTEGER.
          The leading dimension of the array A.  LDA >= max(1,KD+1).
[in]AFAC
          AFAC is COMPLEX array, dimension (LDAFAC,N)
          The factored form of the matrix A.  AFAC contains the factor
          L or U from the L*L' or U'*U factorization in band storage
          format, as computed by CPBTRF.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.
          LDAFAC >= max(1,KD+1).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESID
          RESID is REAL
          If UPLO = 'L', norm(L*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U'*U - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 118 of file cpbt01.f.

120 *
121 * -- LAPACK test routine --
122 * -- LAPACK is a software package provided by Univ. of Tennessee, --
123 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
124 *
125 * .. Scalar Arguments ..
126  CHARACTER UPLO
127  INTEGER KD, LDA, LDAFAC, N
128  REAL RESID
129 * ..
130 * .. Array Arguments ..
131  REAL RWORK( * )
132  COMPLEX A( LDA, * ), AFAC( LDAFAC, * )
133 * ..
134 *
135 * =====================================================================
136 *
137 *
138 * .. Parameters ..
139  REAL ZERO, ONE
140  parameter( zero = 0.0e+0, one = 1.0e+0 )
141 * ..
142 * .. Local Scalars ..
143  INTEGER I, J, K, KC, KLEN, ML, MU
144  REAL AKK, ANORM, EPS
145 * ..
146 * .. External Functions ..
147  LOGICAL LSAME
148  REAL CLANHB, SLAMCH
149  COMPLEX CDOTC
150  EXTERNAL lsame, clanhb, slamch, cdotc
151 * ..
152 * .. External Subroutines ..
153  EXTERNAL cher, csscal, ctrmv
154 * ..
155 * .. Intrinsic Functions ..
156  INTRINSIC aimag, max, min, real
157 * ..
158 * .. Executable Statements ..
159 *
160 * Quick exit if N = 0.
161 *
162  IF( n.LE.0 ) THEN
163  resid = zero
164  RETURN
165  END IF
166 *
167 * Exit with RESID = 1/EPS if ANORM = 0.
168 *
169  eps = slamch( 'Epsilon' )
170  anorm = clanhb( '1', uplo, n, kd, a, lda, rwork )
171  IF( anorm.LE.zero ) THEN
172  resid = one / eps
173  RETURN
174  END IF
175 *
176 * Check the imaginary parts of the diagonal elements and return with
177 * an error code if any are nonzero.
178 *
179  IF( lsame( uplo, 'U' ) ) THEN
180  DO 10 j = 1, n
181  IF( aimag( afac( kd+1, j ) ).NE.zero ) THEN
182  resid = one / eps
183  RETURN
184  END IF
185  10 CONTINUE
186  ELSE
187  DO 20 j = 1, n
188  IF( aimag( afac( 1, j ) ).NE.zero ) THEN
189  resid = one / eps
190  RETURN
191  END IF
192  20 CONTINUE
193  END IF
194 *
195 * Compute the product U'*U, overwriting U.
196 *
197  IF( lsame( uplo, 'U' ) ) THEN
198  DO 30 k = n, 1, -1
199  kc = max( 1, kd+2-k )
200  klen = kd + 1 - kc
201 *
202 * Compute the (K,K) element of the result.
203 *
204  akk = cdotc( klen+1, afac( kc, k ), 1, afac( kc, k ), 1 )
205  afac( kd+1, k ) = akk
206 *
207 * Compute the rest of column K.
208 *
209  IF( klen.GT.0 )
210  $ CALL ctrmv( 'Upper', 'Conjugate', 'Non-unit', klen,
211  $ afac( kd+1, k-klen ), ldafac-1,
212  $ afac( kc, k ), 1 )
213 *
214  30 CONTINUE
215 *
216 * UPLO = 'L': Compute the product L*L', overwriting L.
217 *
218  ELSE
219  DO 40 k = n, 1, -1
220  klen = min( kd, n-k )
221 *
222 * Add a multiple of column K of the factor L to each of
223 * columns K+1 through N.
224 *
225  IF( klen.GT.0 )
226  $ CALL cher( 'Lower', klen, one, afac( 2, k ), 1,
227  $ afac( 1, k+1 ), ldafac-1 )
228 *
229 * Scale column K by the diagonal element.
230 *
231  akk = afac( 1, k )
232  CALL csscal( klen+1, akk, afac( 1, k ), 1 )
233 *
234  40 CONTINUE
235  END IF
236 *
237 * Compute the difference L*L' - A or U'*U - A.
238 *
239  IF( lsame( uplo, 'U' ) ) THEN
240  DO 60 j = 1, n
241  mu = max( 1, kd+2-j )
242  DO 50 i = mu, kd + 1
243  afac( i, j ) = afac( i, j ) - a( i, j )
244  50 CONTINUE
245  60 CONTINUE
246  ELSE
247  DO 80 j = 1, n
248  ml = min( kd+1, n-j+1 )
249  DO 70 i = 1, ml
250  afac( i, j ) = afac( i, j ) - a( i, j )
251  70 CONTINUE
252  80 CONTINUE
253  END IF
254 *
255 * Compute norm( L*L' - A ) / ( N * norm(A) * EPS )
256 *
257  resid = clanhb( '1', uplo, n, kd, afac, ldafac, rwork )
258 *
259  resid = ( ( resid / real( n ) ) / anorm ) / eps
260 *
261  RETURN
262 *
263 * End of CPBT01
264 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
complex function cdotc(N, CX, INCX, CY, INCY)
CDOTC
Definition: cdotc.f:83
subroutine csscal(N, SA, CX, INCX)
CSSCAL
Definition: csscal.f:78
subroutine ctrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
CTRMV
Definition: ctrmv.f:147
subroutine cher(UPLO, N, ALPHA, X, INCX, A, LDA)
CHER
Definition: cher.f:135
real function clanhb(NORM, UPLO, N, K, AB, LDAB, WORK)
CLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clanhb.f:132
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: