SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pdlaiectl_()

void pdlaiectl_ ( double *  sigma,
Int n,
double *  d,
Int count 
)

Definition at line 151 of file pdlaiect.c.

152{
153/*
154*
155* Purpose
156* =======
157*
158* pdlaiectl computes the number of negative eigenvalues of (A- SIGMA I).
159* This implementation of the Sturm Sequence loop exploits IEEE Arithmetic
160* and has no conditionals in the innermost loop. To extract the signbit,
161* this routine assumes that the double precision word is stored in
162* "Little Endian" word order, i.e, the signbit is assumed to be bit 64.
163*
164* Note that all arguments are call-by-reference so that this routine
165* can be directly called from Fortran code.
166*
167* This is a ScaLAPACK internal subroutine and arguments are not
168* checked for unreasonable values.
169*
170* Arguments
171* =========
172*
173* SIGMA (input) DOUBLE PRECISION
174* The shift. pdlaiectl finds the number of eigenvalues
175* less than equal to SIGMA.
176*
177* N (input) INTEGER
178* The order of the tridiagonal matrix T. N >= 1.
179*
180* D (input) DOUBLE PRECISION array, dimension (2*N - 1)
181* Contains the diagonals and the squares of the off-diagonal
182* elements of the tridiagonal matrix T. These elements are
183* assumed to be interleaved in memory for better cache
184* performance. The diagonal entries of T are in the entries
185* D(1),D(3),...,D(2*N-1), while the squares of the off-diagonal
186* entries are D(2),D(4),...,D(2*N-2). To avoid overflow, the
187* matrix must be scaled so that its largest entry is no greater
188* than overflow**(1/2) * underflow**(1/4) in absolute value,
189* and for greatest accuracy, it should not be much smaller
190* than that.
191*
192* COUNT (output) INTEGER
193* The count of the number of eigenvalues of T less than or
194* equal to SIGMA.
195*
196* =====================================================================
197*
198* .. Local Scalars ..
199*/
200 double lsigma, tmp, *pd, *pe2;
201 Int i;
202/* ..
203* .. Executable Statements ..
204*/
205
206 lsigma = *sigma;
207 pd = d; pe2 = d+1;
208 tmp = *pd - lsigma; pd += 2;
209 *count = (*(((Int *)&tmp)+1) >> 31) & 1;
210 for(i = 1;i < *n;i++){
211 tmp = *pd - *pe2/tmp - lsigma;
212 pd += 2; pe2 += 2;
213 *count += (*(((Int *)&tmp)+1) >> 31) & 1;
214 }
215}
#define Int
Definition Bconfig.h:22