eigenvalues = Matrices.eigenValuesAsRealMatrix(A);
This function call returns the eigenvalues of a square matrix A. The first column of "eigenvalues" contains the real and the second column contains the imaginary part of the eigenvalues. Before calculating the eigenvalues, matrix A is permuted and scaled (balanced) to improve the computation. For details see the lapack documentation.
Real A[3,3] = [1,2,3; 3,4,5; 2,1,4]; Real eval[3,2]; algorithm eval := Matrices.eigenValuesAsRealMatrix(A); // eval = [ 8.0 , 0; // -0.618, 0; // 1.618, 0];
i.e., matrix A has the 3 real eigenvalues 8.0, -0.618, 1.618.
function eigenValuesAsRealMatrix extends Modelica.Icons.Function; input Real A[:, size(A, 1)] "Matrix"; input Boolean balance = true "=true, if A is balanced (pre-scaled) before computation of the eigen values"; output Real eigenvalues[size(A, 1), 2] "Eigenvalues of matrix A (Re: first column, Im: second column)"; end eigenValuesAsRealMatrix;