balance

Returns a matrix with rows and columns of roughly equal magnitude.

Syntax

AA = balance(A)

AA = balance(A, opt)

[DD, AA] = balance(A, opt)

[D, P, AA] = balance(A, opt)

Inputs

A
The matrix to balance.
Type: double
Dimension: matrix
opt
The options are:
'p' or 'noscal' to permute, but not scale.
's' or 'noperm' to scale, but not permute.
string

Outputs

AA
The balanced matrix.
DD
A diagonal matrix with powers of 2.
P
A permutation vector.
D
A vector whose permutation by P produces the diagonal of DD.

Example

[DD,AA] = balance([1,0,0.0001;1,1,0.01;10000,100,1])
DD = [Matrix] 3 x 3
0.00012  0.00000  0.00000
0.00000  0.00781  0.00000
0.00000  0.00000  1.00000
AA = [Matrix] 3 x 3
1.00000  0.00000  0.81920
0.01563  1.00000  1.28000
1.22070  0.78125  1.00000

Comments

balance is only useful with an asymmetric matrix A. It's purpose is to improve eigenvalue calculations by computing eig(AA) in place of eig(A).

AA = DD \ A * DD. The row and column norms of AA are roughly equal in magnitude.

DD = P * D, where P is a permutation matrix and D is a diagonal matrix of powers of two.