LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cptt01 ( integer  N,
real, dimension( * )  D,
complex, dimension( * )  E,
real, dimension( * )  DF,
complex, dimension( * )  EF,
complex, dimension( * )  WORK,
real  RESID 
)

CPTT01

Purpose:
 CPTT01 reconstructs a tridiagonal matrix A from its L*D*L'
 factorization and computes the residual
    norm(L*D*L' - A) / ( n * norm(A) * EPS ),
 where EPS is the machine epsilon.
Parameters
[in]N
          N is INTEGTER
          The order of the matrix A.
[in]D
          D is REAL array, dimension (N)
          The n diagonal elements of the tridiagonal matrix A.
[in]E
          E is COMPLEX array, dimension (N-1)
          The (n-1) subdiagonal elements of the tridiagonal matrix A.
[in]DF
          DF is REAL array, dimension (N)
          The n diagonal elements of the factor L from the L*D*L'
          factorization of A.
[in]EF
          EF is COMPLEX array, dimension (N-1)
          The (n-1) subdiagonal elements of the factor L from the
          L*D*L' factorization of A.
[out]WORK
          WORK is COMPLEX array, dimension (2*N)
[out]RESID
          RESID is REAL
          norm(L*D*L' - A) / (n * norm(A) * EPS)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 94 of file cptt01.f.

94 *
95 * -- LAPACK test routine (version 3.4.0) --
96 * -- LAPACK is a software package provided by Univ. of Tennessee, --
97 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
98 * November 2011
99 *
100 * .. Scalar Arguments ..
101  INTEGER n
102  REAL resid
103 * ..
104 * .. Array Arguments ..
105  REAL d( * ), df( * )
106  COMPLEX e( * ), ef( * ), work( * )
107 * ..
108 *
109 * =====================================================================
110 *
111 * .. Parameters ..
112  REAL one, zero
113  parameter ( one = 1.0e+0, zero = 0.0e+0 )
114 * ..
115 * .. Local Scalars ..
116  INTEGER i
117  REAL anorm, eps
118  COMPLEX de
119 * ..
120 * .. External Functions ..
121  REAL slamch
122  EXTERNAL slamch
123 * ..
124 * .. Intrinsic Functions ..
125  INTRINSIC abs, conjg, max, real
126 * ..
127 * .. Executable Statements ..
128 *
129 * Quick return if possible
130 *
131  IF( n.LE.0 ) THEN
132  resid = zero
133  RETURN
134  END IF
135 *
136  eps = slamch( 'Epsilon' )
137 *
138 * Construct the difference L*D*L' - A.
139 *
140  work( 1 ) = df( 1 ) - d( 1 )
141  DO 10 i = 1, n - 1
142  de = df( i )*ef( i )
143  work( n+i ) = de - e( i )
144  work( 1+i ) = de*conjg( ef( i ) ) + df( i+1 ) - d( i+1 )
145  10 CONTINUE
146 *
147 * Compute the 1-norms of the tridiagonal matrices A and WORK.
148 *
149  IF( n.EQ.1 ) THEN
150  anorm = d( 1 )
151  resid = abs( work( 1 ) )
152  ELSE
153  anorm = max( d( 1 )+abs( e( 1 ) ), d( n )+abs( e( n-1 ) ) )
154  resid = max( abs( work( 1 ) )+abs( work( n+1 ) ),
155  $ abs( work( n ) )+abs( work( 2*n-1 ) ) )
156  DO 20 i = 2, n - 1
157  anorm = max( anorm, d( i )+abs( e( i ) )+abs( e( i-1 ) ) )
158  resid = max( resid, abs( work( i ) )+abs( work( n+i-1 ) )+
159  $ abs( work( n+i ) ) )
160  20 CONTINUE
161  END IF
162 *
163 * Compute norm(L*D*L' - A) / (n * norm(A) * EPS)
164 *
165  IF( anorm.LE.zero ) THEN
166  IF( resid.NE.zero )
167  $ resid = one / eps
168  ELSE
169  resid = ( ( resid / REAL( N ) ) / anorm ) / eps
170  END IF
171 *
172  RETURN
173 *
174 * End of CPTT01
175 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69

Here is the caller graph for this function: