## SB01BX

### Choosing the closest real (complex conjugate) eigenvalue(s) to a given real (complex) value

[Specification] [Arguments] [Method] [References] [Comments] [Example]

Purpose

```  To choose a real eigenvalue or a pair of complex conjugate
eigenvalues at "minimal" distance to a given real or complex
value.

```
Specification
```      SUBROUTINE SB01BX( REIG, N, XR, XI, WR, WI, S, P )
C     .. Scalar Arguments ..
LOGICAL          REIG
INTEGER          N
DOUBLE PRECISION P, S, XI ,XR
C     .. Array Arguments ..
DOUBLE PRECISION WI(*), WR(*)

```
Arguments

Mode Parameters

```  REIG    LOGICAL
Specifies the type of eigenvalues as follows:
= .TRUE.,  a real eigenvalue is to be selected;
= .FALSE., a pair of complex eigenvalues is to be
selected.

```
Input/Output Parameters
```  N       (input) INTEGER
The number of eigenvalues contained in the arrays WR
and WI.  N >= 1.

XR,XI   (input) DOUBLE PRECISION
If REIG = .TRUE., XR must contain the real value and XI
is assumed zero and therefore not referenced.
If REIG = .FALSE., XR must contain the real part and XI
the imaginary part, respectively, of the complex value.

WR,WI   (input/output) DOUBLE PRECISION array, dimension (N)
On entry, if REIG = .TRUE., WR must contain the real
eigenvalues from which an eigenvalue at minimal distance
to XR is to be selected. In this case, WI is considered
zero and therefore not referenced.
On entry, if REIG = .FALSE., WR and WI must contain the
real and imaginary parts, respectively, of the eigenvalues
from which a pair of complex conjugate eigenvalues at
minimal "distance" to XR + jXI is to be selected.
The eigenvalues of each pair of complex conjugate
eigenvalues must appear consecutively.
On exit, the elements of these arrays are reordered such
that the selected eigenvalue(s) is (are) found in the
last element(s) of these arrays.

S,P     (output) DOUBLE PRECISION
If REIG = .TRUE., S (and also P) contains the value of
the selected real eigenvalue.
If REIG = .FALSE., S and P contain the sum and product,
respectively, of the selected complex conjugate pair of
eigenvalues.

```
```  For efficiency reasons, |x| + |y| is used for a complex number
x + jy, instead of its modulus.

```
Example

Program Text

```  None
```
Program Data
```  None
```
Program Results
```  None
```