/** * 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 CMatrixRMaj getH(CMatrixRMaj H) { H = UtilDecompositons_CDRM.checkZeros(H, N, N); // copy the first row Array.Copy(QH.data, 0, H.data, 0, N * 2); for (int i = 1; i < N; i++) { Array.Copy(QH.data, (i * N + i - 1) * 2, H.data, (i * N + i - 1) * 2, (N - i + 1) * 2); } 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. */ //@Override public CMatrixRMaj getT(CMatrixRMaj T) { T = UtilDecompositons_CDRM.checkZeros(T, N, N); T.data[0] = QT.data[0]; T.data[1] = QT.data[1]; for (int i = 1; i < N; i++) { T.set(i, i, QT.getReal(i, i), QT.getImag(i, i)); float real = QT.getReal(i - 1, i); float imag = QT.getImag(i - 1, i); T.set(i - 1, i, real, imag); T.set(i, i - 1, real, -imag); } return(T); }