/** * 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 FMatrixRMaj getH(FMatrixRMaj H) { H = UtilDecompositons_FDRM.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 FMatrixRMaj getT(FMatrixRMaj T) { T = UtilDecompositons_FDRM.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); }
/** * 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 virtual FMatrixRMaj getT(FMatrixRMaj T) { T = UtilDecompositons_FDRM.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)); float 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); }