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

◆ sstect()

subroutine sstect ( integer  n,
real, dimension( * )  a,
real, dimension( * )  b,
real  shift,
integer  num 
)

SSTECT

Purpose:
    SSTECT 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 REAL array, dimension (N)
          The diagonal entries of the tridiagonal matrix T.
[in]B
          B is REAL array, dimension (N-1)
          The offdiagonal entries of the tridiagonal matrix T.
[in]SHIFT
          SHIFT is REAL
          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 sstect.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 REAL SHIFT
90* ..
91* .. Array Arguments ..
92 REAL A( * ), B( * )
93* ..
94*
95* =====================================================================
96*
97* .. Parameters ..
98 REAL ZERO, ONE, THREE
99 parameter( zero = 0.0e0, one = 1.0e0, three = 3.0e0 )
100* ..
101* .. Local Scalars ..
102 INTEGER I
103 REAL M1, M2, MX, OVFL, SOV, SSHIFT, SSUN, SUN, TMP,
104 $ TOM, U, UNFL
105* ..
106* .. External Functions ..
107 REAL SLAMCH
108 EXTERNAL slamch
109* ..
110* .. Intrinsic Functions ..
111 INTRINSIC abs, max, sqrt
112* ..
113* .. Executable Statements ..
114*
115* Get machine constants
116*
117 unfl = slamch( 'Safe minimum' )
118 ovfl = slamch( '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 SSTECT
183*
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
Here is the caller graph for this function: