MATLAB Function Reference
  Go to function:
    Search    Help Desk 
balance    Examples   See Also

Improve accuracy of computed eigenvalues

Syntax

Description

[D,B] = balance(A) returns a diagonal matrix D whose elements are integer powers of two, and a balanced matrix B so that B = D\A*D. If A is symmetric, then B == A and D is the identity matrix.

B = balance(A) returns just the balanced matrix B.

Remarks

Nonsymmetric matrices can have poorly conditioned eigenvalues. Small perturbations in the matrix, such as roundoff errors, can lead to large perturbations in the eigenvalues. The quantity which relates the size of the matrix perturbation to the size of the eigenvalue perturbation is the condition number of the eigenvector matrix,

where

(The condition number of A itself is irrelevant to the eigenvalue problem.)

Balancing is an attempt to concentrate any ill conditioning of the eigenvector matrix into a diagonal scaling. Balancing usually cannot turn a nonsymmetric matrix into a symmetric matrix; it only attempts to make the norm of each row equal to the norm of the corresponding column. Furthermore, the diagonal scale factors are limited to powers of two so they do not introduce any roundoff error.

MATLAB's eigenvalue function, eig(A), automatically balances A before computing its eigenvalues. Turn off the balancing with eig(A,'nobalance').

Examples

This example shows the basic idea. The matrix A has large elements in the upper right and small elements in the lower left. It is far from being symmetric.

Balancing produces a diagonal D matrix with elements that are powers of two and a balanced matrix B that is closer to symmetric than A.

To see the effect on eigenvectors, first compute the eigenvectors of A.

Note that all three vectors have the first component the largest. This indicates V is badly conditioned; in fact cond(V) is 1.7484e+05. Next, look at the eigenvectors of B.

Now the eigenvectors are well behaved and cond(V) is 31.9814. The ill conditioning is concentrated in the scaling matrix; cond(D) is 8192.

This example is small and not really badly scaled, so the computed eigenvalues of A and B agree within roundoff error; balancing has little effect on the computed results.

Algorithm

balance is built into the MATLAB interpreter. It uses the algorithm in [1] originally published in Algol, but popularized by the Fortran routines BALANC and BALBAK from EISPACK.

Successive similarity transformations via diagonal matrices are applied to A to produce B. The transformations are accumulated in the transformation matrix D.

The eig function automatically uses balancing to prepare its input matrix.

Limitations

Balancing can destroy the properties of certain matrices; use it with some care. If a matrix contains small elements that are due to roundoff error, balancing may scale them up to make them as significant as the other elements of the original matrix.

Diagnostics

If A is not a square matrix:

See Also

condeig     Condition number with respect to eigenvalues

eig         Eigenvalues and eigenvectors

hess        Hessenberg form of a matrix

schur       Schur decomposition

References

[1] Parlett, B. N. and C. Reinsch, "Balancing a Matrix for Calculation of Eigenvalues and Eigenvectors," Handbook for Auto. Comp., Vol. II, Linear Algebra, 1971,pp. 315-326.



[ Previous | Help Desk | Next ]