LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ chbt21()

subroutine chbt21 ( character  UPLO,
integer  N,
integer  KA,
integer  KS,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  D,
real, dimension( * )  E,
complex, dimension( ldu, * )  U,
integer  LDU,
complex, dimension( * )  WORK,
real, dimension( * )  RWORK,
real, dimension( 2 )  RESULT 
)

CHBT21

Purpose:
 CHBT21  generally checks a decomposition of the form

         A = U S U**H

 where **H means conjugate transpose, A is hermitian banded, U is
 unitary, and S is diagonal (if KS=0) or symmetric
 tridiagonal (if KS=1).

 Specifically:

         RESULT(1) = | A - U S U**H | / ( |A| n ulp ) and
         RESULT(2) = | I - U U**H | / ( n ulp )
Parameters
[in]UPLO
          UPLO is CHARACTER
          If UPLO='U', the upper triangle of A and V will be used and
          the (strictly) lower triangle will not be referenced.
          If UPLO='L', the lower triangle of A and V will be used and
          the (strictly) upper triangle will not be referenced.
[in]N
          N is INTEGER
          The size of the matrix.  If it is zero, CHBT21 does nothing.
          It must be at least zero.
[in]KA
          KA is INTEGER
          The bandwidth of the matrix A.  It must be at least zero.  If
          it is larger than N-1, then max( 0, N-1 ) will be used.
[in]KS
          KS is INTEGER
          The bandwidth of the matrix S.  It may only be zero or one.
          If zero, then S is diagonal, and E is not referenced.  If
          one, then S is symmetric tri-diagonal.
[in]A
          A is COMPLEX array, dimension (LDA, N)
          The original (unfactored) matrix.  It is assumed to be
          hermitian, and only the upper (UPLO='U') or only the lower
          (UPLO='L') will be referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of A.  It must be at least 1
          and at least min( KA, N-1 ).
[in]D
          D is REAL array, dimension (N)
          The diagonal of the (symmetric tri-) diagonal matrix S.
[in]E
          E is REAL array, dimension (N-1)
          The off-diagonal of the (symmetric tri-) diagonal matrix S.
          E(1) is the (1,2) and (2,1) element, E(2) is the (2,3) and
          (3,2) element, etc.
          Not referenced if KS=0.
[in]U
          U is COMPLEX array, dimension (LDU, N)
          The unitary matrix in the decomposition, expressed as a
          dense matrix (i.e., not as a product of Householder
          transformations, Givens transformations, etc.)
[in]LDU
          LDU is INTEGER
          The leading dimension of U.  LDU must be at least N and
          at least 1.
[out]WORK
          WORK is COMPLEX array, dimension (N**2)
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESULT
          RESULT is REAL array, dimension (2)
          The values computed by the two tests described above.  The
          values are currently limited to 1/ulp, to avoid overflow.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 150 of file chbt21.f.

