/// <summary>
 /// Transforms the matrix to tridiagonal form.
 /// </summary>
 /// <param name="matrix">Matrix to transform.</param>
 private void transformToTridiagonal(RealMatrix matrix)
 {
     // transform the matrix to tridiagonal
     transformer = new TriDiagonalTransformer(matrix);
     main        = transformer.getMainDiagonalRef();
     secondary   = transformer.getSecondaryDiagonalRef();
 }
        /// <summary>
        /// Calculates the eigen decomposition of the symmetric tridiagonal
        /// matrix.  The Householder matrix is assumed to be the identity matrix.
        /// </summary>
        /// <param name="main">Main diagonal of the symmetric tridiagonal form.</param>
        /// <param name="secondary">Secondary of the tridiagonal form.</param>
        /// <exception cref="MaxCountExceededException"> if the algorithm fails to converge.
        /// </exception>
        public EigenDecomposition(double[] main, double[] secondary)
        {
            isSymmetric    = true;
            this.main      = (Double[])main.Clone();
            this.secondary = (Double[])secondary.Clone();
            transformer    = null;
            int size = main.Length;

            double[][] z = new double[size][];
            for (int i = 0; i < size; i++)
            {
                z[i][i] = 1.0;
            }
            findEigenVectors(z);
        }