QRDecomposition { public RealMatrix getH() { if (cachedH == null) { final int n = qrt.length; final int m = qrt[0].length; double[][] ha = new double[m][n]; for (int i = 0; i < m; ++i) { for (int j = 0; j < FastMath.min(i + 1, n); ++j) { ha[i][j] = qrt[j][i] / -rDiag[j]; } } cachedH = MatrixUtils.createRealMatrix(ha); } return cachedH; } QRDecomposition(RealMatrix matrix);  QRDecomposition(RealMatrix matrix,
                           double threshold); RealMatrix getR(); RealMatrix getQ(); RealMatrix getQT(); RealMatrix getH(); DecompositionSolver getSolver();  }
@Test public void testHTrapezoidal() { RealMatrix matrix = MatrixUtils.createRealMatrix(testData3x3NonSingular); checkTrapezoidal(new QRDecomposition(matrix).getH()); matrix = MatrixUtils.createRealMatrix(testData3x3Singular); checkTrapezoidal(new QRDecomposition(matrix).getH()); matrix = MatrixUtils.createRealMatrix(testData3x4); checkTrapezoidal(new QRDecomposition(matrix).getH()); matrix = MatrixUtils.createRealMatrix(testData4x3); checkTrapezoidal(new QRDecomposition(matrix).getH()); Random r = new Random(643895747384642l); int p = (5 * BlockRealMatrix.BLOCK_SIZE) / 4; int q = (7 * BlockRealMatrix.BLOCK_SIZE) / 4; matrix = createTestMatrix(r, p, q); checkTrapezoidal(new QRDecomposition(matrix).getH()); matrix = createTestMatrix(r, p, q); checkTrapezoidal(new QRDecomposition(matrix).getH()); }