Balances a matrix to improve its conditioning.
BALANCE(a)
a |
- |
A square matrix |
A matrix where the row and column norms are approximately equal.
W1: {{1, 8, 3},
{3, 5, 2},
{1, 3, 4}}
balance(W1) == {{1.0, 4.0, 1.5},
{6.0, 5.0, 2.0},
{2.0, 3.0, 4.0}}
W2: {{0+8i, 0, 1+i},
{0, 1001, 0+3i},
{90, 0+i, 200}}
balance(W2) == {{0+8i, 0, 8+8i},
{0, 1001, 0+1.5i},
{11.25, 0+2i, 200}}
EIGVAL and EIGVEC first perform a balancing step where the rows and columns are transformed to have root mean squares as close as possible while leaving the eigenvalues and eigenvectors unchanged. In most cases, this improves the accuracy of EIGVAL and EIGVEC, but in some cases it does not. BALANCE can be used to check that relatively small table elements have not become unduly magnified by the balancing step. If they have, then NBEIGVAL and NBEIGVEC are likely to yield better results.
(v, d) = eig(a, "nobalance") computes eigenvalues and eigenvectors without balancing.
See DADiSP/MatrixXL to significantly optimize BALANCE.