f08nb computes the eigenvalues and, optionally, the left and/or right eigenvectors for an n by n real nonsymmetric matrix A.
Optionally, it also computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors, reciprocal condition numbers for the eigenvalues, and reciprocal condition numbers for the right eigenvectors.

Syntax

C#
public static void f08nb(
	string balanc,
	string jobvl,
	string jobvr,
	string sense,
	int n,
	double[,] a,
	double[] wr,
	double[] wi,
	double[,] vl,
	double[,] vr,
	out int ilo,
	out int ihi,
	double[] scale,
	out double abnrm,
	double[] rconde,
	double[] rcondv,
	out int info
)
Visual Basic
Public Shared Sub f08nb ( _
	balanc As String, _
	jobvl As String, _
	jobvr As String, _
	sense As String, _
	n As Integer, _
	a As Double(,), _
	wr As Double(), _
	wi As Double(), _
	vl As Double(,), _
	vr As Double(,), _
	<OutAttribute> ByRef ilo As Integer, _
	<OutAttribute> ByRef ihi As Integer, _
	scale As Double(), _
	<OutAttribute> ByRef abnrm As Double, _
	rconde As Double(), _
	rcondv As Double(), _
	<OutAttribute> ByRef info As Integer _
)
Visual C++
public:
static void f08nb(
	String^ balanc, 
	String^ jobvl, 
	String^ jobvr, 
	String^ sense, 
	int n, 
	array<double,2>^ a, 
	array<double>^ wr, 
	array<double>^ wi, 
	array<double,2>^ vl, 
	array<double,2>^ vr, 
	[OutAttribute] int% ilo, 
	[OutAttribute] int% ihi, 
	array<double>^ scale, 
	[OutAttribute] double% abnrm, 
	array<double>^ rconde, 
	array<double>^ rcondv, 
	[OutAttribute] int% info
)
F#
static member f08nb : 
        balanc : string * 
        jobvl : string * 
        jobvr : string * 
        sense : string * 
        n : int * 
        a : float[,] * 
        wr : float[] * 
        wi : float[] * 
        vl : float[,] * 
        vr : float[,] * 
        ilo : int byref * 
        ihi : int byref * 
        scale : float[] * 
        abnrm : float byref * 
        rconde : float[] * 
        rcondv : float[] * 
        info : int byref -> unit 

Parameters

balanc
Type: System..::..String
On entry: indicates how the input matrix should be diagonally scaled and/or permuted to improve the conditioning of its eigenvalues.
balanc="N"
Do not diagonally scale or permute.
balanc="P"
Perform permutations to make the matrix more nearly upper triangular. Do not diagonally scale.
balanc="S"
Diagonally scale the matrix, i.e., replace A by DAD-1, where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute.
balanc="B"
Both diagonally scale and permute A.
Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does.
Constraint: balanc="N", "P", "S" or "B".
jobvl
Type: System..::..String
On entry: if jobvl="N", the left eigenvectors of A are not computed.
If jobvl="V", the left eigenvectors of A are computed.
If sense="E" or "B", jobvl must be set to jobvl="V".
Constraint: jobvl="N" or "V".
jobvr
Type: System..::..String
On entry: if jobvr="N", the right eigenvectors of A are not computed.
If jobvr="V", the right eigenvectors of A are computed.
If sense="E" or "B", jobvr must be set to jobvr="V".
Constraint: jobvr="N" or "V".
sense
Type: System..::..String
On entry: determines which reciprocal condition numbers are computed.
sense="N"
None are computed.
sense="E"
Computed for eigenvalues only.
sense="V"
Computed for right eigenvectors only.
sense="B"
Computed for eigenvalues and right eigenvectors.
If sense="E" or "B", both left and right eigenvectors must also be computed (jobvl="V" and jobvr="V").
Constraint: sense="N", "E", "V" or "B".
n
Type: System..::..Int32
On entry: n, the order of the matrix A.
Constraint: n0.
a
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint: dim1max1,n
Note: the second dimension of the array a must be at least max1,n.
On entry: the n by n matrix A.
On exit: a has been overwritten. If jobvl="V" or jobvr="V", A contains the real Schur form of the balanced version of the input matrix A.
wr
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the arrays wr and wi must be at least max1,n.
On exit: wr and wi contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first.
wi
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the arrays wr and wi must be at least max1,n.
On exit: wr and wi contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first.
vl
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint:
  • if jobvl="V", dim1max1,n;
  • otherwise dim11.
