LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 84 of file sstect.f.

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