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