Note: the second dimension of the array vl must be at least max1,n if jobvl="V", and at least 1 otherwise.
On exit: if jobvl="V", the left eigenvectors uj are stored one after another in the columns of vl, in the same order as their corresponding eigenvalues. If the jth eigenvalue is real, then uj=vl[i-1,j-1], for i=1,2,,n. If the jth and j+1st eigenvalues form a complex conjugate pair, then uj=vl[i-1,j-1]+i×vl[i-1,j] and uj+1=vl[i-1,j-1]-i×vl[i-1,j], for i=1,2,,n.
If jobvl="N", vl is not referenced.
vr
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint:
  • if jobvr="V", dim1max1,n;
  • otherwise dim11.
Note: the second dimension of the array vr must be at least max1,n if jobvr="V", and at least 1 otherwise.
On exit: if jobvr="V", the right eigenvectors vj are stored one after another in the columns of vr, in the same order as their corresponding eigenvalues. If the jth eigenvalue is real, then vj=vr[i-1,j-1], for i=1,2,,n. If the jth and j+1st eigenvalues form a complex conjugate pair, then vj=vr[i-1,j-1]+i×vr[i-1,j] and vj+1=vr[i-1,j-1]-i×vr[i-1,j], for i=1,2,,n.
If jobvr="N", vr is not referenced.
ilo
Type: System..::..Int32%
On exit: ilo and ihi are integer values determined when A was balanced. The balanced A has aij=0 if i>j and j=1,2,,ilo-1 or i=ihi+1,,n.
ihi
Type: System..::..Int32%
On exit: ilo and ihi are integer values determined when A was balanced. The balanced A has aij=0 if i>j and j=1,2,,ilo-1 or i=ihi+1,,n.
scale
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the array scale must be at least max1,n.
On exit: details of the permutations and scaling factors applied when balancing A.
If pj is the index of the row and column interchanged with row and column j, and dj is the scaling factor applied to row and column j, then
  • scale[j-1]=pj, for j=1,2,,ilo-1;
  • scale[j-1]=dj, for j=ilo,,ihi;
  • scale[j-1]=pj, for j=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
abnrm
Type: System..::..Double%
On exit: the 1-norm of the balanced matrix (the maximum of the sum of absolute values of elements of any column).
rconde
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the array rconde must be at least max1,n.
On exit: rconde[j-1] is the reciprocal condition number of the jth eigenvalue.
rcondv
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the array rcondv must be at least max1,n.
On exit: rcondv[j-1] is the reciprocal condition number of the jth right eigenvector.
info
Type: System..::..Int32%
On exit: info=0 unless the method detects an error (see [Error Indicators and Warnings]).

Description

The right eigenvector vj of A satisfies
Avj=λjvj
where λj is the jth eigenvalue of A. The left eigenvector uj of A satisfies
ujHA=λjujH
where ujH denotes the conjugate transpose of uj.
Balancing a matrix means permuting the rows and columns to make it more nearly upper triangular, and applying a diagonal similarity transformation DAD-1, where D is a diagonal matrix, with the aim of making its rows and columns closer in norm and the condition numbers of its eigenvalues and eigenvectors smaller. The computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. For further explanation of balancing, see Section 4.8.1.2 of Anderson et al. (1999).
Following the optional balancing, the matrix A is first reduced to upper Hessenberg form by means of unitary similarity transformations, and the QR algorithm is then used to further reduce the matrix to upper triangular Schur form, T, from which the eigenvalues are computed. Optionally, the eigenvectors of T are also computed and backtransformed to those of A.

References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Error Indicators and Warnings

Some error messages may refer to parameters that are dropped from this interface (LDA, LDVL, LDVR) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
info<0
If info=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
info>0
If info=i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed; elements 1:ilo-1 and i+1:n of wr and wi contain eigenvalues which have converged.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value
ifail=-6000
Invalid Parameters value

Accuracy

The computed eigenvalues and eigenvectors are exact for a nearby matrix A+E, where
E2=OεA2,
and ε is the machine precision. See Section 4.8 of Anderson et al. (1999) for further details.

Parallelism and Performance

None.

Further Comments

Each eigenvector is normalized to have Euclidean norm equal to unity and the element of largest absolute value real and positive.
The total number of floating-point operations is proportional to n3.
The complex analogue of this method is f08np.

Example

This example finds all the eigenvalues and right eigenvectors of the matrix
A= 0.35 0.45 -0.14 -0.17 0.09 0.07 -0.54 0.35 -0.44 -0.33 -0.03 0.17 0.25 -0.32 -0.13 0.11 ,
together with estimates of the condition number and forward error bounds for each eigenvalue and eigenvector. The option to balance the matrix is used. In order to compute the condition numbers of the eigenvalues, the left eigenvectors also have to be computed, but they are not printed out in this example.

Example program (C#): f08nbe.cs

Example program data: f08nbe.d

Example program results: f08nbe.r

See Also