LUDecomposition { public RealMatrix getU() { if ((cachedU == null) && !singular) { final int m = pivot.length; cachedU = MatrixUtils.createRealMatrix(m, m); for (int i = 0; i < m; ++i) { final double[] luI = lu[i]; for (int j = i; j < m; ++j) { cachedU.setEntry(i, j, luI[j]); } } } return cachedU; } LUDecomposition(RealMatrix matrix);  LUDecomposition(RealMatrix matrix, double singularityThreshold); RealMatrix getL(); RealMatrix getU(); RealMatrix getP(); int[] getPivot(); double getDeterminant(); DecompositionSolver getSolver();  }
@Test public void testUUpperTriangular() { RealMatrix matrix = MatrixUtils.createRealMatrix(testData); RealMatrix u = new LUDecomposition(matrix).getU(); for (int i = 0; i < u.getRowDimension(); i++) { for (int j = 0; j < i; j++) { Assert.assertEquals(u.getEntry(i, j), 0, entryTolerance); } } }