/// <summary> /// Calculates the eigen decomposition of the given real matrix. /// <para> /// Supports decomposition of a general matrix since 3.1. /// </para> /// </summary> /// <param name="matrix">Matrix to decompose.</param> /// <exception cref="MaxCountExceededException"> if the algorithm fails to converge. /// </exception> /// <exception cref="MathArithmeticException"> if the decomposition of a general matrix /// results in a matrix with zero norm</exception> public EigenDecomposition(RealMatrix matrix) { double symTol = 10 * matrix.getRowDimension() * matrix.getColumnDimension() * Precision.EPSILON; isSymmetric = MatrixUtils.isSymmetric(matrix, symTol); if (isSymmetric) { transformToTridiagonal(matrix); findEigenVectors(transformer.getQ().getData()); } else { SchurTransformer t = transformToSchur(matrix); findEigenVectorsFromSchur(t); } }