TriDiagonalTransformer { public RealMatrix getQT() { if (cachedQt == null) { final int m = householderVectors.length; double[][] qta = new double[m][m]; for (int k = m - 1; k >= 1; --k) { final double[] hK = householderVectors[k - 1]; qta[k][k] = 1; if (hK[k] != 0.0) { final double inv = 1.0 / (secondary[k - 1] * hK[k]); double beta = 1.0 / secondary[k - 1]; qta[k][k] = 1 + beta * hK[k]; for (int i = k + 1; i < m; ++i) { qta[k][i] = beta * hK[i]; } for (int j = k + 1; j < m; ++j) { beta = 0; for (int i = k + 1; i < m; ++i) { beta += qta[j][i] * hK[i]; } beta *= inv; qta[j][k] = beta * hK[k]; for (int i = k + 1; i < m; ++i) { qta[j][i] += beta * hK[i]; } } } } qta[0][0] = 1; cachedQt = MatrixUtils.createRealMatrix(qta); } return cachedQt; } TriDiagonalTransformer(RealMatrix matrix); RealMatrix getQ(); RealMatrix getQT(); RealMatrix getT();  }
@Test public void testQTOrthogonal() { checkOrthogonal(new TriDiagonalTransformer(MatrixUtils.createRealMatrix(testSquare5)).getQT()); checkOrthogonal(new TriDiagonalTransformer(MatrixUtils.createRealMatrix(testSquare3)).getQT()); }