The routine xGEBAL may be used to balance the matrix A prior to reduction to Hessenberg form . Balancing involves two steps, either of which is optional:
where P is a permutation matrix and and are upper triangular. Thus the matrix is already in Schur form outside the central diagonal block in rows and columns ILO to IHI. Subsequent operations by xGEBAL, xGEHRD or xHSEQR need only be applied to these rows and columns; therefore ILO and IHI are passed as arguments to xGEHRD and xHSEQR . This can save a significant amount of work if ILO > 1 or IHI < n. If no suitable permutation can be found (as is very often the case), xGEBAL sets ILO = 1 and IHI = n, and is the whole of A.
This can improve the accuracy of later processing in some cases; see subsection 22.214.171.124.
If A was balanced by xGEBAL, then eigenvectors computed by subsequent operations are eigenvectors of the balanced matrix ; xGEBAK must then be called to transform them back to eigenvectors of the original matrix A.