LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cstt21()

subroutine cstt21 ( integer  N,
integer  KBAND,
real, dimension( * )  AD,
real, dimension( * )  AE,
real, dimension( * )  SD,
real, dimension( * )  SE,
complex, dimension( ldu, * )  U,
integer  LDU,
complex, dimension( * )  WORK,
real, dimension( * )  RWORK,
real, dimension( 2 )  RESULT 
)

CSTT21

Purpose:
 CSTT21  checks a decomposition of the form

    A = U S UC>
 where * means conjugate transpose, A is real symmetric tridiagonal,
 U is unitary, and S is real and diagonal (if KBAND=0) or symmetric
 tridiagonal (if KBAND=1).  Two tests are performed:

    RESULT(1) = | A - U S U* | / ( |A| n ulp )

    RESULT(2) = | I - UU* | / ( n ulp )
Parameters
[in]N
          N is INTEGER
          The size of the matrix.  If it is zero, CSTT21 does nothing.
          It must be at least zero.
[in]KBAND
          KBAND is INTEGER
          The bandwidth of the matrix S.  It may only be zero or one.
          If zero, then S is diagonal, and SE is not referenced.  If
          one, then S is symmetric tri-diagonal.
[in]AD
          AD is REAL array, dimension (N)
          The diagonal of the original (unfactored) matrix A.  A is
          assumed to be real symmetric tridiagonal.
[in]AE
          AE is REAL array, dimension (N-1)
          The off-diagonal of the original (unfactored) matrix A.  A
          is assumed to be symmetric tridiagonal.  AE(1) is the (1,2)
          and (2,1) element, AE(2) is the (2,3) and (3,2) element, etc.
[in]SD
          SD is REAL array, dimension (N)
          The diagonal of the real (symmetric tri-) diagonal matrix S.
[in]SE
          SE is REAL array, dimension (N-1)
          The off-diagonal of the (symmetric tri-) diagonal matrix S.
          Not referenced if KBSND=0.  If KBAND=1, then AE(1) is the
          (1,2) and (2,1) element, SE(2) is the (2,3) and (3,2)
          element, etc.
[in]U
          U is COMPLEX array, dimension (LDU, N)
          The unitary matrix in the decomposition.
[in]LDU
          LDU is INTEGER
          The leading dimension of U.  LDU must be at least N.
[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.
          RESULT(1) is always modified.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 134 of file cstt21.f.

134 *
135 * -- LAPACK test routine (version 3.7.0) --
136 * -- LAPACK is a software package provided by Univ. of Tennessee, --
137 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138 * December 2016
139 *
140 * .. Scalar Arguments ..
141  INTEGER kband, ldu, n
142 * ..
143 * .. Array Arguments ..
144  REAL ad( * ), ae( * ), result( 2 ), rwork( * ),
145  $ sd( * ), se( * )
146  COMPLEX u( ldu, * ), work( * )
147 * ..
148 *
149 * =====================================================================
150 *
151 * .. Parameters ..
152  REAL zero, one
153  parameter( zero = 0.0e+0, one = 1.0e+0 )
154  COMPLEX czero, cone
155  parameter( czero = ( 0.0e+0, 0.0e+0 ),
156  $ cone = ( 1.0e+0, 0.0e+0 ) )
157 * ..
158 * .. Local Scalars ..
159  INTEGER j
160  REAL anorm, temp1, temp2, ulp, unfl, wnorm
161 * ..
162 * .. External Functions ..
163  REAL clange, clanhe, slamch
164  EXTERNAL clange, clanhe, slamch
165 * ..
166 * .. External Subroutines ..
167  EXTERNAL cgemm, cher, cher2, claset
168 * ..
169 * .. Intrinsic Functions ..
170  INTRINSIC abs, cmplx, max, min, real
171 * ..
172 * .. Executable Statements ..
173 *
174 * 1) Constants
175 *
176  result( 1 ) = zero
177  result( 2 ) = zero
178  IF( n.LE.0 )
179  $ RETURN
180 *
181  unfl = slamch( 'Safe minimum' )
182  ulp = slamch( 'Precision' )
183 *
184 * Do Test 1
185 *
186 * Copy A & Compute its 1-Norm:
187 *
188  CALL claset( 'Full', n, n, czero, czero, work, n )
189 *
190  anorm = zero
191  temp1 = zero
192 *
193  DO 10 j = 1, n - 1
194  work( ( n+1 )*( j-1 )+1 ) = ad( j )
195  work( ( n+1 )*( j-1 )+2 ) = ae( j )
196  temp2 = abs( ae( j ) )
197  anorm = max( anorm, abs( ad( j ) )+temp1+temp2 )
198  temp1 = temp2
199  10 CONTINUE
200 *
201  work( n**2 ) = ad( n )
202  anorm = max( anorm, abs( ad( n ) )+temp1, unfl )
203 *
204 * Norm of A - USU*
205 *
206  DO 20 j = 1, n
207  CALL cher( 'L', n, -sd( j ), u( 1, j ), 1, work, n )
208  20 CONTINUE
209 *
210  IF( n.GT.1 .AND. kband.EQ.1 ) THEN
211  DO 30 j = 1, n - 1
212  CALL cher2( 'L', n, -cmplx( se( j ) ), u( 1, j ), 1,
213  $ u( 1, j+1 ), 1, work, n )
214  30 CONTINUE
215  END IF
216 *
217  wnorm = clanhe( '1', 'L', n, work, n, rwork )
218 *
219  IF( anorm.GT.wnorm ) THEN
220  result( 1 ) = ( wnorm / anorm ) / ( n*ulp )
221  ELSE
222  IF( anorm.LT.one ) THEN
223  result( 1 ) = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
224  ELSE
225  result( 1 ) = min( wnorm / anorm, REAL( N ) ) / ( n*ulp )
226  END IF
227  END IF
228 *
229 * Do Test 2
230 *
231 * Compute UU* - I
232 *
233  CALL cgemm( 'N', 'C', n, n, n, cone, u, ldu, u, ldu, czero, work,
234  $ n )
235 *
236  DO 40 j = 1, n
237  work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
238  40 CONTINUE
239 *
240  result( 2 ) = min( REAL( N ), clange( '1', n, n, work, n,
241  $ rwork ) ) / ( n*ulp )
242 *
243  RETURN
244 *
245 * End of CSTT21
246 *
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: claset.f:108
subroutine cher(UPLO, N, ALPHA, X, INCX, A, LDA)
CHER
Definition: cher.f:137
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
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine cher2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CHER2
Definition: cher2.f:152
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE 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.
Definition: clanhe.f:126
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189
Here is the call graph for this function:
Here is the caller graph for this function: