LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dstect()

subroutine dstect ( integer  N,
double precision, dimension( * )  A,
double precision, dimension( * )  B,
double precision  SHIFT,
integer  NUM 
)

DSTECT

Purpose:
    DSTECT counts the number NUM of eigenvalues of a tridiagonal
    matrix T which are less than or equal to SHIFT. T has
    diagonal entries A(1), ... , A(N), and offdiagonal entries
    B(1), ..., B(N-1).
    See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal
    Matrix", Report CS41, Computer Science Dept., Stanford
    University, July 21, 1966
Parameters
[in]N
          N is INTEGER
          The dimension of the tridiagonal matrix T.
[in]A
          A is DOUBLE PRECISION array, dimension (N)
          The diagonal entries of the tridiagonal matrix T.
[in]B
          B is DOUBLE PRECISION array, dimension (N-1)
          The offdiagonal entries of the tridiagonal matrix T.
[in]SHIFT
          SHIFT is DOUBLE PRECISION
          The shift, used as described under Purpose.
[out]NUM
          NUM is INTEGER
          The number of eigenvalues of T less than or equal
          to SHIFT.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 81 of file dstect.f.

82*
83* -- LAPACK test routine --
84* -- LAPACK is a software package provided by Univ. of Tennessee, --
85* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
86*
87* .. Scalar Arguments ..
88 INTEGER N, NUM
89 DOUBLE PRECISION SHIFT
90* ..
91* .. Array Arguments ..
92 DOUBLE PRECISION A( * ), B( * )
93* ..
94*
95* =====================================================================
96*
97* .. Parameters ..
98 DOUBLE PRECISION ZERO, ONE, THREE
99 parameter( zero = 0.0d0, one = 1.0d0, three = 3.0d0 )
100* ..
101* .. Local Scalars ..
102 INTEGER I
103 DOUBLE PRECISION M1, M2, MX, OVFL, SOV, SSHIFT, SSUN, SUN, TMP,
104 $ TOM, U, UNFL
105* ..
106* .. External Functions ..
107 DOUBLE PRECISION DLAMCH
108 EXTERNAL dlamch
109* ..
110* .. Intrinsic Functions ..
111 INTRINSIC abs, max, sqrt
112* ..
113* .. Executable Statements ..
114*
115* Get machine constants
116*
117 unfl = dlamch( 'Safe minimum' )
118 ovfl = dlamch( 'Overflow' )
119*
120* Find largest entry
121*
122 mx = abs( a( 1 ) )
123 DO 10 i = 1, n - 1
124 mx = max( mx, abs( a( i+1 ) ), abs( b( i ) ) )
125 10 CONTINUE
126*
127* Handle easy cases, including zero matrix
128*
129 IF( shift.GE.three*mx ) THEN
130 num = n
131 RETURN
132 END IF
133 IF( shift.LT.-three*mx ) THEN
134 num = 0
135 RETURN
136 END IF
137*
138* Compute scale factors as in Kahan's report
139* At this point, MX .NE. 0 so we can divide by it
140*
141 sun = sqrt( unfl )
142 ssun = sqrt( sun )
143 sov = sqrt( ovfl )
144 tom = ssun*sov
145 IF( mx.LE.one ) THEN
146 m1 = one / mx
147 m2 = tom
148 ELSE
149 m1 = one
150 m2 = tom / mx
151 END IF
152*
153* Begin counting
154*
155 num = 0
156 sshift = ( shift*m1 )*m2
157 u = ( a( 1 )*m1 )*m2 - sshift
158 IF( u.LE.sun ) THEN
159 IF( u.LE.zero ) THEN
160 num = num + 1
161 IF( u.GT.-sun )
162 $ u = -sun
163 ELSE
164 u = sun
165 END IF
166 END IF
167 DO 20 i = 2, n
168 tmp = ( b( i-1 )*m1 )*m2
169 u = ( ( a( i )*m1 )*m2-tmp*( tmp / u ) ) - sshift
170 IF( u.LE.sun ) THEN
171 IF( u.LE.zero ) THEN
172 num = num + 1
173 IF( u.GT.-sun )
174 $ u = -sun
175 ELSE
176 u = sun
177 END IF
178 END IF
179 20 CONTINUE
180 RETURN
181*
182* End of DSTECT
183*
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
Here is the caller graph for this function: