/**
         * An upper Hessenberg matrix from the decomposition.
         *
         * @param H If not null then the results will be stored here.  Otherwise a new matrix will be created.
         * @return The extracted H matrix.
         */
        public DMatrixRMaj getH(DMatrixRMaj H)
        {
            H = UtilDecompositons_DDRM.checkZeros(H, N, N);

            // copy the first row
            Array.Copy(QH.data, 0, H.data, 0, N);

            for (int i = 1; i < N; i++)
            {
                for (int j = i - 1; j < N; j++)
                {
                    H.set(i, j, QH.get(i, j));
                }
            }

            return(H);
        }
        /**
         * Extracts the tridiagonal matrix found in the decomposition.
         *
         * @param T If not null then the results will be stored here.  Otherwise a new matrix will be created.
         * @return The extracted T matrix.
         */
        public DMatrixRMaj getT(DMatrixRMaj T)
        {
            T = UtilDecompositons_DDRM.checkZeros(T, N, N);

            T.data[0] = QT.data[0];
            T.data[1] = QT.data[1];


            for (int i = 1; i < N - 1; i++)
            {
                T.set(i, i, QT.get(i, i));
                T.set(i, i + 1, QT.get(i, i + 1));
                T.set(i, i - 1, QT.get(i - 1, i));
            }

            T.data[(N - 1) * N + N - 1] = QT.data[(N - 1) * N + N - 1];
            T.data[(N - 1) * N + N - 2] = QT.data[(N - 2) * N + N - 1];

            return(T);
        }
Exemple #3
0
        /**
         * Extracts the tridiagonal matrix found in the decomposition.
         *
         * @param T If not null then the results will be stored here.  Otherwise a new matrix will be created.
         * @return The extracted T matrix.
         */
        //@Override
        public DMatrixRMaj getT(DMatrixRMaj T)
        {
            T = UtilDecompositons_DDRM.checkZeros(T, N, N);

            T.data[0] = QT.data[0];

            for (int i = 1; i < N; i++)
            {
                T.set(i, i, QT.get(i, i));
                double a = QT.get(i - 1, i);
                T.set(i - 1, i, a);
                T.set(i, i - 1, a);
            }

            if (N > 1)
            {
                T.data[(N - 1) * N + N - 1] = QT.data[(N - 1) * N + N - 1];
                T.data[(N - 1) * N + N - 2] = QT.data[(N - 2) * N + N - 1];
            }

            return(T);
        }