152 *
153 * -- LAPACK test routine --
154 * -- LAPACK is a software package provided by Univ. of Tennessee, --
155 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
156 *
157 * .. Scalar Arguments ..
158  CHARACTER UPLO
159  INTEGER KA, KS, LDA, LDU, N
160 * ..
161 * .. Array Arguments ..
162  REAL D( * ), E( * ), RESULT( 2 ), RWORK( * )
163  COMPLEX A( LDA, * ), U( LDU, * ), WORK( * )
164 * ..
165 *
166 * =====================================================================
167 *
168 * .. Parameters ..
169  COMPLEX CZERO, CONE
170  parameter( czero = ( 0.0e+0, 0.0e+0 ),
171  $ cone = ( 1.0e+0, 0.0e+0 ) )
172  REAL ZERO, ONE
173  parameter( zero = 0.0e+0, one = 1.0e+0 )
174 * ..
175 * .. Local Scalars ..
176  LOGICAL LOWER
177  CHARACTER CUPLO
178  INTEGER IKA, J, JC, JR
179  REAL ANORM, ULP, UNFL, WNORM
180 * ..
181 * .. External Functions ..
182  LOGICAL LSAME
183  REAL CLANGE, CLANHB, CLANHP, SLAMCH
184  EXTERNAL lsame, clange, clanhb, clanhp, slamch
185 * ..
186 * .. External Subroutines ..
187  EXTERNAL cgemm, chpr, chpr2
188 * ..
189 * .. Intrinsic Functions ..
190  INTRINSIC cmplx, max, min, real
191 * ..
192 * .. Executable Statements ..
193 *
194 * Constants
195 *
196  result( 1 ) = zero
197  result( 2 ) = zero
198  IF( n.LE.0 )
199  $ RETURN
200 *
201  ika = max( 0, min( n-1, ka ) )
202 *
203  IF( lsame( uplo, 'U' ) ) THEN
204  lower = .false.
205  cuplo = 'U'
206  ELSE
207  lower = .true.
208  cuplo = 'L'
209  END IF
210 *
211  unfl = slamch( 'Safe minimum' )
212  ulp = slamch( 'Epsilon' )*slamch( 'Base' )
213 *
214 * Some Error Checks
215 *
216 * Do Test 1
217 *
218 * Norm of A:
219 *
220  anorm = max( clanhb( '1', cuplo, n, ika, a, lda, rwork ), unfl )
221 *
222 * Compute error matrix: Error = A - U S U**H
223 *
224 * Copy A from SB to SP storage format.
225 *
226  j = 0
227  DO 50 jc = 1, n
228  IF( lower ) THEN
229  DO 10 jr = 1, min( ika+1, n+1-jc )
230  j = j + 1
231  work( j ) = a( jr, jc )
232  10 CONTINUE
233  DO 20 jr = ika + 2, n + 1 - jc
234  j = j + 1
235  work( j ) = zero
236  20 CONTINUE
237  ELSE
238  DO 30 jr = ika + 2, jc
239  j = j + 1
240  work( j ) = zero
241  30 CONTINUE
242  DO 40 jr = min( ika, jc-1 ), 0, -1
243  j = j + 1
244  work( j ) = a( ika+1-jr, jc )
245  40 CONTINUE
246  END IF
247  50 CONTINUE
248 *
249  DO 60 j = 1, n
250  CALL chpr( cuplo, n, -d( j ), u( 1, j ), 1, work )
251  60 CONTINUE
252 *
253  IF( n.GT.1 .AND. ks.EQ.1 ) THEN
254  DO 70 j = 1, n - 1
255  CALL chpr2( cuplo, n, -cmplx( e( j ) ), u( 1, j ), 1,
256  $ u( 1, j+1 ), 1, work )
257  70 CONTINUE
258  END IF
259  wnorm = clanhp( '1', cuplo, n, work, rwork )
260 *
261  IF( anorm.GT.wnorm ) THEN
262  result( 1 ) = ( wnorm / anorm ) / ( n*ulp )
263  ELSE
264  IF( anorm.LT.one ) THEN
265  result( 1 ) = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
266  ELSE
267  result( 1 ) = min( wnorm / anorm, real( n ) ) / ( n*ulp )
268  END IF
269  END IF
270 *
271 * Do Test 2
272 *
273 * Compute U U**H - I
274 *
275  CALL cgemm( 'N', 'C', n, n, n, cone, u, ldu, u, ldu, czero, work,
276  $ n )
277 *
278  DO 80 j = 1, n
279  work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
280  80 CONTINUE
281 *
282  result( 2 ) = min( clange( '1', n, n, work, n, rwork ),
283  $ real( n ) ) / ( n*ulp )
284 *
285  RETURN
286 *
287 * End of CHBT21
288 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine chpr2(UPLO, N, ALPHA, X, INCX, Y, INCY, AP)
CHPR2
Definition: chpr2.f:145
subroutine chpr(UPLO, N, ALPHA, X, INCX, AP)
CHPR
Definition: chpr.f:130
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:187
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:115
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 clanhp(NORM, UPLO, N, AP, WORK)
CLANHP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clanhp.f:117
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: