MatrixBalance

Advanced Analysis Library Only

AnalysisLibErrType MatrixBalance (void *inputMatrix, int matrixSize, int method, int *indexLow, int *indexHigh, double scale[], void *balancedMatrix);

Purpose

Balances a general matrix so that its eigenvectors can be computed more accurately. If you want to compute more accurate eigenvectors for an unsymmetric matrix, complete the following steps:

  1. Balance the original matrix using MatrixBalance.
  2. Call GenEigenValueVector to get the eigenvectors of the balanced matrix.
  3. Call EigenVBack to back-transform the eigenvectors of the balanced matrix to the eigenvectors of the original matrix. Call CxEigenVBack if the eigenvectors are complex.

Parameters

Input
Name Type Description
inputMatrix numeric array The matrix to balance.
matrixSize integer The order of inputMatrix.
method integer Specifies how to balance inputMatrix. method must be one of the following values:
  • NONE (0): inputMatrix is neither permuted nor scaled, but indexLow, indexHigh, and scale get their values as follows: indexLow = 0, indexHigh = matrixSize - 1, scale[i] = 1, i = 0, matrixSize - 1, ...
  • PERMUTED (1): inputMatrix is permuted but not scaled.
  • SCALED (2): inputMatrix is scaled but not permuted.
  • PERMUTED_SCALED (3): inputMatrix is both permuted and scaled.
Output
Name Type Description
indexLow integer The lower index that records the permutation information. The values indexLow and indexHigh are such that on output, balancedMatrix[i,j] is 0 if i > j and (i <= j < indexLow or indexHigh < i <= matrixSize - 1).
indexHigh integer The upper index that records the permutation information.
scale double-precision array The scale information, whose size is matrixSize.
balancedMatrix numeric array The balanced matrix. In place operation is supported. That is, you can call the function with balancedMatrix = NULL or balancedMatrix = inputMatrix so that the balanced matrix overwrites inputMatrix directly.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.